diff --git a/course/editcategory.php b/course/editcategory.php index 9752cce1713..ff4bad5e0b6 100644 --- a/course/editcategory.php +++ b/course/editcategory.php @@ -1,9 +1,29 @@ . + /** * Page for creating or editing course category name/parent/description. * When called with an id parameter, edits the category with that id. * Otherwise it creates a new category with default parent from the parent * parameter, which may be 0. + * + * @package core + * @subpackage course + * @copyright 2007 Nicolas Connault + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once('../config.php'); @@ -108,6 +128,21 @@ if ($mform->is_cancelled()) { redirect('category.php?id='.$newcategory->id.'&categoryedit=on'); } +// Unfortunately the navigation never generates correctly for this page because technically +// this page doesn't actually exist on the navigation you get here through the course +// management page. +try { + // First up we'll try to make the course management page active seeing as that is + // where the user thinks they are. + // The big prolem here is that the course management page is a common page + // for both editing users and common users. + $PAGE->settingsnav->get('root')->get('courses')->get('coursemgmt')->make_active(); +} catch (Exception $ex) { + // Failing that we'll override the URL, not as accurate and chances are things + // won't be 100% correct all the time but should work most times. + navigation_node::override_active_url(new moodle_url('/course/index.php', array('categoryedit' => 'on'))); +} + $PAGE->set_title($title); $PAGE->set_heading($fullname); echo $OUTPUT->header();