MDL-41828 mod: fixed navbar when adding modules to a course

This commit is contained in:
Sam Hemelryk
2013-10-01 13:30:00 +10:00
committed by Marina Glancy
parent d451eb4dc5
commit 0af463d413
+12
View File
@@ -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)) {