Rule manager class.
Copyright: | 2014 onwards Simey Lameze <lameze@gmail.com> |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 290 lines (10 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
rule_manager:: (10 methods):
add_rule()
clean_ruledata_form()
delete_rule()
get_rule()
update_rule()
get_rules_by_courseid()
count_rules_by_courseid()
get_rules_by_plugin()
get_rules_by_event()
get_instances()
Class: rule_manager - X-Ref
Rule manager class.add_rule($ruledata) X-Ref |
Create a new rule. return: rule An instance of rule class. param: \stdClass $ruledata data to insert as new rule entry. |
clean_ruledata_form($mformdata) X-Ref |
Clean data submitted by mform. return: \stdClass Cleaned rule data. param: \stdClass $mformdata data to insert as new rule entry. |
delete_rule($ruleid, $coursecontext = null) X-Ref |
Delete a rule and associated subscriptions, by rule id. return: bool param: int $ruleid id of rule to be deleted. param: \context|null $coursecontext the context of the course - this is passed when we |
get_rule($ruleorid) X-Ref |
Get an instance of rule class. return: rule object with rule id. param: \stdClass|int $ruleorid A rule object from database or rule id. |
update_rule($ruledata) X-Ref |
Update rule data. return: bool param: object $ruledata rule data to be updated. |
get_rules_by_courseid($courseid, $limitfrom = 0, $limitto = 0, $includesite = true) X-Ref |
Get rules by course id. return: array List of rules for the given course id, if specified will also include site rules. param: int $courseid course id of the rule. param: int $limitfrom Limit from which to fetch rules. param: int $limitto Limit to which rules need to be fetched. param: bool $includesite Determines whether we return site wide rules or not. |
count_rules_by_courseid($courseid) X-Ref |
Get rule count by course id. return: int count of rules present in system visible in the given course id. param: int $courseid course id of the rule. |
get_rules_by_plugin($plugin) X-Ref |
Get rules by plugin name. return: array List of rules for the given plugin name. param: string $plugin plugin name of the rule. |
get_rules_by_event($eventname) X-Ref |
Get rules by event name. return: array List of rules for the given event. param: string $eventname event name of the rule. |
get_instances($arr) X-Ref |
Helper method to convert db records to instances. return: array of rules as instances. param: array $arr of rules. |