From aa1c2e2382ac22bed605ccbc60ee2ae84dbe092e Mon Sep 17 00:00:00 2001 From: Sujith Haridasan Date: Thu, 24 Feb 2022 12:53:46 +0530 Subject: [PATCH] MDL-73848 administration: Fix the breadcrumbs and nav highlights Create or update the breadcrumbs in the site administration pages where it is required. Highlight the corresponding site adminstration tab. Highlight the primary nav to Site administration when user is navigating to any of the site administration pages. Also changed the boostnavbar so that the nodes in the secondary navigation are not shown in the breadcrumbs when user is in site administration page. --- admin/index.php | 1 + admin/plugins.php | 2 ++ admin/roles/allow.php | 3 +++ admin/roles/define.php | 4 ++++ admin/roles/manage.php | 3 +++ admin/searchareas.php | 2 ++ admin/searchreindex.php | 3 +++ admin/settings.php | 5 +++++ .../tool/admin_presets/classes/local/action/base.php | 4 ++++ admin/tool/admin_presets/index.php | 1 + admin/tool/analytics/classes/output/helper.php | 6 +++++- admin/tool/customlang/edit.php | 5 +++++ admin/tool/customlang/import.php | 6 ++++++ admin/tool/customlang/index.php | 2 ++ admin/tool/customlang/lang/en/tool_customlang.php | 1 + admin/tool/dataprivacy/classes/page_helper.php | 2 ++ admin/tool/filetypes/delete.php | 2 ++ admin/tool/filetypes/edit.php | 4 ++++ admin/tool/langimport/index.php | 2 ++ admin/tool/messageinbound/index.php | 4 ++++ admin/tool/monitor/edit.php | 4 ++++ admin/tool/monitor/managerules.php | 5 ++++- admin/tool/task/scheduledtasks.php | 4 ++++ admin/tool/usertours/classes/manager.php | 2 ++ admin/user.php | 3 +++ admin/user/user_bulk_confirm.php | 3 +++ admin/user/user_bulk_delete.php | 3 +++ admin/user/user_bulk_display.php | 3 +++ admin/user/user_bulk_download.php | 3 +++ admin/user/user_bulk_forcepasswordchange.php | 3 +++ admin/user/user_bulk_message.php | 3 +++ admin/webservice/service.php | 12 +++++++++++- admin/webservice/service_functions.php | 3 +++ admin/webservice/tokens.php | 6 ++++++ backup/backupfilesedit.php | 12 +++++++----- cache/admin.php | 4 ++++ .../classes/local/administration_display_helper.php | 3 +++ cohort/index.php | 6 ++++++ course/editcategory.php | 1 + grade/edit/letter/index.php | 1 + grade/edit/outcome/edit.php | 2 ++ grade/edit/outcome/index.php | 1 + grade/edit/scale/edit.php | 1 + grade/edit/scale/index.php | 1 + lang/en/cache.php | 3 +++ lang/en/payment.php | 1 + lang/en/webservice.php | 3 +++ mod/lti/registersettings.php | 3 +++ mod/lti/typessettings.php | 5 ++++- my/indexsys.php | 2 ++ payment/accounts.php | 2 ++ payment/manage_account.php | 8 ++++++++ payment/manage_gateway.php | 4 ++++ report/eventlist/eventdetail.php | 3 +++ report/log/index.php | 1 + report/questioninstances/index.php | 1 + tag/manage.php | 2 ++ theme/boost/classes/boostnavbar.php | 4 +--- theme/index.php | 3 +++ user/editadvanced.php | 2 ++ user/profilesys.php | 2 +- 61 files changed, 187 insertions(+), 13 deletions(-) diff --git a/admin/index.php b/admin/index.php index c8c9015d18808..3e91f680325b6 100644 --- a/admin/index.php +++ b/admin/index.php @@ -825,6 +825,7 @@ $SESSION->admin_critical_warning = ($insecuredataroot==INSECURE_DATAROOT_ERROR); $adminroot = admin_get_root(); +$PAGE->set_primary_active_tab('siteadminnode'); // Check if there are any new admin settings which have still yet to be set if (any_new_admin_settings($adminroot)) { diff --git a/admin/plugins.php b/admin/plugins.php index e4867c1acb8b3..f4d3d0c5cd9bd 100644 --- a/admin/plugins.php +++ b/admin/plugins.php @@ -52,6 +52,8 @@ $pluginman = core_plugin_manager::instance(); +$PAGE->set_primary_active_tab('siteadminnode'); + if ($uninstall) { if (!$confirmed) { diff --git a/admin/roles/allow.php b/admin/roles/allow.php index 643e6cee5615d..824cfa81cca39 100644 --- a/admin/roles/allow.php +++ b/admin/roles/allow.php @@ -49,6 +49,9 @@ redirect($baseurl); } +$PAGE->set_secondary_active_tab('users'); +$PAGE->set_primary_active_tab('siteadminnode'); + $controller->load_current_settings(); // Display the editing form. diff --git a/admin/roles/define.php b/admin/roles/define.php index fdf144de6ca2a..ede0a721047e1 100644 --- a/admin/roles/define.php +++ b/admin/roles/define.php @@ -87,6 +87,10 @@ $title = get_string('editingrolex', 'core_role', $rolenames[$roleid]->localname); } +$PAGE->set_secondary_active_tab('users'); +$PAGE->set_primary_active_tab('siteadminnode'); +$PAGE->navbar->add($title, $baseurl); + // Decide how to create new role. if ($action === 'add' and $resettype !== 'none') { $mform = new core_role_preset_form(null, array('action'=>'add', 'roleid'=>0, 'resettype'=>'0', 'return'=>'manage')); diff --git a/admin/roles/manage.php b/admin/roles/manage.php index 5a1530f60681b..ad35a1cf9368e 100644 --- a/admin/roles/manage.php +++ b/admin/roles/manage.php @@ -60,6 +60,9 @@ $undeletableroles[$CFG->guestroleid] = 1; $undeletableroles[$CFG->defaultuserroleid] = 1; +$PAGE->set_primary_active_tab('siteadminnode'); +$PAGE->navbar->add(get_string('defineroles', 'role'), $PAGE->url); + // Process submitted data. $confirmed = (optional_param('confirm', false, PARAM_BOOL) && data_submitted() && confirm_sesskey()); switch ($action) { diff --git a/admin/searchareas.php b/admin/searchareas.php index fb5b0a309182a..d524f9b5e4229 100644 --- a/admin/searchareas.php +++ b/admin/searchareas.php @@ -37,6 +37,8 @@ // In action cases, we'll throw this exception below. In non-action cases, we produce a lang string error. } +$PAGE->set_primary_active_tab('siteadminnode'); + // Handle all the actions. if ($action) { // If dealing with an areaid, we need to check that the area exists. diff --git a/admin/searchreindex.php b/admin/searchreindex.php index 9fa7a3ccae6d8..b149e75f3a0c9 100644 --- a/admin/searchreindex.php +++ b/admin/searchreindex.php @@ -39,6 +39,9 @@ } $areaname = $area->get_visible_name(); +$PAGE->set_primary_active_tab('siteadminnode'); +$PAGE->set_secondary_active_tab('modules'); + // Start page output. $heading = get_string('gradualreindex', 'search', ''); $PAGE->set_title($PAGE->title . ': ' . $heading); diff --git a/admin/settings.php b/admin/settings.php index a3d48fc48c996..30071432b01ca 100644 --- a/admin/settings.php +++ b/admin/settings.php @@ -118,6 +118,11 @@ $PAGE->set_title("$SITE->shortname: " . implode(": ",$visiblepathtosection)); $PAGE->set_heading($SITE->fullname); + if ($section === 'frontpagesettings') { + $PAGE->navbar->add(get_string('frontpage', 'admin'), + new moodle_url('/admin/category.php', ['category' => 'frontpage'])); + $PAGE->navbar->add(get_string('frontpagesettings', 'admin'), $PAGE->url); + } echo $OUTPUT->header(); if ($errormsg !== '') { diff --git a/admin/tool/admin_presets/classes/local/action/base.php b/admin/tool/admin_presets/classes/local/action/base.php index 2cba888a6e013..fc1e6ffab3214 100644 --- a/admin/tool/admin_presets/classes/local/action/base.php +++ b/admin/tool/admin_presets/classes/local/action/base.php @@ -137,6 +137,10 @@ protected function display_header(): void { $PAGE->navbar->add($title); } + if ($node = $PAGE->settingsnav->find('tool_admin_presets', \navigation_node::TYPE_SETTING)) { + $node->make_active(); + } + echo $OUTPUT->header(); echo $OUTPUT->heading($title); if ($text) { diff --git a/admin/tool/admin_presets/index.php b/admin/tool/admin_presets/index.php index ddce329ae07b4..49d71cd675a72 100644 --- a/admin/tool/admin_presets/index.php +++ b/admin/tool/admin_presets/index.php @@ -52,6 +52,7 @@ $PAGE->set_url($url); $PAGE->set_pagelayout('admin'); $PAGE->set_context($context); +$PAGE->set_primary_active_tab('siteadminnode'); // Executes the required action. $instance = new $classname(); diff --git a/admin/tool/analytics/classes/output/helper.php b/admin/tool/analytics/classes/output/helper.php index 7d286253f4180..4202562114426 100644 --- a/admin/tool/analytics/classes/output/helper.php +++ b/admin/tool/analytics/classes/output/helper.php @@ -76,10 +76,14 @@ public static function set_navbar(string $title, \moodle_url $url, ?\context $co $PAGE->set_context($context); $PAGE->set_url($url); + $PAGE->set_secondary_active_tab('siteadminnode'); + $PAGE->set_primary_active_tab('siteadminnode'); if ($siteadmin = $PAGE->settingsnav->find('root', \navigation_node::TYPE_SITE_ADMIN)) { - $PAGE->navbar->add($siteadmin->get_content(), $siteadmin->action()); + $PAGE->navbar->add($siteadmin->get_content(), $siteadmin->action(), + \breadcrumb_navigation_node::TYPE_SITE_ADMIN, null, 'root'); } + if ($analytics = $PAGE->settingsnav->find('analytics', \navigation_node::TYPE_SETTING)) { $PAGE->navbar->add($analytics->get_content(), $analytics->action()); } diff --git a/admin/tool/customlang/edit.php b/admin/tool/customlang/edit.php index aabc31eb133cd..bfdfd9461a2e0 100644 --- a/admin/tool/customlang/edit.php +++ b/admin/tool/customlang/edit.php @@ -38,6 +38,11 @@ array('pagelayout' => 'report')); // Hack: allows for wide page contents. $PAGE->requires->js_init_call('M.tool_customlang.init_editor', array(), true); +$PAGE->set_context(context_system::instance()); +$PAGE->set_secondary_active_tab('siteadminnode'); +$PAGE->set_primary_active_tab('siteadminnode'); +$PAGE->navbar->add(get_string('editlangpack', 'tool_customlang'), $PAGE->url); + if (empty($lng)) { // PARAM_LANG validation failed diff --git a/admin/tool/customlang/import.php b/admin/tool/customlang/import.php index 628a9f886554b..2cf5ed9278bfa 100644 --- a/admin/tool/customlang/import.php +++ b/admin/tool/customlang/import.php @@ -38,6 +38,12 @@ admin_externalpage_setup('toolcustomlang', '', null, new moodle_url('/admin/tool/customlang/import.php', ['lng' => $lng])); +$PAGE->set_context(context_system::instance()); + +$PAGE->set_secondary_active_tab('siteadminnode'); +$PAGE->set_primary_active_tab('siteadminnode'); +$PAGE->navbar->add(get_string('import', 'tool_customlang'), $PAGE->url); + $output = $PAGE->get_renderer('tool_customlang'); $form = new import(null, ['lng' => $lng]); diff --git a/admin/tool/customlang/index.php b/admin/tool/customlang/index.php index e57aa4428cbd8..09fc31aebd316 100644 --- a/admin/tool/customlang/index.php +++ b/admin/tool/customlang/index.php @@ -40,6 +40,8 @@ admin_externalpage_setup('toolcustomlang'); $langs = get_string_manager()->get_list_of_translations(); +$PAGE->set_primary_active_tab('siteadminnode'); + // pre-output actions if ($action === 'checkout') { require_sesskey(); diff --git a/admin/tool/customlang/lang/en/tool_customlang.php b/admin/tool/customlang/lang/en/tool_customlang.php index 882f920876427..9343e68e82eb0 100644 --- a/admin/tool/customlang/lang/en/tool_customlang.php +++ b/admin/tool/customlang/lang/en/tool_customlang.php @@ -50,6 +50,7 @@ $string['customlang:view'] = 'View local translation'; $string['export'] = 'Export custom strings'; $string['exportfilter'] = 'Select component(s) to export'; +$string['editlangpack'] = 'Edit language pack'; $string['filter'] = 'Filter strings'; $string['filtercomponent'] = 'Show strings of these components'; $string['filtercustomized'] = 'Customised only'; diff --git a/admin/tool/dataprivacy/classes/page_helper.php b/admin/tool/dataprivacy/classes/page_helper.php index d7ec6f72a6b46..e35686a799ea7 100644 --- a/admin/tool/dataprivacy/classes/page_helper.php +++ b/admin/tool/dataprivacy/classes/page_helper.php @@ -66,6 +66,8 @@ public static function setup(moodle_url $url, $title, $attachtoparentnode = '', $PAGE->set_pagelayout('admin'); $PAGE->set_title($title); $PAGE->set_heading($SITE->fullname); + $PAGE->set_secondary_active_tab('users'); + $PAGE->set_primary_active_tab('siteadminnode'); // If necessary, override the settings navigation to add this page into the breadcrumb navigation. if ($attachtoparentnode) { diff --git a/admin/tool/filetypes/delete.php b/admin/tool/filetypes/delete.php index 8b73f2bceab15..db8b55f3dc788 100644 --- a/admin/tool/filetypes/delete.php +++ b/admin/tool/filetypes/delete.php @@ -47,6 +47,8 @@ $PAGE->set_context($context); $PAGE->set_pagelayout('admin'); $PAGE->set_title($SITE->fullname. ': ' . $title); +$PAGE->set_primary_active_tab('siteadminnode'); +$PAGE->set_secondary_active_tab('server'); // Display the page. echo $OUTPUT->header(); diff --git a/admin/tool/filetypes/edit.php b/admin/tool/filetypes/edit.php index 33d934bee1df3..b23187eb6e4fb 100644 --- a/admin/tool/filetypes/edit.php +++ b/admin/tool/filetypes/edit.php @@ -100,6 +100,10 @@ // Page settings. $context = context_system::instance(); $PAGE->set_url(new \moodle_url('/admin/tool/filetypes/edit.php', array('oldextension' => $oldextension))); + +$PAGE->set_primary_active_tab('siteadminnode'); +$PAGE->set_secondary_active_tab('server'); + $PAGE->navbar->add($oldextension ? s($oldextension) : $title); $PAGE->set_context($context); $PAGE->set_pagelayout('admin'); diff --git a/admin/tool/langimport/index.php b/admin/tool/langimport/index.php index 55cee7418c9c0..407e5882ff611 100644 --- a/admin/tool/langimport/index.php +++ b/admin/tool/langimport/index.php @@ -112,6 +112,8 @@ } get_string_manager()->reset_caches(); +$PAGE->set_primary_active_tab('siteadminnode'); + echo $OUTPUT->header(); echo $OUTPUT->heading(get_string('langimport', 'tool_langimport')); diff --git a/admin/tool/messageinbound/index.php b/admin/tool/messageinbound/index.php index 90c2a1289339b..52a48aad882a4 100644 --- a/admin/tool/messageinbound/index.php +++ b/admin/tool/messageinbound/index.php @@ -32,6 +32,10 @@ $pageurl = new moodle_url('/admin/tool/messageinbound/index.php'); +$PAGE->set_primary_active_tab('siteadminnode'); + +$PAGE->navbar->add(get_string('message_handlers', 'tool_messageinbound'), $PAGE->url); + if (empty($classname)) { $renderer = $PAGE->get_renderer('tool_messageinbound'); diff --git a/admin/tool/monitor/edit.php b/admin/tool/monitor/edit.php index 9ffa433380cc2..17099a6ff4e8b 100644 --- a/admin/tool/monitor/edit.php +++ b/admin/tool/monitor/edit.php @@ -33,6 +33,8 @@ $context = context_system::instance(); $coursename = format_string($SITE->fullname, true, array('context' => $context)); $PAGE->set_context($context); + $PAGE->set_primary_active_tab('siteadminnode'); + $PAGE->set_secondary_active_tab('reports'); } else { $course = get_course($courseid); require_login($course); @@ -65,6 +67,7 @@ // Mform setup. if (!empty($ruleid)) { + $PAGE->navbar->add(get_string('editrule', 'tool_monitor'), $PAGE->url); $rule = \tool_monitor\rule_manager::get_rule($ruleid)->get_mform_set_data(); $rule->minutes = $rule->timewindow / MINSECS; $subscriptioncount = \tool_monitor\subscription_manager::count_rule_subscriptions($ruleid); @@ -75,6 +78,7 @@ return $classname === $rule->eventname || !$classname::is_deprecated(); }, ARRAY_FILTER_USE_KEY); } else { + $PAGE->navbar->add(get_string('addrule', 'tool_monitor'), $PAGE->url); $rule = new stdClass(); $subscriptioncount = 0; diff --git a/admin/tool/monitor/managerules.php b/admin/tool/monitor/managerules.php index 755afb12f45df..ef09c72187a43 100644 --- a/admin/tool/monitor/managerules.php +++ b/admin/tool/monitor/managerules.php @@ -39,6 +39,7 @@ $context = context_system::instance(); $coursename = format_string($SITE->fullname, true, array('context' => $context)); $PAGE->set_context($context); + $PAGE->set_primary_active_tab('siteadminnode'); } else { $course = get_course($courseid); require_login($course); @@ -56,7 +57,6 @@ $PAGE->set_title($coursename); $PAGE->set_heading($coursename); - if (!empty($action) && $action == 'changestatus') { require_sesskey(); require_capability('tool/monitor:managetool', context_system::instance()); @@ -74,6 +74,9 @@ redirect(new moodle_url('/admin/tool/monitor/managerules.php', array('courseid' => $courseid))); } + if ($action === 'delete') { + $PAGE->navbar->add(get_string('deleterule', 'tool_monitor'), $PAGE->url); + } echo $OUTPUT->header(); $rule = \tool_monitor\rule_manager::get_rule($rule); switch ($action) { diff --git a/admin/tool/task/scheduledtasks.php b/admin/tool/task/scheduledtasks.php index 85a4055380e43..cc8b3105f3d8a 100644 --- a/admin/tool/task/scheduledtasks.php +++ b/admin/tool/task/scheduledtasks.php @@ -42,6 +42,8 @@ } } +$PAGE->navbar->add(get_string('scheduledtasks', 'tool_task'), $PAGE->url); + if ($action == 'edit') { $PAGE->navbar->add(get_string('edittaskschedule', 'tool_task', $task->get_name())); } @@ -51,6 +53,8 @@ $nexturl = new moodle_url($PAGE->url, ['lastchanged' => $taskname]); } +$PAGE->set_primary_active_tab('siteadminnode'); + $renderer = $PAGE->get_renderer('tool_task'); if ($mform && ($mform->is_cancelled() || !empty($CFG->preventscheduledtaskchanges) || $task->is_overridden())) { diff --git a/admin/tool/usertours/classes/manager.php b/admin/tool/usertours/classes/manager.php index 4ab4d1f7988fe..c4ecc9064e161 100644 --- a/admin/tool/usertours/classes/manager.php +++ b/admin/tool/usertours/classes/manager.php @@ -158,7 +158,9 @@ protected function setup_admin_externalpage(string $action): void { * @param string $action The action to perform. */ public function execute($action) { + global $PAGE; $this->setup_admin_externalpage($action); + $PAGE->set_primary_active_tab('siteadminnode'); // Add the main content. switch($action) { diff --git a/admin/user.php b/admin/user.php index 249894b8b3a06..cc2a6121b48d1 100644 --- a/admin/user.php +++ b/admin/user.php @@ -42,6 +42,9 @@ $returnurl = new moodle_url('/admin/user.php', array('sort' => $sort, 'dir' => $dir, 'perpage' => $perpage, 'page'=>$page)); + $PAGE->set_primary_active_tab('siteadminnode'); + $PAGE->navbar->add(get_string('userlist', 'admin'), $PAGE->url); + // The $user variable is also used outside of these if statements. $user = null; if ($confirmuser and confirm_sesskey()) { diff --git a/admin/user/user_bulk_confirm.php b/admin/user/user_bulk_confirm.php index 91dd0c41ae9c6..4efec34c8073d 100644 --- a/admin/user/user_bulk_confirm.php +++ b/admin/user/user_bulk_confirm.php @@ -17,6 +17,9 @@ redirect($return); } +$PAGE->set_primary_active_tab('siteadminnode'); +$PAGE->set_secondary_active_tab('users'); + echo $OUTPUT->header(); //TODO: add support for large number of users diff --git a/admin/user/user_bulk_delete.php b/admin/user/user_bulk_delete.php index 2f836eb455e74..859c92f49ddb9 100644 --- a/admin/user/user_bulk_delete.php +++ b/admin/user/user_bulk_delete.php @@ -17,6 +17,9 @@ redirect($return); } +$PAGE->set_primary_active_tab('siteadminnode'); +$PAGE->set_secondary_active_tab('users'); + echo $OUTPUT->header(); //TODO: add support for large number of users diff --git a/admin/user/user_bulk_display.php b/admin/user/user_bulk_display.php index 70c1eecdbcbc4..2e3b6c38f8de5 100644 --- a/admin/user/user_bulk_display.php +++ b/admin/user/user_bulk_display.php @@ -20,6 +20,9 @@ $strnever = get_string('never'); +$PAGE->set_primary_active_tab('siteadminnode'); +$PAGE->set_secondary_active_tab('users'); + echo $OUTPUT->header(); $countries = get_string_manager()->get_list_of_countries(true); diff --git a/admin/user/user_bulk_download.php b/admin/user/user_bulk_download.php index a6e69d08a5df3..3220518624ffa 100644 --- a/admin/user/user_bulk_download.php +++ b/admin/user/user_bulk_download.php @@ -88,6 +88,9 @@ exit; } +$PAGE->set_primary_active_tab('siteadminnode'); +$PAGE->set_secondary_active_tab('users'); + echo $OUTPUT->header(); echo $OUTPUT->heading(get_string('download', 'admin')); echo $OUTPUT->download_dataformat_selector(get_string('userbulkdownload', 'admin'), 'user_bulk_download.php'); diff --git a/admin/user/user_bulk_forcepasswordchange.php b/admin/user/user_bulk_forcepasswordchange.php index a8e522a723da9..09e9361d48266 100644 --- a/admin/user/user_bulk_forcepasswordchange.php +++ b/admin/user/user_bulk_forcepasswordchange.php @@ -18,6 +18,9 @@ redirect($return); } +$PAGE->set_primary_active_tab('siteadminnode'); +$PAGE->set_secondary_active_tab('users'); + echo $OUTPUT->header(); if ($confirm and confirm_sesskey()) { diff --git a/admin/user/user_bulk_message.php b/admin/user/user_bulk_message.php index 07592178b648c..3ef1e5f7242ba 100644 --- a/admin/user/user_bulk_message.php +++ b/admin/user/user_bulk_message.php @@ -20,6 +20,9 @@ print_error('messagingdisable', 'error'); } +$PAGE->set_primary_active_tab('siteadminnode'); +$PAGE->set_secondary_active_tab('users'); + //TODO: add support for large number of users if ($confirm and !empty($msg) and confirm_sesskey()) { diff --git a/admin/webservice/service.php b/admin/webservice/service.php index d99bf58fbc2cc..6cbd00d2c7fdf 100644 --- a/admin/webservice/service.php +++ b/admin/webservice/service.php @@ -36,7 +36,11 @@ $node->display = false; $newnode->make_active(); } -$PAGE->navbar->add(get_string('externalservice', 'webservice')); +$PAGE->navbar->add(get_string('externalservices', 'webservice'), + new moodle_url('/admin/settings.php', ['section' => 'externalservices'])); + +$PAGE->set_primary_active_tab('siteadminnode'); + //Retrieve few general parameters $id = required_param('id', PARAM_INT); @@ -104,6 +108,12 @@ redirect($returnurl); } +if ($id == 0) { + $PAGE->navbar->add(get_string('addexternalservice', 'webservice'), $PAGE->url); +} else { + $PAGE->navbar->add(get_string('editexternalservice', 'webservice'), $PAGE->url); +} + //OUTPUT edit/create form echo $OUTPUT->header(); $mform->display(); diff --git a/admin/webservice/service_functions.php b/admin/webservice/service_functions.php index 3df598487d8ef..e7848787e9044 100644 --- a/admin/webservice/service_functions.php +++ b/admin/webservice/service_functions.php @@ -41,6 +41,9 @@ if ($node) { $node->make_active(); } +$PAGE->set_primary_active_tab('siteadminnode'); +$PAGE->navbar->add(get_string('externalservices', 'webservice'), + new moodle_url('/admin/settings.php', ['section' => 'externalservices'])); $PAGE->navbar->add(get_string('functions', 'webservice'), new moodle_url('/' . $CFG->admin . '/webservice/service_functions.php', array('id' => $serviceid))); diff --git a/admin/webservice/tokens.php b/admin/webservice/tokens.php index 7e2599e2c60c2..e21ef3a3265fd 100644 --- a/admin/webservice/tokens.php +++ b/admin/webservice/tokens.php @@ -37,7 +37,12 @@ admin_externalpage_setup('webservicetokens'); +$PAGE->set_primary_active_tab('siteadminnode'); +$PAGE->navbar->add(get_string('managetokens', 'webservice'), + new moodle_url('/admin/webservice/tokens.php')); + if ($action === 'create') { + $PAGE->navbar->add(get_string('createtoken', 'webservice'), $PAGE->url); $webservicemanager = new webservice(); $mform = new \core_webservice\token_form(null, ['action' => 'create']); $data = $mform->get_data(); @@ -81,6 +86,7 @@ } if ($action === 'delete') { + $PAGE->navbar->add(get_string('deletetoken', 'webservice'), $PAGE->url); $webservicemanager = new webservice(); $token = $webservicemanager->get_token_by_id_with_details($tokenid); diff --git a/backup/backupfilesedit.php b/backup/backupfilesedit.php index 382bfdbb7014e..c2733f042e4d7 100644 --- a/backup/backupfilesedit.php +++ b/backup/backupfilesedit.php @@ -51,18 +51,20 @@ if ($context->contextlevel == CONTEXT_COURSECAT) { core_course_category::page_setup(); - // Set the restore course node active in the settings navigation block. - if ($restorecoursenode = $PAGE->settingsnav->find('restorecourse', navigation_node::TYPE_SETTING)) { - $restorecoursenode->make_active(); - } - $PAGE->set_secondary_active_tab('restorecourse'); } else if ($context->contextlevel == CONTEXT_COURSE) { $course = get_course($context->instanceid); $PAGE->set_heading($course->fullname); + $PAGE->set_secondary_active_tab('coursereuse'); +} else if ($context->contextlevel == CONTEXT_SYSTEM) { + $PAGE->set_heading($SITE->fullname); + $PAGE->set_primary_active_tab('siteadminnode'); + $PAGE->set_secondary_active_tab('courses'); } else { $PAGE->set_heading($SITE->fullname); } +// Set the restore course node active in the settings navigation block. +navigation_node::override_active_url(new moodle_url('/backup/restorefile.php', ['contextid' => $contextid])); $title = get_string('managefiles', 'backup'); $PAGE->navbar->add($title); diff --git a/cache/admin.php b/cache/admin.php index 1c20b2677118a..d3882587d16a7 100644 --- a/cache/admin.php +++ b/cache/admin.php @@ -48,6 +48,9 @@ // Empty array to hold any form information returned from actions. $forminfo = []; +$PAGE->set_primary_active_tab('siteadminnode'); +$PAGE->navbar->add(get_string('cacheconfig', 'cache'), new moodle_url('/cache/admin.php')); + // Handle page actions in admin helper class. if (!empty($action) && confirm_sesskey()) { $forminfo = $adminhelper->perform_cache_actions($action, $forminfo); @@ -65,6 +68,7 @@ $PAGE->set_title($title); $PAGE->set_heading($SITE->fullname); + /** @var \core_cache\output\renderer $renderer */ $renderer = $PAGE->get_renderer('core_cache'); diff --git a/cache/classes/local/administration_display_helper.php b/cache/classes/local/administration_display_helper.php index 4ddad4c135796..949a3c1b2ebb7 100644 --- a/cache/classes/local/administration_display_helper.php +++ b/cache/classes/local/administration_display_helper.php @@ -463,6 +463,7 @@ public function action_addstore() : array { redirect($PAGE->url, get_string('addstoresuccess', 'cache', $storepluginsummaries[$plugin]['name']), 5); } + $PAGE->navbar->add(get_string('addstore', 'cache', 'cache'), $PAGE->url); return array('form' => $mform, 'title' => $title); } @@ -573,6 +574,7 @@ public function action_editdefinitionmapping(): array { redirect($PAGE->url); } + $PAGE->navbar->add(get_string('updatedefinitionmapping', 'cache'), $PAGE->url); return array('form' => $mform, 'title' => $title); } @@ -611,6 +613,7 @@ public function action_editdefinitionsharing(): array { redirect($PAGE->url); } + $PAGE->navbar->add(get_string('updatedefinitionsharing', 'cache'), $PAGE->url); return array('form' => $mform, 'title' => $title); } diff --git a/cohort/index.php b/cohort/index.php index 0d84ddb66cbf9..a3ce8f6e00a08 100644 --- a/cohort/index.php +++ b/cohort/index.php @@ -71,6 +71,12 @@ $showall = false; } else { admin_externalpage_setup('cohorts', '', null, '', array('pagelayout'=>'report')); + $PAGE->set_primary_active_tab('siteadminnode'); + if ($showall == 1) { + $PAGE->navbar->add(get_string('allcohorts', 'cohort'), $PAGE->url); + } else if (!$showall) { + $PAGE->navbar->add(get_string('systemcohorts', 'cohort'), $PAGE->url); + } } echo $OUTPUT->header(); diff --git a/course/editcategory.php b/course/editcategory.php index 82bec8bef3b68..f46448bd469a0 100644 --- a/course/editcategory.php +++ b/course/editcategory.php @@ -73,6 +73,7 @@ $context = context_system::instance(); $fullname = $SITE->fullname; $title = "$SITE->shortname: $strtitle"; + $PAGE->set_secondary_active_tab('courses'); } $category = new stdClass(); diff --git a/grade/edit/letter/index.php b/grade/edit/letter/index.php index 2e815e2292058..24f9769c16f3c 100644 --- a/grade/edit/letter/index.php +++ b/grade/edit/letter/index.php @@ -58,6 +58,7 @@ $admin = true; $returnurl = "$CFG->wwwroot/grade/edit/letter/index.php"; $editparam = '?edit=1'; + $PAGE->set_primary_active_tab('siteadminnode'); } else if ($context->contextlevel == CONTEXT_COURSE) { $PAGE->set_pagelayout('standard');//calling this here to make blocks display diff --git a/grade/edit/outcome/edit.php b/grade/edit/outcome/edit.php index 5c42e7a726ec3..a5b58f528c8d1 100644 --- a/grade/edit/outcome/edit.php +++ b/grade/edit/outcome/edit.php @@ -97,6 +97,8 @@ if (!$courseid) { require_once $CFG->libdir.'/adminlib.php'; admin_externalpage_setup('outcomes'); + + $PAGE->set_primary_active_tab('siteadminnode'); } else { navigation_node::override_active_url(new moodle_url('/grade/edit/outcome/course.php', ['id' => $courseid])); $PAGE->navbar->add(get_string('manageoutcomes', 'grades'), diff --git a/grade/edit/outcome/index.php b/grade/edit/outcome/index.php index 85dd369870c9c..84312e6037b17 100644 --- a/grade/edit/outcome/index.php +++ b/grade/edit/outcome/index.php @@ -53,6 +53,7 @@ require_once $CFG->libdir.'/adminlib.php'; admin_externalpage_setup('outcomes'); $context = context_system::instance(); + $PAGE->set_primary_active_tab('siteadminnode'); } /// return tracking object diff --git a/grade/edit/scale/edit.php b/grade/edit/scale/edit.php index d164a906b5bc3..a8f3c172c9ce8 100644 --- a/grade/edit/scale/edit.php +++ b/grade/edit/scale/edit.php @@ -88,6 +88,7 @@ if (!$courseid) { require_once $CFG->libdir.'/adminlib.php'; admin_externalpage_setup('scales'); + $PAGE->set_primary_active_tab('siteadminnode'); } // default return url diff --git a/grade/edit/scale/index.php b/grade/edit/scale/index.php index adcf0f9ab1573..7fcf1d778fb79 100644 --- a/grade/edit/scale/index.php +++ b/grade/edit/scale/index.php @@ -44,6 +44,7 @@ require_once $CFG->libdir.'/adminlib.php'; admin_externalpage_setup('scales'); $context = context_system::instance(); + $PAGE->set_primary_active_tab('siteadminnode'); } /// return tracking object diff --git a/lang/en/cache.php b/lang/en/cache.php index 45bfda216b981..327aba68f3e3d 100644 --- a/lang/en/cache.php +++ b/lang/en/cache.php @@ -124,6 +124,7 @@ $string['editsharing'] = 'Edit sharing'; $string['editstore'] = 'Edit store'; $string['editstoresuccess'] = 'Succesfully edited the cache store.'; +$string['editdefinitionmapping'] = 'Edit definition mapping'; $string['editdefinitionmappings'] = '{$a} definition store mappings'; $string['editdefinitionsharing'] = 'Edit definition sharing for {$a}'; $string['ex_configcannotsave'] = 'Unable to save the cache config to file.'; @@ -207,6 +208,8 @@ $string['supports_searchable'] = 'searching by key'; $string['tested'] = 'Tested'; $string['testperformance'] = 'Test performance'; +$string['updatedefinitionmapping'] = 'Edit definition mapping'; +$string['updatedefinitionsharing'] = 'Edit definition sharing'; $string['unsupportedmode'] = 'Unsupported mode'; $string['untestable'] = 'Untestable'; $string['usage_items'] = 'Items'; diff --git a/lang/en/payment.php b/lang/en/payment.php index f084db5b2d45b..e1cad85051294 100644 --- a/lang/en/payment.php +++ b/lang/en/payment.php @@ -33,6 +33,7 @@ $string['paymentaccountsexplained'] = 'Create one or multiple payment accounts for this site. Each account includes configuration for available payment gateways. The person who configures payments on the site (for example, payment for the course enrolment) will be able to choose from the available accounts.'; $string['createaccount'] = 'Create payment account'; $string['deleteorarchive'] = 'Delete or archive'; +$string['editpaymentaccount'] = 'Edit payment account'; $string['eventaccountcreated'] = 'Payment account created'; $string['eventaccountdeleted'] = 'Payment account deleted'; $string['eventaccountupdated'] = 'Payment account updated'; diff --git a/lang/en/webservice.php b/lang/en/webservice.php index c5721de58230b..e818856537ead 100644 --- a/lang/en/webservice.php +++ b/lang/en/webservice.php @@ -27,6 +27,7 @@ $string['addaservice'] = 'Add service'; $string['addcapabilitytousers'] = 'Check users capability'; $string['addcapabilitytousersdescription'] = 'Users should have two capabilities - webservice:createtoken and a capability matching the protocols used, for example webservice/rest:use, webservice/soap:use. To achieve this, create a web services role with the appropriate capabilities allowed and assign it to the web services user as a system role.'; +$string['addexternalservice'] = 'Add external service'; $string['addfunction'] = 'Add function'; $string['addfunctionhelp'] = 'Select the function to add to the service.'; $string['addfunctions'] = 'Add functions'; @@ -56,6 +57,7 @@ $string['deleteaservice'] = 'Delete service'; $string['deleteservice'] = 'Delete the service: {$a->name} (id: {$a->id})'; $string['deleteserviceconfirm'] = 'Deleting a service will also delete the tokens related to this service. Do you really want to delete external service "{$a}"?'; +$string['deletetoken'] = 'Delete token'; $string['deletetokenconfirm'] = 'Do you really want to delete this web service token for {$a->user} on the service {$a->service}?'; $string['disabledwarning'] = 'All web service protocols are disabled. The "Enable web services" setting can be found in Advanced features.'; $string['doc'] = 'Documentation'; @@ -63,6 +65,7 @@ $string['downloadfiles'] = 'Can download files'; $string['downloadfiles_help'] = 'If enabled, any user can download files with their security keys. Of course they are restricted to the files they are allowed to download in the site.'; $string['editaservice'] = 'Edit service'; +$string['editexternalservice'] = 'Edit external service'; $string['editservice'] = 'Edit the service: {$a->name} (id: {$a->id})'; $string['enabled'] = 'Enabled'; $string['enabledocumentation'] = 'Enable developer documentation'; diff --git a/mod/lti/registersettings.php b/mod/lti/registersettings.php index 797f2ada2485b..4ed9dafea0ad2 100644 --- a/mod/lti/registersettings.php +++ b/mod/lti/registersettings.php @@ -73,6 +73,9 @@ $data['isupdate'] = true; } +$PAGE->set_primary_active_tab('siteadminnode'); +$PAGE->set_secondary_active_tab('modules'); + $form = new mod_lti_register_types_form($pageurl, (object)$data); if ($form->is_cancelled()) { diff --git a/mod/lti/typessettings.php b/mod/lti/typessettings.php index d5f9524a0af99..1ac8b72f3a797 100644 --- a/mod/lti/typessettings.php +++ b/mod/lti/typessettings.php @@ -144,7 +144,10 @@ } $PAGE->set_title("$SITE->shortname: " . get_string('toolsetup', 'lti')); -$PAGE->navbar->add(get_string('lti_administration', 'lti'), $CFG->wwwroot.'/'.$CFG->admin.'/settings.php?section=modsettinglti'); +$PAGE->set_primary_active_tab('siteadminnode'); +$PAGE->set_secondary_active_tab('ltitoolconfigure'); +$PAGE->navbar->add(get_string('manage_external_tools', 'lti'), new moodle_url('/mod/lti/toolconfigure.php')); +$PAGE->navbar->add(get_string('toolsetup', 'lti'), $PAGE->url); echo $OUTPUT->header(); echo $OUTPUT->heading(get_string('toolsetup', 'lti')); diff --git a/my/indexsys.php b/my/indexsys.php index d801ab5bd80b2..f8b07c0c8b997 100644 --- a/my/indexsys.php +++ b/my/indexsys.php @@ -44,7 +44,9 @@ $pagetitle = get_string('mypage', 'admin'); +$PAGE->set_secondary_active_tab('appearance'); $PAGE->set_blocks_editing_capability('moodle/my:configsyspages'); +$PAGE->set_url(new moodle_url('/my/indexsys.php')); admin_externalpage_setup('mypage', '', null, '', array('pagelayout' => 'mydashboard')); $PAGE->add_body_class('limitedwidth'); $PAGE->set_pagetype('my-index'); diff --git a/payment/accounts.php b/payment/accounts.php index d7fa2ec470c01..a612cf84a4264 100644 --- a/payment/accounts.php +++ b/payment/accounts.php @@ -30,6 +30,8 @@ admin_externalpage_setup('paymentaccounts'); $PAGE->set_heading(get_string('paymentaccounts', 'payment')); +$PAGE->set_primary_active_tab('siteadminnode'); + $enabledplugins = \core\plugininfo\paygw::get_enabled_plugins(); echo $OUTPUT->header(); diff --git a/payment/manage_account.php b/payment/manage_account.php index d5d2e263f1233..456fa4d873d01 100644 --- a/payment/manage_account.php +++ b/payment/manage_account.php @@ -46,6 +46,14 @@ redirect(new moodle_url('/payment/accounts.php')); } +$PAGE->set_secondary_active_tab('siteadminnode'); +$PAGE->set_primary_active_tab('siteadminnode'); +if ($id == 0) { + $PAGE->navbar->add(get_string('createaccount', 'payment'), $PAGE->url); +} else { + $PAGE->navbar->add(get_string('editpaymentaccount', 'payment'), $PAGE->url); +} + $PAGE->set_heading($id ? format_string($account->get('name')) : get_string('createaccount', 'payment')); $form = new \core_payment\form\account($pageurl->out(false), ['persistent' => $account]); diff --git a/payment/manage_gateway.php b/payment/manage_gateway.php index 2a6c21d162be9..f389b8443f496 100644 --- a/payment/manage_gateway.php +++ b/payment/manage_gateway.php @@ -47,6 +47,10 @@ } require_capability('moodle/payment:manageaccounts', $account->get_context()); +$PAGE->set_secondary_active_tab('siteadminnode'); +$PAGE->set_primary_active_tab('siteadminnode'); +$PAGE->navbar->add(get_string('createaccount', 'payment'), $PAGE->url); + $PAGE->set_heading($id ? format_string($account->get('name')) : get_string('createaccount', 'payment')); $form = new \core_payment\form\account_gateway($pageurl->out(false), ['persistent' => $gateway]); diff --git a/report/eventlist/eventdetail.php b/report/eventlist/eventdetail.php index ad16c74b540d1..ac72b1c66cb3c 100644 --- a/report/eventlist/eventdetail.php +++ b/report/eventlist/eventdetail.php @@ -134,6 +134,9 @@ $observers = array_merge($observers, $allobserverslist[$eventname]); } +$PAGE->set_primary_active_tab('siteadminnode'); +$PAGE->set_secondary_active_tab('reports'); + // OUTPUT. $renderer = $PAGE->get_renderer('report_eventlist'); echo $renderer->render_event_detail($observers, $eventinformation); diff --git a/report/log/index.php b/report/log/index.php index 2496fa30e4127..8db48419616a1 100644 --- a/report/log/index.php +++ b/report/log/index.php @@ -144,6 +144,7 @@ if ($course->id == $SITE->id) { admin_externalpage_setup('reportlog', '', null, '', array('pagelayout' => 'report')); $PAGE->set_title($SITE->shortname .': '. $strlogs); + $PAGE->set_primary_active_tab('siteadminnode'); } else { $PAGE->set_title($course->shortname .': '. $strlogs); $PAGE->set_heading($course->fullname); diff --git a/report/questioninstances/index.php b/report/questioninstances/index.php index 726ba0b0ae92f..b37402c19cf02 100644 --- a/report/questioninstances/index.php +++ b/report/questioninstances/index.php @@ -32,6 +32,7 @@ // Print the header & check permissions. admin_externalpage_setup('reportquestioninstances', '', null, '', array('pagelayout'=>'report')); +$PAGE->set_primary_active_tab('siteadminnode'); echo $OUTPUT->header(); // Log. diff --git a/tag/manage.php b/tag/manage.php index fac5f572e6b95..c8dfe39f705f3 100644 --- a/tag/manage.php +++ b/tag/manage.php @@ -76,6 +76,8 @@ $PAGE->set_blocks_editing_capability('moodle/tag:editblocks'); +$PAGE->set_primary_active_tab('siteadminnode'); + switch($action) { case 'colladd': diff --git a/theme/boost/classes/boostnavbar.php b/theme/boost/classes/boostnavbar.php index f3152ab11b4b2..e6c40e0d18c2e 100644 --- a/theme/boost/classes/boostnavbar.php +++ b/theme/boost/classes/boostnavbar.php @@ -110,9 +110,7 @@ protected function prepare_nodes_for_boost(): void { $courseformat->coursedisplay != COURSE_DISPLAY_MULTIPAGE; } - if (!is_null($this->get_item('root'))) { // We are in site administration. - // Remove the 'Site administration' navbar node as it already exists in the primary navigation menu. - $this->remove('root'); + if ($this->page->context->contextlevel == CONTEXT_SYSTEM) { // Remove the navbar nodes that already exist in the secondary navigation menu. $this->remove_items_that_exist_in_navigation($PAGE->secondarynav); } diff --git a/theme/index.php b/theme/index.php index 0c8b879e52345..93bf2d3ed6f20 100644 --- a/theme/index.php +++ b/theme/index.php @@ -43,6 +43,9 @@ unset($SESSION->theme); +$PAGE->set_primary_active_tab('siteadminnode'); +$PAGE->navbar->add(get_string('themeselector', 'admin'), $PAGE->url); + if ($reset and confirm_sesskey()) { theme_reset_all_caches(); } else if ($choose && $confirmation) { diff --git a/user/editadvanced.php b/user/editadvanced.php index 97deb4142f371..6ae2169abf1c4 100644 --- a/user/editadvanced.php +++ b/user/editadvanced.php @@ -73,6 +73,8 @@ $user->timezone = '99'; require_capability('moodle/user:create', $systemcontext); admin_externalpage_setup('addnewuser', '', array('id' => -1)); + $PAGE->set_primary_active_tab('siteadminnode'); + $PAGE->navbar->add(get_string('addnewuser', 'moodle'), $PAGE->url); } else { // Editing existing user. require_capability('moodle/user:update', $systemcontext); diff --git a/user/profilesys.php b/user/profilesys.php index 8ff17d1f3aba9..61e4512226988 100644 --- a/user/profilesys.php +++ b/user/profilesys.php @@ -34,7 +34,7 @@ $resetall = optional_param('resetall', null, PARAM_BOOL); -$header = "$SITE->shortname: ".get_string('publicprofile')." (".get_string('myprofile', 'admin').")"; +$header = "$SITE->fullname: ".get_string('publicprofile')." (".get_string('myprofile', 'admin').")"; $PAGE->set_blocks_editing_capability('moodle/my:configsyspages'); admin_externalpage_setup('profilepage', '', null, '', array('pagelayout' => 'mypublic'));