Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-31528 navigation: Fixed up navbar generation when editing categories

  • Loading branch information...
commit fc08a60dc1a769481d4ace356f9d484862f42969 1 parent 51f205a
@samhemelryk samhemelryk authored
Showing with 35 additions and 0 deletions.
  1. +35 −0 course/editcategory.php
View
35 course/editcategory.php
@@ -1,9 +1,29 @@
<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
/**
* 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 @@
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();
Please sign in to comment.
Something went wrong with that request. Please try again.