From 0af463d41328ca52be42fe8561dc624f72798228 Mon Sep 17 00:00:00 2001 From: Sam Hemelryk Date: Wed, 18 Sep 2013 08:21:32 +1200 Subject: [PATCH] MDL-41828 mod: fixed navbar when adding modules to a course --- course/modedit.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/course/modedit.php b/course/modedit.php index db70a9fcedd..bf088d8d18b 100644 --- a/course/modedit.php +++ b/course/modedit.php @@ -56,6 +56,11 @@ if (!empty($add)) { $course = $DB->get_record('course', array('id'=>$course), '*', MUST_EXIST); require_login($course); + // There is no page for this in the navigation. The closest we'll have is the course section. + // If the course section isn't displayed on the navigation this will fall back to the course which + // will be the closest match we have. + navigation_node::override_active_url(course_get_url($course, $section)); + list($module, $context, $cw) = can_add_moduleinfo($course, $add, $section); $cm = null; @@ -114,6 +119,7 @@ if (!empty($add)) { } else { $pageheading = get_string('addinganew', 'moodle', $fullmodulename); } + $navbaraddition = $pageheading; } else if (!empty($update)) { @@ -220,6 +226,7 @@ if (!empty($add)) { } else { $pageheading = get_string('updatinga', 'moodle', $fullmodulename); } + $navbaraddition = null; } else { require_login(); @@ -290,6 +297,11 @@ if ($mform->is_cancelled()) { $PAGE->set_heading($course->fullname); $PAGE->set_title($streditinga); $PAGE->set_cacheable(false); + + if (isset($navbaraddition)) { + $PAGE->navbar->add($navbaraddition); + } + echo $OUTPUT->header(); if (get_string_manager()->string_exists('modulename_help', $module->name)) { -- 2.43.0