From c3871a91746f2686671bc0a8aa5b8c3b3ea34ae5 Mon Sep 17 00:00:00 2001 From: Adrian Greeve Date: Tue, 30 Mar 2021 10:28:56 +0800 Subject: [PATCH] MDL-70196 navigation: Update to pages to add a URL. - Part of: MDL-69588 Some pages have added an item to the end of the navbar without a link for it. This adds the current page as a url to this navigation node. Doing this brings it in line with all of the other pages around Moodle and also helps with the new navigation changes in theme boost. --- badges/criteria.php | 4 ++-- mod/assign/renderer.php | 2 +- mod/forum/search.php | 6 ++++-- mod/forum/subscribers.php | 2 +- mod/workshop/allocation.php | 2 +- tag/index.php | 5 +++-- 6 files changed, 12 insertions(+), 9 deletions(-) diff --git a/badges/criteria.php b/badges/criteria.php index 0a9f290967b4c..58f9c0bdaf326 100644 --- a/badges/criteria.php +++ b/badges/criteria.php @@ -61,7 +61,7 @@ $PAGE->set_url($currenturl); $PAGE->set_heading($badge->name); $PAGE->set_title($badge->name); -$PAGE->navbar->add($badge->name); +$PAGE->navbar->add($badge->name, $currenturl); $output = $PAGE->get_renderer('core', 'badges'); $msg = optional_param('msg', '', PARAM_TEXT); @@ -105,4 +105,4 @@ echo $OUTPUT->box(get_string('addcriteriatext', 'badges')); } -echo $OUTPUT->footer(); \ No newline at end of file +echo $OUTPUT->footer(); diff --git a/mod/assign/renderer.php b/mod/assign/renderer.php index 19476ed5a6c82..f32e978ff646b 100644 --- a/mod/assign/renderer.php +++ b/mod/assign/renderer.php @@ -233,7 +233,7 @@ public function render_assign_header(assign_header $header) { $o = ''; if ($header->subpage) { - $this->page->navbar->add($header->subpage); + $this->page->navbar->add($header->subpage, $header->subpageurl); $args = ['contextname' => $header->context->get_context_name(false, true), 'subpage' => $header->subpage]; $title = get_string('subpagetitle', 'assign', $args); } else { diff --git a/mod/forum/search.php b/mod/forum/search.php index 8bd1bb3f7a3c4..f72e33b56ac9e 100644 --- a/mod/forum/search.php +++ b/mod/forum/search.php @@ -139,8 +139,10 @@ if (!$search || $showform) { - $PAGE->navbar->add($strforums, new moodle_url('/mod/forum/index.php', array('id'=>$course->id))); - $PAGE->navbar->add(get_string('advancedsearch', 'forum')); + $url = new moodle_url('/mod/forum/index.php', array('id' => $course->id)); + $PAGE->navbar->add($strforums, $url); + $url = new moodle_url('/mod/forum/search.php', array('id' => $course->id)); + $PAGE->navbar->add(get_string('advancedsearch', 'forum'), $url); $PAGE->set_title($strsearch); $PAGE->set_heading($course->fullname); diff --git a/mod/forum/subscribers.php b/mod/forum/subscribers.php index 55665799ae9d1..2e62c44df5ae0 100644 --- a/mod/forum/subscribers.php +++ b/mod/forum/subscribers.php @@ -97,7 +97,7 @@ } $strsubscribers = get_string("subscribers", "forum"); -$PAGE->navbar->add($strsubscribers); +$PAGE->navbar->add($strsubscribers, $url); $PAGE->set_title($strsubscribers); $PAGE->set_heading($COURSE->fullname); if (has_capability('mod/forum:managesubscriptions', $context) && \mod_forum\subscriptions::is_forcesubscribed($forum) === false) { diff --git a/mod/workshop/allocation.php b/mod/workshop/allocation.php index 5901bcff70302..ebc5abaff02a1 100644 --- a/mod/workshop/allocation.php +++ b/mod/workshop/allocation.php @@ -46,7 +46,7 @@ $PAGE->set_title($workshop->name); $PAGE->set_heading($course->fullname); -$PAGE->navbar->add(get_string('allocation', 'workshop')); +$PAGE->navbar->add(get_string('allocation', 'workshop'), $workshop->allocation_url($method)); $allocator = $workshop->allocator_instance($method); $initresult = $allocator->init(); diff --git a/tag/index.php b/tag/index.php index b0373168bd608..a5857b19b005b 100644 --- a/tag/index.php +++ b/tag/index.php @@ -78,7 +78,8 @@ $tagcollid = $tag->tagcollid; -$PAGE->set_url($tag->get_view_url($exclusivemode, $fromctx, $ctx, $rec)); +$pageurl = $tag->get_view_url($exclusivemode, $fromctx, $ctx, $rec); +$PAGE->set_url($pageurl); $PAGE->set_subpage($tag->id); $tagnode = $PAGE->navigation->find('tags', null); $tagnode->make_active(); @@ -97,7 +98,7 @@ $buttons .= $OUTPUT->edit_button(clone($PAGE->url)); } -$PAGE->navbar->add($tagname); +$PAGE->navbar->add($tagname, $pageurl); $PAGE->set_title(get_string('tag', 'tag') .' - '. $tag->get_display_name()); $PAGE->set_heading($COURSE->fullname); $PAGE->set_button($buttons);