diff --git a/admin/tool/monitor/classes/output/managerules/renderable.php b/admin/tool/monitor/classes/output/managerules/renderable.php index 0819aaef0d6..c42f83724f7 100644 --- a/admin/tool/monitor/classes/output/managerules/renderable.php +++ b/admin/tool/monitor/classes/output/managerules/renderable.php @@ -64,11 +64,13 @@ class renderable extends \table_sql implements \renderable { 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'), @@ -198,4 +200,15 @@ class renderable extends \table_sql implements \renderable { $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'); + } } diff --git a/admin/tool/monitor/lang/en/tool_monitor.php b/admin/tool/monitor/lang/en/tool_monitor.php index fcef71bf10e..a01dac41664 100644 --- a/admin/tool/monitor/lang/en/tool_monitor.php +++ b/admin/tool/monitor/lang/en/tool_monitor.php @@ -28,6 +28,7 @@ $string['addrule'] = 'Add a new rule'; $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'; @@ -92,6 +93,7 @@ $string['subcreatesuccess'] = "Subscription successfully created"; $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['taskcleanevents'] = 'Removes any unnecessary event monitor events'; $string['title'] = '{$a->coursename} : {$a->reportname}'; $string['monitor:managerules'] = 'Manage event monitor rules'; diff --git a/admin/tool/monitor/tests/behat/rule.feature b/admin/tool/monitor/tests/behat/rule.feature index 80f74d3842d..33287a8946d 100644 --- a/admin/tool/monitor/tests/behat/rule.feature +++ b/admin/tool/monitor/tests/behat/rule.feature @@ -55,7 +55,7 @@ Feature: tool_monitor_rule | 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" @@ -116,7 +116,7 @@ Feature: tool_monitor_rule | 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"