Skip to content

Commit

Permalink
MDL-41828 mod: fixed navbar when adding modules to a course
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Hemelryk authored and marinaglancy committed Oct 1, 2013
1 parent d451eb4 commit 0af463d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions course/modedit.php
Expand Up @@ -56,6 +56,11 @@
$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;
Expand Down Expand Up @@ -114,6 +119,7 @@
} else {
$pageheading = get_string('addinganew', 'moodle', $fullmodulename);
}
$navbaraddition = $pageheading;

} else if (!empty($update)) {

Expand Down Expand Up @@ -220,6 +226,7 @@
} else {
$pageheading = get_string('updatinga', 'moodle', $fullmodulename);
}
$navbaraddition = null;

} else {
require_login();
Expand Down Expand Up @@ -290,6 +297,11 @@
$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)) {
Expand Down

0 comments on commit 0af463d

Please sign in to comment.