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. param: \stdClass $ruledata data to insert as new rule entry. return: rule An instance of rule class. |
clean_ruledata_form($mformdata) X-Ref |
Clean data submitted by mform. param: \stdClass $mformdata data to insert as new rule entry. return: \stdClass Cleaned rule data. |
delete_rule($ruleid, $coursecontext = null) X-Ref |
Delete a rule and associated subscriptions, by rule id. param: int $ruleid id of rule to be deleted. param: \context|null $coursecontext the context of the course - this is passed when we return: bool |
get_rule($ruleorid) X-Ref |
Get an instance of rule class. param: \stdClass|int $ruleorid A rule object from database or rule id. return: rule object with rule id. |
update_rule($ruledata) X-Ref |
Update rule data. param: object $ruledata rule data to be updated. return: bool |
get_rules_by_courseid($courseid, $limitfrom = 0, $limitto = 0, $includesite = true) X-Ref |
Get rules by course id. 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. return: array List of rules for the given course id, if specified will also include site rules. |
count_rules_by_courseid($courseid) X-Ref |
Get rule count by course id. param: int $courseid course id of the rule. return: int count of rules present in system visible in the given course id. |
get_rules_by_plugin($plugin) X-Ref |
Get rules by plugin name. param: string $plugin plugin name of the rule. return: array List of rules for the given plugin name. |
get_rules_by_event($eventname) X-Ref |
Get rules by event name. param: string $eventname event name of the rule. return: array List of rules for the given event. |
get_instances($arr) X-Ref |
Helper method to convert db records to instances. param: array $arr of rules. return: array of rules as instances. |