public function __construct($uniqueid, \moodle_url $url, $courseid = 0, $perpage = 100) {
parent::__construct($uniqueid);
+ $this->set_attribute('id', 'toolmonitorrules_table');
$this->set_attribute('class', 'toolmonitor managerules generaltable generalbox');
- $this->define_columns(array('name', 'description', 'plugin', 'eventname', 'filters', 'manage'));
+ $this->define_columns(array('name', 'description', 'context', 'plugin', 'eventname', 'filters', 'manage'));
$this->define_headers(array(
get_string('name'),
get_string('description'),
+ get_string('context', 'tool_monitor'),
get_string('plugin'),
get_string('eventname'),
get_string('frequency', 'tool_monitor'),
$this->initialbars($total > $pagesize);
}
}
+
+ /**
+ * Generate content for context column.
+ *
+ * @param \tool_monitor\rule $rule rule object
+ *
+ * @return string html used to display the context column field.
+ */
+ public function col_context(\tool_monitor\rule $rule) {
+ return ($rule->courseid == 0) ? get_string('system', 'tool_monitor') : get_string('course');
+ }
}
$string['allevents'] = 'All events';
$string['allmodules'] = 'All modules';
$string['core'] = 'Core';
+$string['context'] = 'Context';
$string['customisefilters'] = 'Select the frequency of the events';
$string['customisemessage'] = 'Customise the notification message';
$string['currentsubscriptions'] = 'Your current subscriptions';
$string['subdeletesuccess'] = "Subscription successfully removed";
$string['subhelp'] = 'Subscription details';
$string['subhelp_help'] = 'This subscription listens for when the event \'{$a->eventname}\' has been triggered in \'{$a->moduleinstance}\' {$a->frequency} time(s) in {$a->minutes} minute(s).';
+$string['system'] = "System";
$string['title'] = '{$a->coursename} : {$a->reportname}';
$string['monitor:managerules'] = 'Manage event monitor rules';
$string['monitor:subscribe'] = 'Subscribe to event monitor rules';
| minutes | 1 |
| Message template | The forum post was created. {modulelink} |
And I press "Save changes"
- Then I should see "New rule"
+ Then "New rule" row "Context" column of "toolmonitorrules_table" table should contain "Course"
And I should see "I want a rule to monitor posts created on a forum"
And I should see "Forum"
And I should see "Post created"
| minutes | 1 |
| Message template | The forum post was created. {modulelink} |
And I press "Save changes"
- Then I should see "New rule"
+ Then "New rule" row "Context" column of "toolmonitorrules_table" table should contain "System"
And I should see "I want a rule to monitor posts created on a forum"
And I should see "Forum"
And I should see "Post created"