Merge branch 'MDL-47767-master' of git://github.com/xow/moodle

This commit is contained in:
Dan Poltawski
2014-10-23 10:50:01 +01:00
6 changed files with 52 additions and 1 deletions
@@ -68,7 +68,7 @@ class renderer extends \plugin_renderer_base {
}
/**
* Html to add a button for adding a new rul.
* Html to add a button for adding a new rule.
*
* @param int $courseid course id.
*
@@ -81,4 +81,19 @@ class renderer extends \plugin_renderer_base {
$addurl = new \moodle_url($CFG->wwwroot. '/admin/tool/monitor/edit.php', array('courseid' => $courseid));
return \html_writer::link($addurl, $button);
}
/**
* Html to add a link to go to the subscription page.
*
* @param moodle_url $manageurl The url of the subscription page.
*
* @return string html for the link to the subscription page.
*/
public function render_subscriptions_link($manageurl) {
echo \html_writer::start_div();
$a = \html_writer::link($manageurl, get_string('managesubscriptions', 'tool_monitor'));
$link = \html_writer::tag('span', get_string('managesubscriptionslink', 'tool_monitor', $a));
echo $link;
echo \html_writer::end_div();
}
}
@@ -91,4 +91,19 @@ class renderer extends \plugin_renderer_base {
return $o;
}
/**
* Html to add a link to go to the rule manager page.
*
* @param moodle_url $ruleurl The url of the rule manager page.
*
* @return string html for the link to the rule manager page.
*/
public function render_rules_link($ruleurl) {
echo \html_writer::start_div();
$a = \html_writer::link($ruleurl, get_string('managerules', 'tool_monitor'));
$link = \html_writer::tag('span', get_string('manageruleslink', 'tool_monitor', $a));
echo $link;
echo \html_writer::end_div();
}
}
+3
View File
@@ -107,5 +107,8 @@ if (empty($totalrules)) {
echo $link;
}
echo html_writer::end_div();
} else if (has_capability('tool/monitor:managerules', $context)) {
$manageurl = new moodle_url("/admin/tool/monitor/managerules.php", array('courseid' => $courseid));
echo $renderer->render_rules_link($manageurl);
}
echo $OUTPUT->footer();
@@ -51,6 +51,7 @@ $string['frequency'] = 'Frequency';
$string['invalidmodule'] = 'Invalid module';
$string['norules'] = 'There are no rules you can subscribe to.';
$string['manageruleslink'] = 'You can manage rules from {$a} page.';
$string['managesubscriptionslink'] = 'You can subscribe to rules from the {$a} page.';
$string['moduleinstance'] = 'Module instance';
$string['manage'] = 'Manage';
$string['managesubscriptions'] = 'Event monitoring';
+4
View File
@@ -90,4 +90,8 @@ if (!empty($action) && $ruleid) {
$renderable = new \tool_monitor\output\managerules\renderable('toolmonitorrules', $manageurl, $courseid);
$renderer = $PAGE->get_renderer('tool_monitor', 'managerules');
echo $renderer->render($renderable);
if (has_capability('tool/monitor:subscribe', $context)) {
$manageurl = new moodle_url("/admin/tool/monitor/index.php", array('courseid' => $courseid));
echo $renderer->render_subscriptions_link($manageurl);
}
echo $OUTPUT->footer();
@@ -123,3 +123,16 @@ Feature: tool_monitor_subscriptions
When I follow "Messages"
And I follow "Do not reply to this email (1)"
Then I should see "The course was viewed."
Scenario: Navigating via quick link to rules
Given I log in as "admin"
And I navigate to "Event monitoring" node in "My profile settings"
Then I should see "You can manage rules from Event monitoring rules page."
And I follow "Event monitoring rules"
And I should see "Event monitor"
And I should see "You can subscribe to rules from the Event monitoring page."
And I log out
And I log in as "teacher1"
And I follow "Course 1"
And I navigate to "Event monitoring" node in "My profile settings"
Then I should not see "You can manage rules from Event monitoring rules page."