MDL-47782 tool_monitor: Added context column on rule management page.

AMOS BEGIN
CPY [context,message],[context,tool_monitor]
AMOS END
This commit is contained in:
Simey Lameze 2014-10-24 11:55:07 +08:00
parent b49de5d930
commit 7bd88b0039
3 changed files with 18 additions and 3 deletions

View File

@ -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');
}
}

View File

@ -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';
@ -84,6 +85,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['title'] = '{$a->coursename} : {$a->reportname}';
$string['monitor:managerules'] = 'Manage event monitor rules';
$string['monitor:subscribe'] = 'Subscribe to event monitor rules';

View File

@ -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"