Skip to content

Commit

Permalink
MDL-74386 navigation: Remove redundant set_secondary_navigation() calls
Browse files Browse the repository at this point in the history
Removes $PAGE->set_secondary_navigation(false) calls which certain pages
were using to prevent displaying secondary navigation menu in the system
context. This logic is now generally handled within the secondary
navigation class.
  • Loading branch information
Mihail Geshoski committed Apr 8, 2022
1 parent d08c351 commit 8d0ca00
Show file tree
Hide file tree
Showing 11 changed files with 6 additions and 11 deletions.
1 change: 0 additions & 1 deletion badges/badge.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
$PAGE->set_url('/badges/badge.php', array('hash' => $id));
$PAGE->set_pagelayout('base');
$PAGE->set_title(get_string('issuedbadge', 'badges'));
$PAGE->set_secondary_navigation(false);

$badge = new \core_badges\output\issued_badge($id);
if (!empty($badge->recipient->id)) {
Expand Down
4 changes: 3 additions & 1 deletion calendar/delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@
$PAGE->navbar->add($title);
$PAGE->set_title($site->shortname.': '.$strcalendar.': '.$title);
$PAGE->set_heading($COURSE->fullname);
$PAGE->set_secondary_navigation(false);
if ($course) {
$PAGE->set_secondary_navigation(false);
}
echo $OUTPUT->header();
echo $OUTPUT->box_start('eventlist');

Expand Down
3 changes: 2 additions & 1 deletion calendar/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
get_string('calendar', 'calendar'),
new moodle_url('/calendar/view.php', ['view' => 'month', 'course' => $course->id])
);
$PAGE->set_secondary_navigation(false);
} else if (!empty($categoryid)) {
core_course_category::get($categoryid); // Check that category exists and can be accessed.
$PAGE->set_category_by_id($categoryid);
Expand All @@ -108,10 +109,10 @@
get_string('calendar', 'calendar'),
new moodle_url('/calendar/view.php', ['view' => 'month', 'category' => $categoryid])
);
$PAGE->set_secondary_navigation(false);
} else {
$PAGE->set_context(context_system::instance());
}
$PAGE->set_secondary_navigation(false);

require_login($course, false);

Expand Down
1 change: 0 additions & 1 deletion error/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
$PAGE->set_title($title);
$PAGE->set_heading($title);
$PAGE->navbar->add($title);
$PAGE->set_secondary_navigation(false);

// This allows the webserver to dictate wether the http status should remain
// what it would have been, or force it to be a 404. Under other conditions
Expand Down
1 change: 0 additions & 1 deletion my/courses.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
$PAGE->set_url('/my/courses.php');
$PAGE->add_body_classes(['limitedwidth', 'page-mycourses']);
$PAGE->set_pagelayout('mycourses');
$PAGE->set_secondary_navigation(false);

$PAGE->set_pagetype('my-index');
$PAGE->blocks->add_region('content');
Expand Down
1 change: 0 additions & 1 deletion my/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@
$PAGE->set_subpage($currentpage->id);
$PAGE->set_title($pagetitle);
$PAGE->set_heading($pagetitle);
$PAGE->set_secondary_navigation(false);

if (!isguestuser()) { // Skip default home page for guests
if (get_home_page() != HOMEPAGE_MY) {
Expand Down
1 change: 0 additions & 1 deletion tag/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@
$PAGE->set_context($systemcontext);
$PAGE->set_blocks_editing_capability('moodle/tag:editblocks');
$PAGE->set_pagelayout('standard');
$PAGE->set_secondary_navigation(false);

$tagname = $tag->get_display_name();
$tagcollid = $tag->tagcollid;
Expand Down
2 changes: 1 addition & 1 deletion tag/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
if ($ctx && ($context = context::instance_by_id($ctx, IGNORE_MISSING)) && $context->contextlevel >= CONTEXT_COURSE) {
list($context, $course, $cm) = get_context_info_array($context->id);
require_login($course, false, $cm, false, true);
$PAGE->set_secondary_navigation(false);
} else {
$PAGE->set_context($systemcontext);
}
Expand All @@ -85,7 +86,6 @@
$tagnode->make_active();
$PAGE->set_pagelayout('standard');
$PAGE->set_blocks_editing_capability('moodle/tag:editblocks');
$PAGE->set_secondary_navigation(false);

$buttons = '';
if (has_capability('moodle/tag:manage', context_system::instance())) {
Expand Down
1 change: 0 additions & 1 deletion tag/search.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@

$PAGE->set_title(get_string('tags', 'tag'));
$PAGE->set_heading($SITE->fullname);
$PAGE->set_secondary_navigation(false);

$buttons = '';
if (has_capability('moodle/tag:manage', context_system::instance())) {
Expand Down
1 change: 0 additions & 1 deletion user/contactsitesupport.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
$PAGE->set_title(get_string('contactsitesupport', 'admin'));
$PAGE->set_heading(get_string('contactsitesupport', 'admin'));
$PAGE->set_pagelayout('standard');
$PAGE->set_secondary_navigation(false);

$user = isloggedin() && !isguestuser() ? $USER : null;
$renderer = $PAGE->get_renderer('user');
Expand Down
1 change: 0 additions & 1 deletion user/profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
require_login();
if (isguestuser()) {
$PAGE->set_context(context_system::instance());
$PAGE->set_secondary_navigation(false);
echo $OUTPUT->header();
echo $OUTPUT->confirm(get_string('guestcantaccessprofiles', 'error'),
get_login_url(),
Expand Down

0 comments on commit 8d0ca00

Please sign in to comment.