Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Public Member Functions | Protected Attributes | List of all members
tool_monitor\rule Class Reference

Class represents a single rule. More...

Public Member Functions

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

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: