Class represents a single rule.  
 More...
|  | 
| stdClass | $rule | 
|  | The rule object form database. 
 | 
|  | 
Class represents a single rule. 
- Since
- Moodle 2.8
- Copyright
- 2014 onwards Ankit Agarwal ankit.nosp@m..agr.nosp@m.r@gma.nosp@m.il.c.nosp@m.om 
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 
◆ __construct()
      
        
          | tool_monitor\rule::__construct | ( |  | $rule | ) |  | 
      
 
Constructor. 
- Parameters
- 
  
    | stdClass | $rule | A rule object from database. |  
 
 
 
◆ __get()
      
        
          | tool_monitor\rule::__get | ( |  | $prop | ) |  | 
      
 
Magic get method. 
- Parameters
- 
  
    | string | $prop | property to get. |  
 
- Return values
- 
  
  
- Exceptions
- 
  
  
 
 
◆ can_manage_rule()
      
        
          | tool_monitor\rule::can_manage_rule | ( |  | $userid = null | ) |  | 
      
 
Can the user manage this rule? Defaults to $USER. 
- Parameters
- 
  
    | int | $userid | Check against this userid. |  
 
- Return values
- 
  
    | bool | true if the current user can manage this rule, else false. |  
 
 
 
◆ delete_rule()
      
        
          | tool_monitor\rule::delete_rule | ( |  | ) |  | 
      
 
Delete this rule. 
Note: It also removes all associated subscriptions. 
 
 
◆ duplicate_rule()
      
        
          | tool_monitor\rule::duplicate_rule | ( |  | $finalcourseid | ) |  | 
      
 
Api to duplicate a rule in a given courseid. 
- Parameters
- 
  
    | int | $finalcourseid | Final course id. |  
 
 
 
◆ get_course_name()
      
        
          | tool_monitor\rule::get_course_name | ( |  | $context | ) |  | 
      
 
Get properly formatted name of the course associated. 
- Parameters
- 
  
    | context | $context | context where this name would be displayed. |  
 
- Return values
- 
  
    | string | The course fullname. |  
 
 
 
◆ get_description()
      
        
          | tool_monitor\rule::get_description | ( | \context | $context | ) |  | 
      
 
Get properly formatted description of the rule associated. 
- Parameters
- 
  
    | context | $context | context where this description would be displayed. |  
 
- Return values
- 
  
    | string | Formatted description of the rule. |  
 
 
 
◆ get_event_name()
      
        
          | tool_monitor\rule::get_event_name | ( |  | ) |  | 
      
 
Method to get event name. 
- Return values
- 
  
  
- Exceptions
- 
  
  
 
 
◆ get_filters_description()
      
        
          | tool_monitor\rule::get_filters_description | ( |  | ) |  | 
      
 
Get filter description. 
- Return values
- 
  
  
 
 
◆ get_mform_set_data()
      
        
          | tool_monitor\rule::get_mform_set_data | ( |  | ) |  | 
      
 
Return the rule data to be used while setting mform. 
- Exceptions
- 
  
  
 
 
◆ get_name()
      
        
          | tool_monitor\rule::get_name | ( | \context | $context | ) |  | 
      
 
Get properly formatted name of the rule associated. 
- Parameters
- 
  
    | context | $context | context where this name would be displayed. |  
 
- Return values
- 
  
    | string | Formatted name of the rule. |  
 
 
 
◆ get_plugin_name()
      
        
          | tool_monitor\rule::get_plugin_name | ( |  | ) |  | 
      
 
Get name of the plugin associated with this rule. 
- Return values
- 
  
  
 
 
◆ get_subscribe_options()
      
        
          | tool_monitor\rule::get_subscribe_options | ( |  | $courseid | ) |  | 
      
 
Gets the rule subscribe options for a given course and rule. 
Could be a select drop down with a list of possible module instances or a single link to subscribe if the rule plugin is not a module.
- Parameters
- 
  
  
- Return values
- 
  
    | single_select|moodle_url|string |  |  
 
- Exceptions
- 
  
  
 
 
◆ subscribe_user()
      
        
          | tool_monitor\rule::subscribe_user | ( |  | $courseid, | 
        
          |  |  |  | $cmid, | 
        
          |  |  |  | $userid = 0 ) | 
      
 
Subscribe an user to this rule. 
- Parameters
- 
  
    | int | $courseid | Course id. |  | int | $cmid | Course module id. |  | int | $userid | User id. |  
 
- Exceptions
- 
  
  
 
 
The documentation for this class was generated from the following file: