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 c8c9015d188..3e91f680325 100644 --- a/admin/index.php +++ b/admin/index.php @@ -825,6 +825,7 @@ $insecuredataroot = is_dataroot_insecure(true); $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 e4867c1acb8..f4d3d0c5cd9 100644 --- a/admin/plugins.php +++ b/admin/plugins.php @@ -52,6 +52,8 @@ $pageurl = new moodle_url('/admin/plugins.php', $pageparams); $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 643e6cee561..824cfa81cca 100644 --- a/admin/roles/allow.php +++ b/admin/roles/allow.php @@ -49,6 +49,9 @@ if (optional_param('submit', false, PARAM_BOOL) && data_submitted() && confirm_s 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 fdf144de6ca..ede0a721047 100644 --- a/admin/roles/define.php +++ b/admin/roles/define.php @@ -87,6 +87,10 @@ if ($action === 'add') { $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 5a1530f6068..ad35a1cf936 100644 --- a/admin/roles/manage.php +++ b/admin/roles/manage.php @@ -60,6 +60,9 @@ $undeletableroles[$CFG->notloggedinroleid] = 1; $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 fb5b0a30918..d524f9b5e42 100644 --- a/admin/searchareas.php +++ b/admin/searchareas.php @@ -37,6 +37,8 @@ try { // 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 9fa7a3ccae6..b149e75f3a0 100644 --- a/admin/searchreindex.php +++ b/admin/searchreindex.php @@ -39,6 +39,9 @@ if ($area === false) { } $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 a3d48fc48c9..30071432b01 100644 --- a/admin/settings.php +++ b/admin/settings.php @@ -118,6 +118,11 @@ if (empty($SITE->fullname)) { $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 2cba888a6e0..fc1e6ffab32 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 @@ class base { $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 ddce329ae07..49d71cd675a 100644 --- a/admin/tool/admin_presets/index.php +++ b/admin/tool/admin_presets/index.php @@ -52,6 +52,7 @@ $url->param('mode', $mode); $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 7d286253f41..42025621144 100644 --- a/admin/tool/analytics/classes/output/helper.php +++ b/admin/tool/analytics/classes/output/helper.php @@ -76,10 +76,14 @@ class helper { $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 aabc31eb133..bfdfd9461a2 100644 --- a/admin/tool/customlang/edit.php +++ b/admin/tool/customlang/edit.php @@ -38,6 +38,11 @@ admin_externalpage_setup('toolcustomlang', '', null, 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 628a9f88655..2cf5ed9278b 100644 --- a/admin/tool/customlang/import.php +++ b/admin/tool/customlang/import.php @@ -38,6 +38,12 @@ $lng = required_param('lng', PARAM_LANG); 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 e57aa4428cb..09fc31aebd3 100644 --- a/admin/tool/customlang/index.php +++ b/admin/tool/customlang/index.php @@ -40,6 +40,8 @@ $next = optional_param('next', 'edit', PARAM_ALPHA); 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 882f9208764..9343e68e82e 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:export'] = 'Export local translation'; $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 d7ec6f72a6b..e35686a799e 100644 --- a/admin/tool/dataprivacy/classes/page_helper.php +++ b/admin/tool/dataprivacy/classes/page_helper.php @@ -66,6 +66,8 @@ class page_helper { $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 8b73f2bceab..db8b55f3dc7 100644 --- a/admin/tool/filetypes/delete.php +++ b/admin/tool/filetypes/delete.php @@ -47,6 +47,8 @@ $PAGE->navbar->add($title); $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 33d934bee1d..b23187eb6e4 100644 --- a/admin/tool/filetypes/edit.php +++ b/admin/tool/filetypes/edit.php @@ -100,6 +100,10 @@ if ($mform->is_cancelled()) { // 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 55cee7418c9..407e5882ff6 100644 --- a/admin/tool/langimport/index.php +++ b/admin/tool/langimport/index.php @@ -112,6 +112,8 @@ if ($mode == UPDATE_ALL_LANG) { } 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 90c2a128933..52a48aad882 100644 --- a/admin/tool/messageinbound/index.php +++ b/admin/tool/messageinbound/index.php @@ -32,6 +32,10 @@ $classname = optional_param('classname', '', PARAM_RAW); $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 9ffa433380c..17099a6ff4e 100644 --- a/admin/tool/monitor/edit.php +++ b/admin/tool/monitor/edit.php @@ -33,6 +33,8 @@ if (empty($courseid)) { $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 @@ if (empty($courseid)) { // 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 @@ if (!empty($ruleid)) { 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 755afb12f45..ef09c72187a 100644 --- a/admin/tool/monitor/managerules.php +++ b/admin/tool/monitor/managerules.php @@ -39,6 +39,7 @@ if (empty($courseid)) { $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_pagelayout('report'); $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 @@ if (!empty($action) && $ruleid) { 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 85a4055380e..cc8b3105f3d 100644 --- a/admin/tool/task/scheduledtasks.php +++ b/admin/tool/task/scheduledtasks.php @@ -42,6 +42,8 @@ if ($taskname) { } } +$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 @@ if ($task) { $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 4ab4d1f7988..c4ecc9064e1 100644 --- a/admin/tool/usertours/classes/manager.php +++ b/admin/tool/usertours/classes/manager.php @@ -158,7 +158,9 @@ class manager { * @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 249894b8b3a..cc2a6121b48 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 91dd0c41ae9..4efec34c807 100644 --- a/admin/user/user_bulk_confirm.php +++ b/admin/user/user_bulk_confirm.php @@ -17,6 +17,9 @@ if (empty($SESSION->bulk_users)) { 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 2f836eb455e..859c92f49dd 100644 --- a/admin/user/user_bulk_delete.php +++ b/admin/user/user_bulk_delete.php @@ -17,6 +17,9 @@ if (empty($SESSION->bulk_users)) { 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 70c1eecdbcb..2e3b6c38f8d 100644 --- a/admin/user/user_bulk_display.php +++ b/admin/user/user_bulk_display.php @@ -20,6 +20,9 @@ $usercount = count($users); $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 a6e69d08a5d..3220518624f 100644 --- a/admin/user/user_bulk_download.php +++ b/admin/user/user_bulk_download.php @@ -88,6 +88,9 @@ if ($dataformat) { 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 a8e522a723d..09e9361d482 100644 --- a/admin/user/user_bulk_forcepasswordchange.php +++ b/admin/user/user_bulk_forcepasswordchange.php @@ -18,6 +18,9 @@ if (empty($SESSION->bulk_users)) { 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 07592178b64..3ef1e5f7242 100644 --- a/admin/user/user_bulk_message.php +++ b/admin/user/user_bulk_message.php @@ -20,6 +20,9 @@ if (empty($CFG->messaging)) { 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 d99bf58fbc2..6cbd00d2c7f 100644 --- a/admin/webservice/service.php +++ b/admin/webservice/service.php @@ -36,7 +36,11 @@ if ($node && $newnode) { $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 @@ if ($mform->is_cancelled()) { 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 3df598487d8..e7848787e90 100644 --- a/admin/webservice/service_functions.php +++ b/admin/webservice/service_functions.php @@ -41,6 +41,9 @@ $node = $PAGE->settingsnav->find('externalservices', navigation_node::TYPE_SETTI 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 7e2599e2c60..e21ef3a3265 100644 --- a/admin/webservice/tokens.php +++ b/admin/webservice/tokens.php @@ -37,7 +37,12 @@ $fservices = optional_param_array('fservices', [], PARAM_INT); 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 === 'create') { } 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 382bfdbb701..c2733f042e4 100644 --- a/backup/backupfilesedit.php +++ b/backup/backupfilesedit.php @@ -51,18 +51,20 @@ $PAGE->set_context($context); 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 1c20b267711..d3882587d16 100644 --- a/cache/admin.php +++ b/cache/admin.php @@ -48,6 +48,9 @@ $notifications = array(); // 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 @@ $title = array_key_exists('title', $forminfo) ? $forminfo['title'] : new lang_st $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 4ddad4c1357..949a3c1b2eb 100644 --- a/cache/classes/local/administration_display_helper.php +++ b/cache/classes/local/administration_display_helper.php @@ -463,6 +463,7 @@ class administration_display_helper extends \core_cache\administration_helper { 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 @@ class administration_display_helper extends \core_cache\administration_helper { redirect($PAGE->url); } + $PAGE->navbar->add(get_string('updatedefinitionmapping', 'cache'), $PAGE->url); return array('form' => $mform, 'title' => $title); } @@ -611,6 +613,7 @@ class administration_display_helper extends \core_cache\administration_helper { 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 0d84ddb66cb..a3ce8f6e00a 100644 --- a/cohort/index.php +++ b/cohort/index.php @@ -71,6 +71,12 @@ if ($category) { $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 82bec8bef3b..f46448bd469 100644 --- a/course/editcategory.php +++ b/course/editcategory.php @@ -73,6 +73,7 @@ if ($id) { $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 2e815e22920..24f9769c16f 100644 --- a/grade/edit/letter/index.php +++ b/grade/edit/letter/index.php @@ -58,6 +58,7 @@ if ($context->contextlevel == CONTEXT_SYSTEM or $context->contextlevel == CONTEX $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 5c42e7a726e..a5b58f528c8 100644 --- a/grade/edit/outcome/edit.php +++ b/grade/edit/outcome/edit.php @@ -97,6 +97,8 @@ if ($id) { 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 85dd369870c..84312e6037b 100644 --- a/grade/edit/outcome/index.php +++ b/grade/edit/outcome/index.php @@ -53,6 +53,7 @@ if ($courseid) { 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 d164a906b5b..a8f3c172c9c 100644 --- a/grade/edit/scale/edit.php +++ b/grade/edit/scale/edit.php @@ -88,6 +88,7 @@ if ($id) { 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 adcf0f9ab15..7fcf1d778fb 100644 --- a/grade/edit/scale/index.php +++ b/grade/edit/scale/index.php @@ -44,6 +44,7 @@ if ($courseid) { 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 45bfda216b9..327aba68f3e 100644 --- a/lang/en/cache.php +++ b/lang/en/cache.php @@ -124,6 +124,7 @@ $string['editmappings'] = 'Edit mappings'; $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_keyawareness'] = 'key awareness'; $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 f084db5b2d4..e1cad850512 100644 --- a/lang/en/payment.php +++ b/lang/en/payment.php @@ -33,6 +33,7 @@ $string['accountnotavailable'] = 'Not available'; $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 c5721de5823..e818856537e 100644 --- a/lang/en/webservice.php +++ b/lang/en/webservice.php @@ -27,6 +27,7 @@ $string['actwebserviceshhdr'] = 'Active web service protocols'; $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['default'] = 'Default to "{$a}"'; $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['docaccessrefused'] = 'You are not allowed to see the documentation for $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 797f2ada248..4ed9dafea0a 100644 --- a/mod/lti/registersettings.php +++ b/mod/lti/registersettings.php @@ -73,6 +73,9 @@ if ($isupdate) { $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 d5f9524a0af..1ac8b72f3a7 100644 --- a/mod/lti/typessettings.php +++ b/mod/lti/typessettings.php @@ -144,7 +144,10 @@ if ($data = $form->get_data()) { } $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 d801ab5bd80..f8b07c0c8b9 100644 --- a/my/indexsys.php +++ b/my/indexsys.php @@ -44,7 +44,9 @@ $resetall = optional_param('resetall', false, PARAM_BOOL); $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 d7fa2ec470c..a612cf84a42 100644 --- a/payment/accounts.php +++ b/payment/accounts.php @@ -30,6 +30,8 @@ $showarchived = optional_param('showarchived', false, PARAM_BOOL); 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 d5d2e263f12..456fa4d873d 100644 --- a/payment/manage_account.php +++ b/payment/manage_account.php @@ -46,6 +46,14 @@ if ($restore && $account->get('archived') && confirm_sesskey()) { 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 2a6c21d162b..f389b8443f4 100644 --- a/payment/manage_gateway.php +++ b/payment/manage_gateway.php @@ -47,6 +47,10 @@ if (empty($account) || empty($gateway)) { } 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 ad16c74b540..ac72b1c66cb 100644 --- a/report/eventlist/eventdetail.php +++ b/report/eventlist/eventdetail.php @@ -134,6 +134,9 @@ if (isset($allobserverslist[$eventname])) { $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 2496fa30e41..8db48419616 100644 --- a/report/log/index.php +++ b/report/log/index.php @@ -144,6 +144,7 @@ if ($PAGE->user_allowed_editing() && $adminediting != -1) { 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 726ba0b0ae9..b37402c19cf 100644 --- a/report/questioninstances/index.php +++ b/report/questioninstances/index.php @@ -32,6 +32,7 @@ $requestedqtype = optional_param('qtype', '', PARAM_SAFEDIR); // 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 fac5f572e6b..c8dfe39f705 100644 --- a/tag/manage.php +++ b/tag/manage.php @@ -76,6 +76,8 @@ if ($tagcoll) { $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 f3152ab11b4..e6c40e0d18c 100644 --- a/theme/boost/classes/boostnavbar.php +++ b/theme/boost/classes/boostnavbar.php @@ -110,9 +110,7 @@ class boostnavbar implements \renderable { $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 0c8b879e523..93bf2d3ed6f 100644 --- a/theme/index.php +++ b/theme/index.php @@ -43,6 +43,9 @@ if (!empty($device)) { 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 97deb4142f3..6ae2169abf1 100644 --- a/user/editadvanced.php +++ b/user/editadvanced.php @@ -73,6 +73,8 @@ if ($id == -1) { $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 8ff17d1f3ab..61e45122269 100644 --- a/user/profilesys.php +++ b/user/profilesys.php @@ -34,7 +34,7 @@ require_once($CFG->libdir.'/adminlib.php'); $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'));