mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-73532 navigation: Modify methods that extend the setting nav
Introduces some changes to the exising _extend_settings_navigation() methods that utilize the global $PAGE object. In order to accomodate the changes done for the secondary navigation for single activity courses, the methods that extend the settings navigation can no longer rely on the $PAGE object, instead the more reliabe way to obtain this infomation is through the get_page() method from settings_navigation class.
This commit is contained in:
parent
bf27303955
commit
4a9c83ac9e
19 changed files with 132 additions and 145 deletions
|
@ -408,7 +408,7 @@ function assign_supports($feature) {
|
|||
* @return void
|
||||
*/
|
||||
function assign_extend_settings_navigation(settings_navigation $settings, navigation_node $navref) {
|
||||
global $PAGE, $DB;
|
||||
global $DB;
|
||||
|
||||
// We want to add these new nodes after the Edit settings node, and before the
|
||||
// Locally assigned roles node. Of course, both of those are controlled by capabilities.
|
||||
|
@ -421,20 +421,20 @@ function assign_extend_settings_navigation(settings_navigation $settings, naviga
|
|||
$beforekey = $keys[$i + 1];
|
||||
}
|
||||
|
||||
$cm = $PAGE->cm;
|
||||
$cm = $settings->get_page()->cm;
|
||||
if (!$cm) {
|
||||
return;
|
||||
}
|
||||
|
||||
$context = $cm->context;
|
||||
$course = $PAGE->course;
|
||||
$course = $settings->get_page()->course;
|
||||
|
||||
if (!$course) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (has_capability('mod/assign:manageoverrides', $PAGE->cm->context)) {
|
||||
$url = new moodle_url('/mod/assign/overrides.php', array('cmid' => $PAGE->cm->id, 'mode' => 'user'));
|
||||
if (has_capability('mod/assign:manageoverrides', $settings->get_page()->cm->context)) {
|
||||
$url = new moodle_url('/mod/assign/overrides.php', ['cmid' => $settings->get_page()->cm->id, 'mode' => 'user']);
|
||||
|
||||
$node = navigation_node::create(get_string('overrides', 'assign'),
|
||||
$url,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue