Moodle APIs 4.3
Moodle 4.3.6 (Build: 20240812)
tool_monitor\rule Class Reference

Class represents a single rule. More...

Public Member Functions

 __construct ($rule)
 Constructor.
 
 __get ($prop)
 Magic get method.
 
 can_manage_rule ($userid=null)
 Can the user manage this rule? Defaults to $USER.
 
 delete_rule ()
 Delete this rule.
 
 duplicate_rule ($finalcourseid)
 Api to duplicate a rule in a given courseid.
 
 get_course_name ($context)
 Get properly formatted name of the course associated.
 
 get_description (\context $context)
 Get properly formatted description of the rule associated.
 
 get_event_name ()
 Method to get event name.
 
 get_filters_description ()
 Get filter description.
 
 get_mform_set_data ()
 Return the rule data to be used while setting mform.
 
 get_name (\context $context)
 Get properly formatted name of the rule associated.
 
 get_plugin_name ()
 Get name of the plugin associated with this rule.
 
 get_subscribe_options ($courseid)
 Gets the rule subscribe options for a given course and rule.
 
 subscribe_user ($courseid, $cmid, $userid=0)
 Subscribe an user to this rule.
 

Protected Attributes

stdClass $rule
 The rule object form database.
 

Detailed Description

Class represents a single rule.

Since
Moodle 2.8
License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Constructor & Destructor Documentation

◆ __construct()

tool_monitor\rule::__construct ( $rule)

Constructor.

Parameters
stdClass$ruleA rule object from database.

Member Function Documentation

◆ __get()

tool_monitor\rule::__get ( $prop)

Magic get method.

Parameters
string$propproperty to get.
Return values
mixed
Exceptions
coding_exception

◆ can_manage_rule()

tool_monitor\rule::can_manage_rule ( $userid = null)

Can the user manage this rule? Defaults to $USER.

Parameters
int$useridCheck against this userid.
Return values
booltrue 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$finalcourseidFinal course id.

◆ get_course_name()

tool_monitor\rule::get_course_name ( $context)

Get properly formatted name of the course associated.

Parameters
context$contextcontext where this name would be displayed.
Return values
stringThe course fullname.

◆ get_description()

tool_monitor\rule::get_description ( \context $context)

Get properly formatted description of the rule associated.

Parameters
context$contextcontext where this description would be displayed.
Return values
stringFormatted description of the rule.

◆ get_event_name()

tool_monitor\rule::get_event_name ( )

Method to get event name.

Return values
string
Exceptions
coding_exception

◆ get_filters_description()

tool_monitor\rule::get_filters_description ( )

Get filter description.

Return values
string

◆ get_mform_set_data()

tool_monitor\rule::get_mform_set_data ( )

Return the rule data to be used while setting mform.

Exceptions
coding_exception

◆ get_name()

tool_monitor\rule::get_name ( \context $context)

Get properly formatted name of the rule associated.

Parameters
context$contextcontext where this name would be displayed.
Return values
stringFormatted name of the rule.

◆ get_plugin_name()

tool_monitor\rule::get_plugin_name ( )

Get name of the plugin associated with this rule.

Return values
stringPlugin name.

◆ 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
int$courseidcourse id
Return values
single_select|moodle_url|string
Exceptions
coding_exception

◆ subscribe_user()

tool_monitor\rule::subscribe_user ( $courseid,
$cmid,
$userid = 0 )

Subscribe an user to this rule.

Parameters
int$courseidCourse id.
int$cmidCourse module id.
int$useridUser id.
Exceptions
coding_exception

The documentation for this class was generated from the following file: