mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 08:22:07 +02:00
MDL-47767 tool_monitor: Use renderers for links between subscription and rule managers
This commit is contained in:
parent
220602b7f0
commit
6a6dd57c90
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -108,12 +108,7 @@ if (empty($totalrules)) {
|
||||
}
|
||||
echo html_writer::end_div();
|
||||
} else if (has_capability('tool/monitor:managerules', $context)) {
|
||||
echo html_writer::start_div();
|
||||
$params = $courseid == 1 ? array() : array('courseid' => $courseid);
|
||||
$manageurl = new moodle_url("/" . $CFG->admin . "/tool/monitor/managerules.php", $params);
|
||||
$a = html_writer::link($manageurl, get_string('managerules', 'tool_monitor'));
|
||||
$link = html_writer::tag('span', get_string('manageruleslink', 'tool_monitor', $a));
|
||||
echo $link;
|
||||
echo html_writer::end_div();
|
||||
$manageurl = new moodle_url("/admin/tool/monitor/managerules.php", array('courseid' => $courseid));
|
||||
echo $renderer->render_rules_link($manageurl);
|
||||
}
|
||||
echo $OUTPUT->footer();
|
||||
|
@ -91,12 +91,7 @@ $renderable = new \tool_monitor\output\managerules\renderable('toolmonitorrules'
|
||||
$renderer = $PAGE->get_renderer('tool_monitor', 'managerules');
|
||||
echo $renderer->render($renderable);
|
||||
if (has_capability('tool/monitor:subscribe', $context)) {
|
||||
echo html_writer::start_div();
|
||||
$params = $courseid == 0 ? array('courseid' => 1) : array('courseid' => $courseid);
|
||||
$manageurl = new moodle_url("/" . $CFG->admin . "/tool/monitor/index.php", $params);
|
||||
$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();
|
||||
$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."
|
||||
|
Loading…
x
Reference in New Issue
Block a user