From 21c8d60dacef4e641417c4260578f5189d1d3b59 Mon Sep 17 00:00:00 2001 From: Petr Skoda Date: Sat, 9 Jul 2011 17:18:06 +0200 Subject: [PATCH] MDL-25954 fix cohort navigation issues --- cohort/assign.php | 9 +++++++-- cohort/edit.php | 8 ++++++-- cohort/index.php | 2 -- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/cohort/assign.php b/cohort/assign.php index adbc91218865a..9fa51691c0cc2 100644 --- a/cohort/assign.php +++ b/cohort/assign.php @@ -52,10 +52,15 @@ if ($context->contextlevel == CONTEXT_COURSECAT) { $category = $DB->get_record('course_categories', array('id'=>$context->instanceid), '*', MUST_EXIST); - $PAGE->navbar->add($category->name, new moodle_url('/course/index.php', array('categoryedit'=>'1'))); + navigation_node::override_active_url(new moodle_url('/cohort/index.php', array('contextid'=>$cohort->contextid))); + $PAGE->set_pagelayout('report'); + +} else { + navigation_node::override_active_url(new moodle_url('/cohort/index.php', array())); + $PAGE->set_pagelayout('admin'); } -$PAGE->navbar->add(get_string('cohorts', 'cohort'), new moodle_url('/cohort/', array('contextid'=>$context->id))); $PAGE->navbar->add(get_string('assign', 'cohort')); + $PAGE->set_title(get_string('cohort:assign', 'cohort')); $PAGE->set_heading($COURSE->fullname); diff --git a/cohort/edit.php b/cohort/edit.php index 250fd164e3e0a..4063e9c54c9ad 100644 --- a/cohort/edit.php +++ b/cohort/edit.php @@ -68,9 +68,13 @@ if ($context->contextlevel == CONTEXT_COURSECAT) { $category = $DB->get_record('course_categories', array('id'=>$context->instanceid), '*', MUST_EXIST); - $PAGE->navbar->add($category->name, new moodle_url('/course/index.php', array('categoryedit'=>'1'))); + navigation_node::override_active_url(new moodle_url('/cohort/index.php', array('contextid'=>$cohort->contextid))); + $PAGE->set_pagelayout('report'); + +} else { + navigation_node::override_active_url(new moodle_url('/cohort/index.php', array())); + $PAGE->set_pagelayout('admin'); } -$PAGE->navbar->add(get_string('cohorts', 'cohort'), new moodle_url('/cohort/', array('contextid'=>$context->id))); if ($delete and $cohort->id) { $PAGE->url->param('delete', 1); diff --git a/cohort/index.php b/cohort/index.php index ba656e0ce72b1..78a9d75e2607e 100644 --- a/cohort/index.php +++ b/cohort/index.php @@ -59,8 +59,6 @@ $PAGE->set_url('/cohort/index.php', array('contextid'=>$context->id)); $PAGE->set_title($strcohorts); $PAGE->set_heading($COURSE->fullname); - $PAGE->navbar->add($category->name, new moodle_url('/course/index.php', array('categoryedit'=>'1'))); - $PAGE->navbar->add($strcohorts); } else { admin_externalpage_setup('cohorts', '', null, '', array('pagelayout'=>'report')); }