MDL-25954 fix cohort navigation issues
authorPetr Skoda <commits@skodak.org>
Sat, 9 Jul 2011 15:18:06 +0000 (17:18 +0200)
committerPetr Skoda <commits@skodak.org>
Sat, 9 Jul 2011 15:18:06 +0000 (17:18 +0200)
cohort/assign.php
cohort/edit.php
cohort/index.php

index adbc912..9fa5169 100644 (file)
@@ -52,10 +52,15 @@ if (optional_param('cancel', false, PARAM_BOOL)) {
 
 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);
 
index 250fd16..4063e9c 100644 (file)
@@ -68,9 +68,13 @@ $PAGE->set_context($context);
 
 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);
index ba656e0..78a9d75 100644 (file)
@@ -59,8 +59,6 @@ if ($category) {
     $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'));
 }