mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
MDL-31528 navigation: Fixed up navbar generation when editing categories
This commit is contained in:
parent
6a16e1367a
commit
8486f20713
1 changed files with 35 additions and 0 deletions
|
@ -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 @@ 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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue