]> git.mjollnir.org Git - moodle.git/commitdiff
navigation MDL-20216 Refactored add arguments
authorsamhemelryk <samhemelryk>
Fri, 4 Sep 2009 03:12:01 +0000 (03:12 +0000)
committersamhemelryk <samhemelryk>
Fri, 4 Sep 2009 03:12:01 +0000 (03:12 +0000)
Moved $action argument from arg5 to arg2

44 files changed:
admin/dbperformance.php
admin/mnet/delete.html
admin/roles/assign.php
admin/roles/check.php
admin/roles/override.php
admin/roles/tabs.php
admin/roles/usersroles.php
admin/xmldb/actions/edit_field_save/edit_field_save.class.php
admin/xmldb/actions/edit_index_save/edit_index_save.class.php
admin/xmldb/actions/edit_key_save/edit_key_save.class.php
admin/xmldb/actions/edit_sentence_save/edit_sentence_save.class.php
admin/xmldb/actions/edit_table_save/edit_table_save.class.php
blocks/global_navigation_tree/block_global_navigation_tree.php
blocks/rss_client/editfeed.php
blocks/rss_client/managefeeds.php
blocks/rss_client/viewfeed.php
course/delete.php
course/edit.php
course/import/activities/index.php
course/import/groups/index.php
course/recent.php
course/report/log/index.php
course/report/outline/index.php
course/report/participation/index.php
course/report/progress/index.php
course/report/stats/index.php
course/search.php
course/user.php
grade/report/user/lib.php
lib/deprecatedlib.php
lib/navigationlib.php
lib/pagelib.php
lib/simpletest/testnavigationlib.php
login/change_password.php
login/forgot_password.php
message/edit.php
mod/forum/lib.php
mod/scorm/player.php
mod/scorm/report.php
user/edit.php
user/editadvanced.php
user/messageselect.php
user/repository.php
user/view.php

index 10aa4c6a22997268f0d1abeaea025e374f9b9f9f..69364f96f3cb87f45cf9d6c7e6ba4c9bd3cfee36 100644 (file)
@@ -21,8 +21,7 @@ error('TODO: rewrite db perf code'); // TODO: rewrite
     $site = get_site();
 
     if (!empty($topframe)) {
-        $PAGE->navbar->add($stradministration, null, null, navigation_node::TYPE_CUSTOM,
-                            new moodle_url($CFG->wwwroot.'/admin/index.php'));
+        $PAGE->navbar->add($stradministration, new moodle_url($CFG->wwwroot.'/admin/index.php'));
         $PAGE->navbar->add($strdatabaseperformance);
         $PAGE->set_title("$site->shortname: $strdatabaseperformance");
         $PAGE->set_heading($site->fullname);
index ac3786f841af9073d4bf6187de52e515f275fb8b..2729e85989986b64ec9949a7a0db5dce398247a0 100644 (file)
@@ -1,8 +1,6 @@
 <?php
-$PAGE->navbar->add($stradministration, null, null, navigation_node::TYPE_CUSTOM, 
-                   new moodle_url($CFG->wwwroot.'/'.$CFG->admin.'/index.php'));
-$PAGE->navbar->add(get_string('mnetsettings', 'mnet'), null, null, navigation_node::TYPE_CUSTOM,
-                   new moodle_url($CFG->wwwroot.'/'.$CFG->admin.'/mnet/index.php'));
+$PAGE->navbar->add($stradministration, new moodle_url($CFG->wwwroot.'/'.$CFG->admin.'/index.php'));
+$PAGE->navbar->add(get_string('mnetsettings', 'mnet'), new moodle_url($CFG->wwwroot.'/'.$CFG->admin.'/mnet/index.php'));
 $PAGE->navbar->add(get_string('deletehost', 'mnet'));
 
 $PAGE->set_title("$site->shortname: $strmnetsettings");
index 201639a5d5daec7f9fb20d8f4b0c21265b0086f5..5eede80e24fe9c5c68e46488c78ad6ed0f8f6a74 100755 (executable)
         $PAGE->set_title($title);
         if ($courseid != SITEID) {
             if (has_capability('moodle/course:viewparticipants', get_context_instance(CONTEXT_COURSE, $courseid))) {
-                $PAGE->navbar->add(get_string('participants'), null, null, navigation_node::TYPE_CUSTOM,
-                                   new moodle_url($CFG->wwwroot.'/user/index.php', array('id'=>$courseid)));
+                $PAGE->navbar->add(get_string('participants'), new moodle_url($CFG->wwwroot.'/user/index.php', array('id'=>$courseid)));
             }
             $PAGE->set_heading($fullname);
         } else {
             $PAGE->set_heading($course->fullname);
         }
-        $PAGE->navbar->add($fullname, null, null, navigation_node::TYPE_CUSTOM,
-                   new moodle_url("$CFG->wwwroot/user/view.php", array('id'=>$userid,'course'=>$courseid)));
+        $PAGE->navbar->add($fullname, new moodle_url("$CFG->wwwroot/user/view.php", array('id'=>$userid,'course'=>$courseid)));
         $PAGE->navbar->add($straction);
         echo $OUTPUT->header();
 
index 6041234112a6ce38ec452c79b5e35e30643c9b24..eaff142acda69aac02f4d8bcd31a104d9722ae7c 100755 (executable)
         $PAGE->set_title($title);
         if ($courseid != SITEID) {
             if (has_capability('moodle/course:viewparticipants', get_context_instance(CONTEXT_COURSE, $courseid))) {
-                $PAGE->navbar->add(get_string('participants'), null, null, navigation_node::TYPE_CUSTOM,
-                                   new moodle_url($CFG->wwwroot.'/user/index.php', array('id'=>$courseid)));
+                $PAGE->navbar->add(get_string('participants'), new moodle_url($CFG->wwwroot.'/user/index.php', array('id'=>$courseid)));
             }
             $PAGE->set_heading($fullname);
         } else {
             $PAGE->set_heading($course->fullname);
         }
-        $PAGE->navbar->add($fullname, null, null, navigation_node::TYPE_CUSTOM,
-                   new moodle_url("$CFG->wwwroot/user/view.php", array('id'=>$userid,'course'=>$courseid)));
+        $PAGE->navbar->add($fullname, new moodle_url("$CFG->wwwroot/user/view.php", array('id'=>$userid,'course'=>$courseid)));
         $PAGE->navbar->add($straction);
         echo $OUTPUT->header();
 
index 3278e8418c506510ed146edb1910071f39c6668c..89eb171442fe55902d19096e012ea8562780cb5e 100755 (executable)
         $PAGE->set_title($title);
         if ($courseid != SITEID) {
             if (has_capability('moodle/course:viewparticipants', get_context_instance(CONTEXT_COURSE, $course->id))) {
-                $PAGE->navbar->add(get_string('participants'), null, null, navigation_node::TYPE_CUSTOM,
-                                   new moodle_url($CFG->wwwroot.'/user/index.php', array('id'=>$course->id)));
+                $PAGE->navbar->add(get_string('participants'), new moodle_url($CFG->wwwroot.'/user/index.php', array('id'=>$course->id)));
             }
             $PAGE->set_heading($fullname);
         } else {
             $PAGE->set_heading($course->fullname);
         }
-        $PAGE->navbar->add($fullname, null, null, navigation_node::TYPE_CUSTOM,
-                   new moodle_url("$CFG->wwwroot/user/view.php", array('id'=>$userid,'course'=>$courseid)));
+        $PAGE->navbar->add($fullname, new moodle_url("$CFG->wwwroot/user/view.php", array('id'=>$userid,'course'=>$courseid)));
         $PAGE->navbar->add($straction);
         echo $OUTPUT->header();
 
index 25b6853b75d18859f1e4de1f26bbead8ebe31e95..bfc90a1070b75d583a0b440a882d2a09ccd147ae 100755 (executable)
@@ -52,7 +52,7 @@ if ($currenttab != 'update') {
             if (empty($title)) {
                 $title = $SITE->fullname;
             }
-            $PAGE->navbar->add($stradministration, null, null, navigation_node::TYPE_SETTING, new moodle_url($CFG->wwwroot.'/admin/'));
+            $PAGE->navbar->add($stradministration, new moodle_url($CFG->wwwroot.'/admin/'), null, null, navigation_node::TYPE_SETTING);
             $PAGE->navbar->add($straction);
             $PAGE->set_title($title);
             $PAGE->set_heading($SITE->fullname);
@@ -73,8 +73,8 @@ if ($currenttab != 'update') {
                 $title = "$SITE->shortname: $category->name";
             }
             
-            $PAGE->navbar->add($strcategories, null, null, navigation_node::TYPE_SETTING, new moodle_url($CFG->wwwroot.'/course/index.php'));
-            $PAGE->navbar->add($category->name, null, null, navigation_node::TYPE_SETTING, new moodle_url($CFG->wwwroot.'/course/category.php', array('id'=>$category->id)));
+            $PAGE->navbar->add($strcategories, new moodle_url($CFG->wwwroot.'/course/index.php'), null, null, navigation_node::TYPE_SETTING);
+            $PAGE->navbar->add($category->name, new moodle_url($CFG->wwwroot.'/course/category.php', array('id'=>$category->id)), null, null, navigation_node::TYPE_SETTING);
             $PAGE->set_title($title);
             $PAGE->set_heading("$SITE->fullname: $strcourses");
             echo $OUTPUT->header();
@@ -89,7 +89,7 @@ if ($currenttab != 'update') {
                     $title = get_string("editcoursesettings");
                 }
                 $roleslink = new moodle_url("$CFG->wwwroot/$CFG->admin/roles/assign.php", array('contextid'=>$context->id));
-                $PAGE->navbar->add(get_string('roles'), null, null, navigation_node::TYPE_SETTING, $roleslink);
+                $PAGE->navbar->add(get_string('roles'), $roleslink, null, null, navigation_node::TYPE_SETTING);
                 $PAGE->set_title($title);
                 $PAGE->set_heading($course->fullname);
                 echo $OUTPUT->header();
index a94c591a6773ac312bb222d64edfc4fecd058487..9a1c7576abd341a2190f1c6350c4e285a2f07bff 100644 (file)
@@ -126,14 +126,12 @@ $PAGE->set_title($title);
 if ($courseid != SITEID) {
     $PAGE->set_heading($fullname);
     if (has_capability('moodle/course:viewparticipants', $coursecontext)) {
-        $PAGE->navbar->add(get_string('participants'), null, null, navigation_node::TYPE_CUSTOM,
-                           new moodle_url($CFG->wwwroot.'/user/index.php', array('id'=>$courseid)));
+        $PAGE->navbar->add(get_string('participants'),new moodle_url($CFG->wwwroot.'/user/index.php', array('id'=>$courseid)));
     }
 } else {
     $PAGE->set_heading($course->fullname);
 }
-$PAGE->navbar->add($fullname, null, null, navigation_node::TYPE_CUSTOM,
-                   new moodle_url("$CFG->wwwroot/user/view.php", array('id'=>$userid,'course'=>$courseid)));
+$PAGE->navbar->add($fullname, new moodle_url("$CFG->wwwroot/user/view.php", array('id'=>$userid,'course'=>$courseid)));
 $PAGE->navbar->add($straction);
 echo $OUTPUT->header();
 
index 53650a0f618eda78c41fd7eeca6cba45ef295be2..a62085a22b0bdbe2689330e2d8d93d5f19e21dbd 100644 (file)
@@ -232,8 +232,8 @@ class edit_field_save extends XMLDBAction {
             $tempfield->setDefault($default);
         /// Prepare the output
             $site = get_site();
-            $PAGE->navbar->add($this->str['administration'], null, null. navigation_node::TYPE_CUSTOM, '../index.php');
-            $PAGE->navbar->add('XMLDB', null, null. navigation_node::TYPE_CUSTOM, 'index.php');
+            $PAGE->navbar->add($this->str['administration'], '../index.php');
+            $PAGE->navbar->add('XMLDB', 'index.php');
             $PAGE->set_title("$site->shortname: XMLDB");
             $PAGE->set_heading($site->fullname);
             echo $OUTPUT->header();
index d72ca9b0edc050c63e847f1e102932af382c4f3f..a6fcfefde90ce269b3d81ced50164179a785f665 100644 (file)
@@ -164,8 +164,8 @@ class edit_index_save extends XMLDBAction {
             $tempindex->setFields($fieldsarr);
         /// Prepare the output
             $site = get_site();
-            $PAGE->navbar->add($this->str['administration'], null, null. navigation_node::TYPE_CUSTOM, '../index.php');
-            $PAGE->navbar->add('XMLDB', null, null. navigation_node::TYPE_CUSTOM, 'index.php');
+            $PAGE->navbar->add($this->str['administration'], '../index.php');
+            $PAGE->navbar->add('XMLDB', 'index.php');
             $PAGE->set_title("$site->shortname: XMLDB");
             $PAGE->set_heading($site->fullname);
             echo $OUTPUT->header();
index eb011fb41070058bf9267d4d6e807ca8720bf79a..f9afce4ef7d7b5b7f74f3261bc1e263347592a7a 100644 (file)
@@ -240,8 +240,8 @@ class edit_key_save extends XMLDBAction {
             }
         /// Prepare the output
             $site = get_site();
-            $PAGE->navbar->add($this->str['administration'], null, null. navigation_node::TYPE_CUSTOM, '../index.php');
-            $PAGE->navbar->add('XMLDB', null, null. navigation_node::TYPE_CUSTOM, 'index.php');
+            $PAGE->navbar->add($this->str['administration'], '../index.php');
+            $PAGE->navbar->add('XMLDB', 'index.php');
             $PAGE->set_title("$site->shortname: XMLDB");
             $PAGE->set_heading($site->fullname);
             echo $OUTPUT->header();
index 4fa2fcaecd2915b2bfa41c56439c8c690ca3a533..7db6ea5905c448a47cdb632f871087aef4799c1c 100644 (file)
@@ -120,8 +120,8 @@ class edit_sentence_save extends XMLDBAction {
         if (!empty($errors)) {
         /// Prepare the output
             $site = get_site();
-            $PAGE->navbar->add($this->str['administration'], null, null. navigation_node::TYPE_CUSTOM, '../index.php');
-            $PAGE->navbar->add('XMLDB', null, null. navigation_node::TYPE_CUSTOM, 'index.php');
+            $PAGE->navbar->add($this->str['administration'], '../index.php');
+            $PAGE->navbar->add('XMLDB', 'index.php');
             $PAGE->set_title("$site->shortname: XMLDB");
             $PAGE->set_heading($site->fullname);
             echo $OUTPUT->header();
index 283abcdb37b3874190cc23415516769ca000d2a6..f41dcfd7d3f28065694e0daadda8be15186fab14 100644 (file)
@@ -105,8 +105,8 @@ class edit_table_save extends XMLDBAction {
             $temptable = new xmldb_table($name);
             /// Prepare the output
             $site = get_site();
-            $PAGE->navbar->add($this->str['administration'], null, null. navigation_node::TYPE_CUSTOM, '../index.php');
-            $PAGE->navbar->add('XMLDB', null, null. navigation_node::TYPE_CUSTOM, 'index.php');
+            $PAGE->navbar->add($this->str['administration'], '../index.php');
+            $PAGE->navbar->add('XMLDB', 'index.php');
             $PAGE->set_title("$site->shortname: XMLDB");
             $PAGE->set_heading($site->fullname);
             echo $OUTPUT->header();
index 327d0ab574d5a34d08e802564eebebd0edd5e885..bc58ad0f9c90a19ea090cf9129ea8ddbc364e21f 100644 (file)
@@ -278,7 +278,7 @@ class block_global_navigation_tree extends block_tree {
         // If we have `more than nothing` in the history display it :D
         if ($historycount > 0) {
             // Add a branch to hold the users history
-            $myhistorybranch = $PAGE->navigation->add(get_string('showmyhistorytitle', $this->blockname), null, 'myhistory',navigation_node::TYPE_CATEGORY);
+            $myhistorybranch = $PAGE->navigation->add(get_string('showmyhistorytitle', $this->blockname), null, null, 'myhistory',navigation_node::TYPE_CATEGORY);
             $PAGE->navigation->get($myhistorybranch)->children = array_reverse($history);
         }
 
@@ -318,7 +318,7 @@ class block_global_navigation_tree extends block_tree {
         }
 
         // Add a branch labelled something like My Courses
-        $mycoursesbranch = $PAGE->navigation->add(get_string('mycourses'), null, 'mycourses',navigation_node::TYPE_CATEGORY);
+        $mycoursesbranch = $PAGE->navigation->add(get_string('mycourses'), null, null, 'mycourses',navigation_node::TYPE_CATEGORY);
         $PAGE->navigation->add_courses($courses, $mycoursesbranch);
 
         return true;
index f35bfe2c02dc0492b50032504be731342965fa83..dceb56b2a6158fa1ba704d316f022100a828866e 100644 (file)
@@ -218,7 +218,7 @@ if ($mform->is_cancelled()) {
 
     $settingsurl = new moodle_url($CFG->wwwroot.'/'.$CFG->admin.'/settings.php?section=blocksettingrss_client');
     $PAGE->navbar->add(get_string('blocks'));
-    $PAGE->navbar->add(get_string('feedstitle', 'block_rss_client'), null, null, navbar::TYPE_SETTING, $settingsurl);
+    $PAGE->navbar->add(get_string('feedstitle', 'block_rss_client'), $settingsurl);
     $PAGE->navbar->add(get_string('managefeeds', 'block_rss_client'));
     $PAGE->navbar->add($strtitle);
 
index 6f77309efbb36110bccaa46c5c669889bb4ca56b..66482e35aabfa9860a8c03cd30e89880745a4774 100644 (file)
@@ -85,8 +85,8 @@ $PAGE->set_heading($strmanage);
 $settingsurl = new moodle_url($CFG->wwwroot.'/'.$CFG->admin.'/settings.php?section=blocksettingrss_client');
 $managefeeds = new moodle_url($CFG->wwwroot . '/blocks/rss_client/managefeeds.php', $urlparams);
 $PAGE->navbar->add(get_string('blocks'));
-$PAGE->navbar->add(get_string('feedstitle', 'block_rss_client'), null, null, navbar::TYPE_SETTING, $settingsurl);
-$PAGE->navbar->add(get_string('managefeeds', 'block_rss_client'), null, null, navbar::TYPE_SETTING, $managefeeds);
+$PAGE->navbar->add(get_string('feedstitle', 'block_rss_client'), $settingsurl);
+$PAGE->navbar->add(get_string('managefeeds', 'block_rss_client'), $managefeeds);
 echo $OUTPUT->header();
 
 $table = new flexible_table('rss-display-feeds');
index cc1ff4588608fe63bc894e4a6d3b28b817b32f64..133d46b50389b0840f8803d0b423fc1921a89f7b 100644 (file)
@@ -74,7 +74,7 @@ $PAGE->set_heading($strviewfeed);
 $settingsurl = new moodle_url($CFG->wwwroot.'/'.$CFG->admin.'/settings.php?section=blocksettingrss_client');
 $managefeeds = new moodle_url($CFG->wwwroot . '/blocks/rss_client/managefeeds.php', $urlparams);
 $PAGE->navbar->add(get_string('blocks'));
-$PAGE->navbar->add(get_string('feedstitle', 'block_rss_client'), null, null, navbar::TYPE_SETTING, $settingsurl);
+$PAGE->navbar->add(get_string('feedstitle', 'block_rss_client'), $settingsurl);
 $PAGE->navbar->add(get_string('managefeeds', 'block_rss_client'));
 $PAGE->navbar->add($strviewfeed);
 echo $OUTPUT->header();
index 251a70dcc0b303054027d328058bd3901e21feb3..567b3d8f88d3e1fd28975a66d03e4ac39dc8a117 100644 (file)
 
     $category = $DB->get_record("course_categories", array("id"=>$course->category));
 
-    $PAGE->navbar->add($stradministration, null, null, navigation_node::TYPE_CUSTOM,
-                       new moodle_url($CFG->wwwroot.'/'.$CFG->admin.'/index.php/'));
-    $PAGE->navbar->add($strcategories, null, null, navigation_node::TYPE_CUSTOM,
-                       new moodle_url($CFG->wwwroot.'/course/index.php'));
-    $PAGE->navbar->add($category->name, null, null, navigation_node::TYPE_CUSTOM,
-                       new moodle_url($CFG->wwwroot.'/course/category.php', array('id'=>$course->category)));
+    $PAGE->navbar->add($stradministration, new moodle_url($CFG->wwwroot.'/'.$CFG->admin.'/index.php/'));
+    $PAGE->navbar->add($strcategories, new moodle_url($CFG->wwwroot.'/course/index.php'));
+    $PAGE->navbar->add($category->name, new moodle_url($CFG->wwwroot.'/course/category.php', array('id'=>$course->category)));
     if (! $delete) {
         $strdeletecheck = get_string("deletecheck", "", $course->shortname);
         $strdeletecoursecheck = get_string("deletecoursecheck");
index 7ba97e88c6e81b67d59ee2e8150bd78ff4c2d09e..c551f6836be16b3c4f8cbfe1b9f0757eb3082561 100644 (file)
         $title = $streditcoursesettings;
         $fullname = $course->fullname;
     } else {
-        $PAGE->navbar->add($stradministration, null, null, navigation_node::TYPE_CUSTOM,
-                           new moodle_url($CFG->wwwroot.'/'.$CFG->admin.'/index.php'));
-        $PAGE->navbar->add($strcategories, null, null, navigation_node::TYPE_CUSTOM,
-                           new moodle_url($CFG->wwwroot.'/course/index.php'));
+        $PAGE->navbar->add($stradministration, new moodle_url($CFG->wwwroot.'/'.$CFG->admin.'/index.php'));
+        $PAGE->navbar->add($strcategories, new moodle_url($CFG->wwwroot.'/course/index.php'));
         $PAGE->navbar->add($straddnewcourse);
         $title = "$site->shortname: $straddnewcourse";
         $fullname = $site->fullname;
index fda7e13808fe5d0e7d878b05b8af65b77cf0e4ce..48c666ad67037453637aba0d0e0fee72f3e9db65 100644 (file)
         }
     }
 
-    $PAGE->navbar->add($course->shortname, null, null, navigation_node::TYPE_CUSTOM,
-                       new moodle_url($CFG->wwwroot.'/course/view.php', array('id'=>$course->id)));
-    $PAGE->navbar->add(get_string('import'), null, null, navigation_node::TYPE_CUSTOM,
-                       new moodle_url($CFG->wwwroot.'/course/import.php', array('id'=>$course->id)));
+    $PAGE->navbar->add($course->shortname, new moodle_url($CFG->wwwroot.'/course/view.php', array('id'=>$course->id)));
+    $PAGE->navbar->add(get_string('import'), new moodle_url($CFG->wwwroot.'/course/import.php', array('id'=>$course->id)));
     $PAGE->navbar->add($strimportactivities);
 
     $PAGE->set_title("$course->shortname: $strimportactivities");
index c3020c69e55d2c768d56171b2908a9f2ddcc1605..c52b67664870b97e7834a5121e7ce7387d61607c 100755 (executable)
     }
 
 /// Print the header
-    $PAGE->navbar->add($course->shortname, null, null, navigation_node::TYPE_CUSTOM,
-                       new moodle_url($CFG->wwwroot.'/course/view.php', array('id'=>$course->id)));
-    $PAGE->navbar->add(get_string('import'), null, null, navigation_node::TYPE_CUSTOM,
-                       new moodle_url($CFG->wwwroot.'/course/import.php', array('id'=>$course->id)));
+    $PAGE->navbar->add($course->shortname, new moodle_url($CFG->wwwroot.'/course/view.php', array('id'=>$course->id)));
+    $PAGE->navbar->add(get_string('import'), new moodle_url($CFG->wwwroot.'/course/import.php', array('id'=>$course->id)));
     $PAGE->navbar->add($strimportgroups);
 
     $PAGE->set_title("$course->shortname: $strimportgroups");
index 97bcaea53128e76f1494dfc4acffa686acb27e90..4311208821a7555d821fa550590e65e211eb5902 100644 (file)
@@ -50,8 +50,7 @@
     }
 
     $strrecentactivity = get_string('recentactivity');
-    $PAGE->navbar->add($strrecentactivity, null, null, navigation_node::TYPE_CUSTOM,
-                       new moodle_url($CFG->wwwroot.'/course/recent.php', array('id'=>$course->id)));
+    $PAGE->navbar->add($strrecentactivity, new moodle_url($CFG->wwwroot.'/course/recent.php', array('id'=>$course->id)));
     $PAGE->navbar->add($userinfo);
     $PAGE->set_title("$course->shortname: $strrecentactivity");
     $PAGE->set_heading($course->fullname);
index 008e7ea003beb580b1dc71d76a765874eff687a4..1c247337855a84733fefb7c3caa9c831d2e8742d 100644 (file)
                 } else {
                     $PAGE->set_title($course->shortname .': '. $strlogs);
                     $PAGE->set_heading($course->fullname);
-                    $PAGE->navbar->add($strreports, null, null, navigation_node::TYPE_CUSTOM,
-                                       new moodle_url($CFG->wwwroot.'/course/report.php', array('id'=>$course->id)));
-                    $PAGE->navbar->add($strlogs, null, null, navigation_node::TYPE_CUSTOM,
-                                       new moodle_url($CFG->wwwroot.'/course/index.php', array('id'=>$course->id)));
+                    $PAGE->navbar->add($strreports, new moodle_url($CFG->wwwroot.'/course/report.php', array('id'=>$course->id)));
+                    $PAGE->navbar->add($strlogs, new moodle_url($CFG->wwwroot.'/course/index.php', array('id'=>$course->id)));
                     $PAGE->navbar->add("$userinfo, $dateinfo");
                     echo $OUTPUT->header();
                 }
         } else {
             $PAGE->set_title($course->shortname .': '. $strlogs);
             $PAGE->set_heading($course->fullname);
-            $PAGE->navbar->add($strreports, null, null, navigation_node::TYPE_CUSTOM,
-                               new moodle_url($CFG->wwwroot.'/course/report.php', array('id'=>$course->id)));
+            $PAGE->navbar->add($strreports, new moodle_url($CFG->wwwroot.'/course/report.php', array('id'=>$course->id)));
             $PAGE->navbar->add($strlogs);
             echo $OUTPUT->header();
         }
index a56c3ca398ef406f391a5019612f91de72f6f4e4..9b4c6d9207715b31193f5f2a47c5cd77c543aa98 100644 (file)
@@ -32,8 +32,7 @@
 
     $PAGE->set_title($course->shortname .': '. $stractivityreport);
     $PAGE->set_heading($course->fullname);
-    $PAGE->navbar->add($strreports, null, null, navigation_node::TYPE_CUSTOM,
-                       new moodle_url($CFG->wwwroot.'/course/report.php', array('id'=>$course->id)));
+    $PAGE->navbar->add($strreports, new moodle_url($CFG->wwwroot.'/course/report.php', array('id'=>$course->id)));
     $PAGE->navbar->add($stractivityreport);
     echo $OUTPUT->header();
     echo $OUTPUT->heading(format_string($course->fullname));
index 970cf4554504606e5c930e1fb277c958486215a4..a9db751481dd6ea8c60645fc14830d537186e7e2 100644 (file)
@@ -51,8 +51,7 @@
 
     $PAGE->set_title($course->shortname .': '. $strparticipation);
     $PAGE->set_heading($course->fullname);
-    $PAGE->navbar->add($strreports, null, null, navigation_node::TYPE_CUSTOM,
-                       new moodle_url($CFG->wwwroot.'/course/report.php', array('id'=>$course->id)));
+    $PAGE->navbar->add($strreports, new moodle_url($CFG->wwwroot.'/course/report.php', array('id'=>$course->id)));
     $PAGE->navbar->add($strparticipation);
     echo $OUTPUT->header();
 
index 0bca1fd6294251fae915a3738cb4d0e17068bdf4..ae295bea95f0d3061115af89440c48c97a8a4d23 100644 (file)
@@ -86,8 +86,7 @@ if($csv) {
 
     $PAGE->set_title($strcompletion);
     $PAGE->set_heading($course->fullname);
-    $PAGE->navbar->add($strreports, null, null, navigation_node::TYPE_CUSTOM,
-                       new moodle_url($CFG->wwwroot.'/course/report.php', array('id'=>$course->id)));
+    $PAGE->navbar->add($strreports, new moodle_url($CFG->wwwroot.'/course/report.php', array('id'=>$course->id)));
     $PAGE->navbar->add($strcompletion);
     echo $OUTPUT->header();
 
index 48c66dd4643cc0803e14893a762cf1acb72aa231..fc7931f051bc9af91cf70d5f79826313f0065168 100644 (file)
@@ -53,8 +53,7 @@
         $PAGE->set_title("$course->shortname: $strstats");
         $PAGE->set_heading($course->fullname);
         $PAGE->set_headingmenu();
-        $PAGE->navbar->add($strreports, null, null, navigation_node::TYPE_CUSTOM,
-                           new moodle_url($CFG->wwwroot.'/course/report.php', array('id'=>$course->id)));
+        $PAGE->navbar->add($strreports, new moodle_url($CFG->wwwroot.'/course/report.php', array('id'=>$course->id)));
         $PAGE->navbar->add($strstats);
         echo $OUTPUT->header(report_stats_mode_menu($course, $mode, $time, "$CFG->wwwroot/course/report/stats/index.php"));
     }
index 8442064abf31d4d70f7acdd420e3a47f4ec61c6d..e161eecebeb73d846f8c0a62a85330b4788333d6 100644 (file)
@@ -95,7 +95,7 @@
     $strnovalidcourses = get_string('novalidcourses');
 
     if (empty($search) and empty($blocklist) and empty($modulelist)) {
-        $PAGE->navbar->add($strcourses, null, null, navigation_node::TYPE_CUSTOM, new moodle_url($CFG->wwwroot.'/course/index.php'));
+        $PAGE->navbar->add($strcourses, new moodle_url($CFG->wwwroot.'/course/index.php'));
         $PAGE->navbar->add($strsearch);
         $PAGE->set_title("$site->fullname : $strsearch");
         $PAGE->set_heading($site->fullname);
         }
     }
 
-    $PAGE->navbar->add($strcourses, null, null, navigation_node::TYPE_CUSTOM, new moodle_url($CFG->wwwroot.'/course/index.php'));
-    $PAGE->navbar->add($strsearch, null, null, navigation_node::TYPE_CUSTOM, new moodle_url($CFG->wwwroot.'/course/search.php'));
+    $PAGE->navbar->add($strcourses, new moodle_url($CFG->wwwroot.'/course/index.php'));
+    $PAGE->navbar->add($strsearch, new moodle_url($CFG->wwwroot.'/course/search.php'));
     if (!empty($search)) {
         $PAGE->navbar->add(s($search));
     }
index 127727b7fe5abc9e35e9777db22accc804325a54..b5172004d1c9e446672487bcc910cf7df811e227 100644 (file)
     if ($course->id != SITEID && has_capability('moodle/course:viewparticipants', $coursecontext)) {
         $link = new moodle_url($CFG->wwwroot.'/user/index.php', array('id'=>$course->id));
     }
-    $PAGE->navbar->add($strparticipants, null, null, navigation_node::TYPE_CUSTOM, $link);
-    $PAGE->navbar->add($fullname, null, null, navigation_node::TYPE_CUSTOM,
-                       new moodle_url($CFG->wwwroot.'/user/view.php', array('id'=>$user->id, 'course'=>$course->id)));
+    $PAGE->navbar->add($strparticipants, $link);
+    $PAGE->navbar->add($fullname, new moodle_url($CFG->wwwroot.'/user/view.php', array('id'=>$user->id, 'course'=>$course->id)));
     $PAGE->navbar->add($stractivityreport);
     $PAGE->navbar->add($strmode);
     $PAGE->set_title("$course->shortname: $stractivityreport ($mode)");
index 1119b4c4dc7e299a25ff9fe3a86f21af5505b766..d5d5e40799b66674e83f8846b6d58fa70f007d92 100644 (file)
@@ -461,6 +461,7 @@ function grade_report_user_settings_definition(&$mform) {
 }
 
 function grade_report_user_profilereport($course, $user) {
+    global $OUTPUT;
     if (!empty($course->showgrades)) {
 
         $context = get_context_instance(CONTEXT_COURSE, $course->id);
index 0ecc9133a9f70c35ea447c709a9ad6dcf4ae8704..8176b1d2bb27591c4a644063398d6217d496b1a9 100644 (file)
@@ -3640,7 +3640,7 @@ function build_navigation($extranavlinks, $cm = null) {
                 } else {
                     $link = null;
                 }
-                $PAGE->navbar->add($nav['name'],null, null, navbar::TYPE_CUSTOM, $link);
+                $PAGE->navbar->add($nav['name'],$link);
             }
         }
     }
index dd00b3109389a32ba114f743d4d474e7bd6b7926..ee13d52f05a2d1762c87bdbbed8f8b890ebe6bd9 100644 (file)
@@ -219,13 +219,13 @@ class navigation_node {
      * This function allows the user to add a child node to this node.
      *
      * @param string $text The text to display in the node
+     * @param string $action Either a moodle_url or a bit of html to use instead of the text <i>optional</i>
      * @param string|int $key Sets the key that can be used to retrieve this node <i>optional</i>
      * @param int $type The type of node should be one of the const types of navigation_node <i>optional</i>
-     * @param string $action Either a moodle_url or a bit of html to use instead of the text <i>optional</i>
      * @param string $icon The path to an icon to use for this node <i>optional</i>
      * @return string The key that was used for this node
      */
-    public function add($text, $shorttext=null, $key=null, $type=null, $action=null, $icon=null) {
+    public function add($text, $action=null, $shorttext=null, $key=null, $type=null, $icon=null) {
         if ($this->nodetype !== self::NODETYPE_BRANCH) {
             $this->nodetype = self::NODETYPE_BRANCH;
         }
@@ -272,7 +272,7 @@ class navigation_node {
      */
     public function add_to_path($patharray, $key=null, $text=null, $shorttext=null, $type=null, $action=null, $icon=null) {
         if (count($patharray)==0) {
-            $key = $this->add($text, $shorttext, $key, $type, $action, $icon);
+            $key = $this->add($text, $action, $shorttext, $key, $type, $icon);
             return $key;
         } else {
             $pathkey = array_shift($patharray);
@@ -1064,7 +1064,7 @@ class global_navigation extends navigation_node {
         $depth += $this->load_course($keys);
         $depth += $this->load_course_activities($keys);
         $depth += $this->load_course_sections($keys);
-        $depth += $this->load_section_activities($keys,$section->section);
+        $depth += $this->load_section_activities($keys,$sectionnum);
         $depth += $this->load_activity($keys);
         return $depth;
     }
@@ -1166,7 +1166,7 @@ class global_navigation extends navigation_node {
                     $category = $this->find_child($categoryid);
                 }
                 if ($category!==false) {
-                    $coursekey = $category->add($course->fullname, $course->shortname, $course->id, self::TYPE_COURSE, $url, $OUTPUT->old_icon_url('i/course'));
+                    $coursekey = $category->add($course->fullname, $url, $course->shortname, $course->id, self::TYPE_COURSE, $OUTPUT->old_icon_url('i/course'));
                     if (!$course->visible) {
                         $category->get($course->id)->hidden = true;
                     }
@@ -1755,7 +1755,7 @@ class limited_global_navigation extends global_navigation {
         }
         $this->context = get_context_instance(CONTEXT_COURSE, $course->id);
 
-        $key = $this->add($module->name, null, $instanceid, self::TYPE_ACTIVITY);
+        $key = $this->add($module->name, null, null, $instanceid, self::TYPE_ACTIVITY);
 
         $file = $CFG->dirroot.'/mod/'.$module->name.'/lib.php';
         $function = $module->name.'_extend_navigation';
@@ -1946,11 +1946,11 @@ class navbar extends navigation_node {
      * @param string $icon
      * @return string|int Identifier for this particular node
      */
-    public function add($text, $shorttext=null, $key=null, $type=self::TYPE_CUSTOM, $action=null, $icon=null) {
+    public function add($text, $action=null, $shorttext=null, $key=null, $type=self::TYPE_CUSTOM, $icon=null) {
         // Check if there are any keys in the objects keys array
         if (count($this->keys)===0) {
             // If there are no keys then we can use the add method
-            $key = parent::add($text, $shorttext, $key, $type, $action, $icon);
+            $key = parent::add($text, $action, $shorttext, $key, $type, $icon);
         } else {
             $key = $this->add_to_path($this->keys, $key, $text, $shorttext, $type, $action, $icon);
         }
@@ -2069,7 +2069,7 @@ class settings_navigation extends navigation_node {
             $realuser = session_get_realuser();
             // Add the informative return to original user link
             $url = new moodle_url($CFG->wwwroot.'/course/loginas.php',array('id'=>$this->page->course->id, 'return'=>1,'sesskey'=>sesskey()));
-            $this->add(get_string('returntooriginaluser', 'moodle', fullname($realuser, true)), null, null, self::TYPE_SETTING, $url, $OUTPUT->old_icon_url('t/left'));
+            $this->add(get_string('returntooriginaluser', 'moodle', fullname($realuser, true)), $url, null, null, self::TYPE_SETTING, $OUTPUT->old_icon_url('t/left'));
         }
 
         // Make sure the first child doesnt have proceed with hr set to true
@@ -2087,15 +2087,15 @@ class settings_navigation extends navigation_node {
      * and then proceeds to use the key to set class and hr 
      *
      * @param string $text
+     * @param sting|moodle_url $url
      * @param string $shorttext
      * @param string|int $key
      * @param int $type
-     * @param sting|moodle_url $url
      * @param string $icon
      * @return sting|int A key that can be used to reference the newly added node
      */
-    public function add($text, $shorttext=null, $key=null, $type=null, $url=null, $icon=null) {
-        $key = parent::add($text, $shorttext, $key, $type, $url, $icon);
+    public function add($text, $url=null, $shorttext=null, $key=null, $type=null, $icon=null) {
+        $key = parent::add($text, $url, $shorttext, $key, $type, $icon);
         $this->get($key)->add_class('root_node');
         $this->get($key)->preceedwithhr = true;
         return $key;
@@ -2122,7 +2122,7 @@ class settings_navigation extends navigation_node {
                     require_once($CFG->dirroot.'/lib/adminlib.php');
                 }
                 $adminroot = admin_get_root();
-                $branchkey = $this->add(get_string('administrationsite'),null, null, self::TYPE_SETTING);
+                $branchkey = $this->add(get_string('administrationsite'),null, null, null, self::TYPE_SETTING);
                 $referencebranch = $this->get($branchkey);
                 foreach ($adminroot->children as $adminbranch) {
                     $this->load_administration_settings($referencebranch, $adminbranch);
@@ -2151,7 +2151,7 @@ class settings_navigation extends navigation_node {
             }
 
             // Add the branch
-            $branchkey = $referencebranch->add($adminbranch->visiblename, null, null, self::TYPE_SETTING, $url, $icon);
+            $branchkey = $referencebranch->add($adminbranch->visiblename, $url, null, null, self::TYPE_SETTING, $icon);
             $reference = $referencebranch->get($branchkey);
             // Check if we are generating the admin notifications and whether notificiations exist
             if ($adminbranch->name === 'adminnotifications' && admin_critical_warnings_present()) {
@@ -2255,7 +2255,7 @@ class settings_navigation extends navigation_node {
 
         $coursenode = $this->page->navigation->find_child($course->id, global_navigation::TYPE_COURSE);
         
-        $coursenodekey = $this->add(get_string('courseadministration'), null, null, $coursenode->type);
+        $coursenodekey = $this->add(get_string('courseadministration'), null, null, null, $coursenode->type);
         $coursenode = $this->get($coursenodekey);
         
         if (has_capability('moodle/course:update', $course->context)) {
@@ -2268,7 +2268,7 @@ class settings_navigation extends navigation_node {
                 $url->param('edit', 'on');
                 $editstring = get_string('turneditingon');
             }
-            $coursenode->add($editstring, null, null, self::TYPE_SETTING, $url, $OUTPUT->old_icon_url('i/edit'));
+            $coursenode->add($editstring, $url, null, null, self::TYPE_SETTING, $OUTPUT->old_icon_url('i/edit'));
 
 
             if ($this->page->user_is_editing()) {
@@ -2306,11 +2306,11 @@ class settings_navigation extends navigation_node {
                     }
                     $sectionurl = new moodle_url($CFG->wwwroot.'/course/view.php', array('id'=>$course->id, $formatstring=>$section->section));
                     if ($section->section == 0) {
-                        $sectionresources = $addresource->add(get_string('course'), null, null, self::TYPE_SETTING, $sectionurl);
-                        $sectionactivities = $addactivity->add(get_string('course'), null, null, self::TYPE_SETTING, $sectionurl);
+                        $sectionresources = $addresource->add(get_string('course'), $sectionurl, null, null, self::TYPE_SETTING);
+                        $sectionactivities = $addactivity->add(get_string('course'), $sectionurl, null, null, self::TYPE_SETTING);
                     } else {
-                        $sectionresources = $addresource->add($formatstring.' '.$section->section, null, null, self::TYPE_SETTING, $sectionurl);
-                        $sectionactivities = $addactivity->add($formatstring.' '.$section->section, null, null, self::TYPE_SETTING, $sectionurl);
+                        $sectionresources = $addresource->add($formatstring.' '.$section->section, $sectionurl, null, null, self::TYPE_SETTING);
+                        $sectionactivities = $addactivity->add($formatstring.' '.$section->section, $sectionurl, null, null, self::TYPE_SETTING);
                     }
                     foreach ($resources as $value=>$resource) {
                         $url = new moodle_url($CFG->wwwroot.'/course/mod.php', array('id'=>$course->id, 'sesskey'=>sesskey(), 'section'=>$section->section));
@@ -2321,7 +2321,7 @@ class settings_navigation extends navigation_node {
                         } else {
                             $url->param('add', $value);
                         }
-                        $addresource->get($sectionresources)->add($resource, null, null, self::TYPE_SETTING, $url);
+                        $addresource->get($sectionresources)->add($resource, $url, null, null, self::TYPE_SETTING);
                     }
                     $subbranch = false;
                     foreach ($activities as $activityname=>$activity) {
@@ -2342,9 +2342,9 @@ class settings_navigation extends navigation_node {
                             $url->param('add', $activityname);
                         }
                         if ($subbranch !== false) {
-                            $addactivity->get($sectionactivities)->get($subbranch)->add($activity, null, null, self::TYPE_SETTING, $url);
+                            $addactivity->get($sectionactivities)->get($subbranch)->add($activity, $url, null, null, self::TYPE_SETTING);
                         } else {
-                            $addactivity->get($sectionactivities)->add($activity, null, null, self::TYPE_SETTING, $url);
+                            $addactivity->get($sectionactivities)->add($activity, $url, null, null, self::TYPE_SETTING);
                         }
                     }
                 }
@@ -2352,16 +2352,16 @@ class settings_navigation extends navigation_node {
 
             // Add the course settings link
             $url = new moodle_url($CFG->wwwroot.'/course/edit.php', array('id'=>$course->id));
-            $coursenode->add(get_string('settings'), null, null, self::TYPE_SETTING, $url, $OUTPUT->old_icon_url('i/settings'));
+            $coursenode->add(get_string('settings'), $url, null, null, self::TYPE_SETTING, $OUTPUT->old_icon_url('i/settings'));
         }
         
         // Add assign or override roles if allowed
         if (has_capability('moodle/role:assign', $course->context)) {
             $url = new moodle_url($CFG->wwwroot.'/'.$CFG->admin.'/roles/assign.php', array('contextid'=>$course->context->id));
-            $coursenode->add(get_string('assignroles', 'role'), null, null, self::TYPE_SETTING, $url, $OUTPUT->old_icon_url('i/roles'));
+            $coursenode->add(get_string('assignroles', 'role'), $url, null, null, self::TYPE_SETTING, $OUTPUT->old_icon_url('i/roles'));
         } else if (get_overridable_roles($course->context, ROLENAME_ORIGINAL)) {
             $url = new moodle_url($CFG->wwwroot.'/'.$CFG->admin.'/roles/override.php', array('contextid'=>$course->context->id));
-            $coursenode->add(get_string('overridepermissions', 'role'), null, null, self::TYPE_SETTING, $url, $OUTPUT->old_icon_url('i/roles'));
+            $coursenode->add(get_string('overridepermissions', 'role'), $url, null, null, self::TYPE_SETTING, $OUTPUT->old_icon_url('i/roles'));
         }
 
         // Add view grade report is permitted
@@ -2383,22 +2383,22 @@ class settings_navigation extends navigation_node {
         }
         if ($reportavailable) {
             $url = new moodle_url($CFG->wwwroot.'/grade/report/index.php', array('id'=>$course->id));
-            $coursenode->add(get_string('grades'), null, null, self::TYPE_SETTING, $url, $OUTPUT->old_icon_url('i/grades'));
+            $coursenode->add(get_string('grades'), $url, null, null, self::TYPE_SETTING, $OUTPUT->old_icon_url('i/grades'));
         }
 
         //  Add outcome if permitted
         if (!empty($CFG->enableoutcomes) && has_capability('moodle/course:update', $course->context)) {
             $url = new moodle_url($CFG->wwwroot.'/grade/edit/outcome/course.php', array('id'=>$course->id));
-            $coursenode->add(get_string('outcomes', 'grades'), null, null, self::TYPE_SETTING, $url, $OUTPUT->old_icon_url('i/outcomes'));
+            $coursenode->add(get_string('outcomes', 'grades'), $url, null, null, self::TYPE_SETTING, $OUTPUT->old_icon_url('i/outcomes'));
         }
 
         // Add meta course links
         if ($course->metacourse) {
             if (has_capability('moodle/course:managemetacourse', $course->context)) {
                 $url = new moodle_url($CFG->wwwroot.'/course/importstudents.php', array('id'=>$course->id));
-                $coursenode->add(get_string('childcourses'), null, null, self::TYPE_SETTING, $url, $OUTPUT->old_icon_url('i/course'));
+                $coursenode->add(get_string('childcourses'), $url, null, null, self::TYPE_SETTING, $OUTPUT->old_icon_url('i/course'));
             } else if (has_capability('moodle/role:assign', $course->context)) {
-                $key = $coursenode->add(get_string('childcourses'), null, null, self::TYPE_SETTING, null, $OUTPUT->old_icon_url('i/course'));
+                $key = $coursenode->add(get_string('childcourses'), null, null, null, self::TYPE_SETTING, $OUTPUT->old_icon_url('i/course'));
                 $coursenode->get($key)->hidden = true;;
             }
         }
@@ -2406,43 +2406,43 @@ class settings_navigation extends navigation_node {
         // Manage groups in this course
         if (($course->groupmode || !$course->groupmodeforce) && has_capability('moodle/course:managegroups', $course->context)) {
             $url = new moodle_url($CFG->wwwroot.'/group/index.php', array('id'=>$course->id));
-            $coursenode->add(get_string('groups'), null, null, self::TYPE_SETTING, $url, $OUTPUT->old_icon_url('i/group'));
+            $coursenode->add(get_string('groups'), $url, null, null, self::TYPE_SETTING, $OUTPUT->old_icon_url('i/group'));
         }
 
         //Participants
         if (has_capability('moodle/course:viewparticipants', $course->context)) {
             $url = new moodle_url($CFG->wwwroot.'/user/index.php?contextid='.$course->context->id);
-            $coursenode->add(get_string('participants'), null, null, self::TYPE_SETTING, $url, $OUTPUT->old_icon_url('i/users'));
+            $coursenode->add(get_string('participants'), $url, null, null, self::TYPE_SETTING, $OUTPUT->old_icon_url('i/users'));
         }
 
         // Backup this course
         if (has_capability('moodle/site:backup', $course->context)) {
             $url = new moodle_url($CFG->wwwroot.'/backup/backup.php', array('id'=>$course->id));
-            $coursenode->add(get_string('backup'), null, null, self::TYPE_SETTING, $url, $OUTPUT->old_icon_url('i/backup'));
+            $coursenode->add(get_string('backup'), $url, null, null, self::TYPE_SETTING, $OUTPUT->old_icon_url('i/backup'));
         }
 
         // Restore to this course
         if (has_capability('moodle/site:restore', $course->context)) {
             $url = new moodle_url($CFG->wwwroot.'/files/index.php', array('id'=>$course->id, 'wdir'=>'/backupdata'));
-            $coursenode->add(get_string('restore'), null, null, self::TYPE_SETTING, $url, $OUTPUT->old_icon_url('i/restore'));
+            $coursenode->add(get_string('restore'), $url, null, null, self::TYPE_SETTING, $OUTPUT->old_icon_url('i/restore'));
         }
 
         // Import data from other courses
         if (has_capability('moodle/site:import', $course->context)) {
             $url = new moodle_url($CFG->wwwroot.'/course/import.php', array('id'=>$course->id));
-            $coursenode->add(get_string('import'), null, null, self::TYPE_SETTING, $url, $OUTPUT->old_icon_url('i/restore'));
+            $coursenode->add(get_string('import'), $url, null, null, self::TYPE_SETTING, $OUTPUT->old_icon_url('i/restore'));
         }
 
         // Reset this course
         if (has_capability('moodle/course:reset', $course->context)) {
             $url = new moodle_url($CFG->wwwroot.'/course/reset.php', array('id'=>$course->id));
-            $coursenode->add(get_string('reset'), null, null, self::TYPE_SETTING, $url, $OUTPUT->old_icon_url('i/return'));
+            $coursenode->add(get_string('reset'), $url, null, null, self::TYPE_SETTING, $OUTPUT->old_icon_url('i/return'));
         }
         
         // View course reports
         if (has_capability('moodle/site:viewreports', $course->context)) { // basic capability for listing of reports
             $url = new moodle_url($CFG->wwwroot.'/course/report.php', array('id'=>$course->id));
-            $coursenode->add(get_string('reports'), null, null, self::TYPE_SETTING, $url, $OUTPUT->old_icon_url('i/stats'));
+            $coursenode->add(get_string('reports'), $url, null, null, self::TYPE_SETTING, $OUTPUT->old_icon_url('i/stats'));
         }
 
         // Manage questions
@@ -2460,7 +2460,7 @@ class settings_navigation extends navigation_node {
         }
         if (isset($questionlink)) {
             $url = new moodle_url($questionlink, array('courseid'=>$course->id));
-            $coursenode->add(get_string('questions','quiz'), null, null, self::TYPE_SETTING, $url, $OUTPUT->old_icon_url('i/questions'));
+            $coursenode->add(get_string('questions','quiz'), $url, null, null, self::TYPE_SETTING, $OUTPUT->old_icon_url('i/questions'));
         }
 
         // Repository Instances
@@ -2468,25 +2468,25 @@ class settings_navigation extends navigation_node {
         $editabletypes = repository::get_editable_types($this->context);
         if (has_capability('moodle/course:update', $this->context) && !empty($editabletypes)) {
             $url = new moodle_url($CFG->wwwroot.'/repository/manage_instances.php', array('contextid'=>$this->context->id));
-            $coursenode->add(get_string('repositories'), null, null, self::TYPE_SETTING, $url, $OUTPUT->old_icon_url('i/repository'));
+            $coursenode->add(get_string('repositories'), $url, null, null, self::TYPE_SETTING, $OUTPUT->old_icon_url('i/repository'));
         }
 
         // Manage files
         if (has_capability('moodle/course:managefiles', $this->context)) {
             $url = new moodle_url($CFG->wwwroot.'/files/index.php', array('id'=>$course->id));
-            $coursenode->add(get_string('files'), null, null, self::TYPE_SETTING, $url, $OUTPUT->old_icon_url('i/files'));
+            $coursenode->add(get_string('files'), $url, null, null, self::TYPE_SETTING, $OUTPUT->old_icon_url('i/files'));
         }
 
         // Authorize hooks
         if ($course->enrol == 'authorize' || (empty($course->enrol) && $CFG->enrol == 'authorize')) {
             require_once($CFG->dirroot.'/enrol/authorize/const.php');
             $url = new moodle_url($CFG->wwwroot.'/enrol/authorize/index.php', array('course'=>$course->id));
-            $coursenode->add(get_string('payments'), null, null, self::TYPE_SETTING, $url, $OUTPUT->old_icon_url('i/payment'));
+            $coursenode->add(get_string('payments'), $url, null, null, self::TYPE_SETTING, $OUTPUT->old_icon_url('i/payment'));
             if (has_capability('enrol/authorize:managepayments', $this->page->context)) {
                 $cnt = $DB->count_records('enrol_authorize', array('status'=>AN_STATUS_AUTH, 'courseid'=>$course->id));
                 if ($cnt) {
                     $url = new moodle_url($CFG->wwwroot.'/enrol/authorize/index.php', array('course'=>$course->id,'status'=>AN_STATUS_AUTH));
-                    $coursenode->add(get_string('paymentpending', 'moodle', $cnt), null, null, self::TYPE_SETTING, $url, $OUTPUT->old_icon_url('i/payment'));
+                    $coursenode->add(get_string('paymentpending', 'moodle', $cnt), $url, null, null, self::TYPE_SETTING, $OUTPUT->old_icon_url('i/payment'));
                 }
             }
         }
@@ -2495,17 +2495,17 @@ class settings_navigation extends navigation_node {
         if (empty($course->metacourse)) {
             if (has_capability('moodle/legacy:guest', $this->context, NULL, false)) {   // Are a guest now
                 $url = new moodle_url($CFG->wwwroot.'/course/enrol.php', array('id'=>$course->id));
-                $coursenode->add(get_string('enrolme', '', format_string($course->shortname)), null, null, self::TYPE_SETTING, $url, $OUTPUT->old_icon_url('i/user'));
+                $coursenode->add(get_string('enrolme', '', format_string($course->shortname)), $url, null, null, self::TYPE_SETTING, $OUTPUT->old_icon_url('i/user'));
             } else if (has_capability('moodle/role:unassignself', $this->context, NULL, false) && get_user_roles($this->context, 0, false)) {  // Have some role
                 $url = new moodle_url($CFG->wwwroot.'/course/unenrol.php', array('id'=>$course->id));
-                $coursenode->add(get_string('unenrolme', '', format_string($course->shortname)), null, null, self::TYPE_SETTING, $url, $OUTPUT->old_icon_url('i/user'));
+                $coursenode->add(get_string('unenrolme', '', format_string($course->shortname)), $url, null, null, self::TYPE_SETTING, $OUTPUT->old_icon_url('i/user'));
             }
         }
 
         // Link to the user own profile (except guests)
         if (!isguestuser() and isloggedin()) {
             $url = new moodle_url($CFG->wwwroot.'/user/view.php', array('id'=>$USER->id, 'course'=>$course->id));
-            $coursenode->add(get_string('profile'), null, null, self::TYPE_SETTING, $url, $OUTPUT->old_icon_url('i/user'));
+            $coursenode->add(get_string('profile'), $url, null, null, self::TYPE_SETTING, $OUTPUT->old_icon_url('i/user'));
         }
 
         // Switch roles
@@ -2535,7 +2535,7 @@ class settings_navigation extends navigation_node {
             $SESSION->returnurl = serialize($returnurl);
             foreach ($roles as $key=>$name) {
                 $url = new moodle_url($CFG->wwwroot.'/course/switchrole.php', array('id'=>$course->id,'sesskey'=>sesskey(), 'switchrole'=>$key, 'returnurl'=>'1'));
-                $this->get($switchroleskey)->add($name, null, $key, self::TYPE_SETTING, $url, $OUTPUT->old_icon_url('i/roles'));
+                $this->get($switchroleskey)->add($name, $url, null, $key, self::TYPE_SETTING, $OUTPUT->old_icon_url('i/roles'));
             }
         }
         // Return we are done
@@ -2675,19 +2675,19 @@ class settings_navigation extends navigation_node {
         if ($user->deleted) {
             if (!has_capability('moodle/user:update', $coursecontext)) {
                 // We can't edit the user so just show the user deleted message
-                $usersetting->add(get_string('userdeleted'), null, null, self::TYPE_SETTING);
+                $usersetting->add(get_string('userdeleted'), null, null, null, self::TYPE_SETTING);
             } else {
                 // We can edit the user so show the user deleted message and link it to the profile
-                $usersetting->add(get_string('userdeleted'), null, null, self::TYPE_SETTING, $profileurl);
+                $usersetting->add(get_string('userdeleted'), $profileurl, null, null, self::TYPE_SETTING);
             }
             return true;
         }
 
         // Add a link to view the user profile
         if ($currentuser) {
-            $usersetting->add(get_string('viewmyprofile'), null, null, self::TYPE_SETTING, $profileurl);
+            $usersetting->add(get_string('viewmyprofile'), $profileurl, null, null, self::TYPE_SETTING);
         } else {
-            $usersetting->add(get_string('userprofilefor','',$fullname), null, null, self::TYPE_SETTING, $profileurl);
+            $usersetting->add(get_string('userprofilefor','',$fullname), $profileurl, null, null, self::TYPE_SETTING);
         }
 
         // Add the profile edit link
@@ -2699,7 +2699,7 @@ class settings_navigation extends navigation_node {
                 $url = new moodle_url($CFG->wwwroot.'/user/edit.php', array('id'=>$user->id, 'course'=>$course->id));
             }
             if ($url!==false) {
-                $usersetting->add(get_string('editmyprofile'), null, null, self::TYPE_SETTING, $url);
+                $usersetting->add(get_string('editmyprofile'), $url, null, null, self::TYPE_SETTING);
             }
         }
 
@@ -2725,41 +2725,41 @@ class settings_navigation extends navigation_node {
                     }
                 }
                 $passwordchangeurl->param('id', $course->id);
-                $usersetting->add(get_string("changepassword"), null, null, self::TYPE_SETTING, $passwordchangeurl);
+                $usersetting->add(get_string("changepassword"), $passwordchangeurl, null, null, self::TYPE_SETTING);
             }
         }
 
         // View the roles settings
         if (has_any_capability(array('moodle/role:assign', 'moodle/role:safeoverride','moodle/role:override', 'moodle/role:manage'), $usercontext)) {
-            $roleskey = $usersetting->add(get_string('roles'), null, null, self::TYPE_SETTING);
+            $roleskey = $usersetting->add(get_string('roles'), null, null, null, self::TYPE_SETTING);
 
             $url = new moodle_url($CFG->wwwroot.'/'.$CFG->admin.'/roles/usersroles.php', array('userid'=>$user->id, 'courseid'=>$course->id));
-            $usersetting->get($roleskey)->add(get_string('thisusersroles', 'role'), null, null, self::TYPE_SETTING, $url);
+            $usersetting->get($roleskey)->add(get_string('thisusersroles', 'role'), $url, null, null, self::TYPE_SETTING);
 
             $assignableroles = get_assignable_roles($usercontext, ROLENAME_BOTH);
             $overridableroles = get_overridable_roles($usercontext, ROLENAME_BOTH);
 
             if (!empty($assignableroles)) {
                 $url = new moodle_url($CFG->wwwroot.'/'.$CFG->admin.'/roles/assign.php', array('contextid'=>$usercontext->id,'userid'=>$user->id, 'courseid'=>$course->id));
-                $usersetting->get($roleskey)->add(get_string('assignrolesrelativetothisuser', 'role'), null, null, self::TYPE_SETTING, $url);
+                $usersetting->get($roleskey)->add(get_string('assignrolesrelativetothisuser', 'role'), $url, null, null, self::TYPE_SETTING);
             }
 
             if (!empty($overridableroles)) {
                 $url = new moodle_url($CFG->wwwroot.'/'.$CFG->admin.'/roles/override.php', array('contextid'=>$usercontext->id,'userid'=>$user->id, 'courseid'=>$course->id));
-                $usersetting->get($roleskey)->add(get_string('overridepermissions', 'role'), null, null, self::TYPE_SETTING, $url);
+                $usersetting->get($roleskey)->add(get_string('overridepermissions', 'role'), $url, null, null, self::TYPE_SETTING);
             }
 
             $url = new moodle_url($CFG->wwwroot.'/'.$CFG->admin.'/roles/check.php', array('contextid'=>$usercontext->id,'userid'=>$user->id, 'courseid'=>$course->id));
-            $usersetting->get($roleskey)->add(get_string('checkpermissions', 'role'), null, null, self::TYPE_SETTING, $url);
+            $usersetting->get($roleskey)->add(get_string('checkpermissions', 'role'), $url, null, null, self::TYPE_SETTING);
         }
 
         // Portfolio
         if (empty($userindexpage) && $currentuser && !empty($CFG->enableportfolios) && has_capability('moodle/portfolio:export', $systemcontext) && portfolio_instances(true, false)) {
-            $portfoliokey = $usersetting->add(get_string('portfolios', 'portfolio'), null, null, self::TYPE_SETTING);
+            $portfoliokey = $usersetting->add(get_string('portfolios', 'portfolio'), null, null, null, self::TYPE_SETTING);
             $url = new moodle_url($CFG->wwwroot .'/user/portfolio.php');
-            $usersetting->get($portfoliokey)->add(get_string('configure', 'portfolio'), null, null, self::TYPE_SETTING, $url);
+            $usersetting->get($portfoliokey)->add(get_string('configure', 'portfolio'), $url, null, null, self::TYPE_SETTING);
             $url = new moodle_url($CFG->wwwroot .'/user/portfoliologs.php');
-            $usersetting->get($portfoliokey)->add(get_string('logs', 'portfolio'), null, null, self::TYPE_SETTING, $url);
+            $usersetting->get($portfoliokey)->add(get_string('logs', 'portfolio'), $url, null, null, self::TYPE_SETTING);
         }
 
         // Repository
@@ -2768,14 +2768,14 @@ class settings_navigation extends navigation_node {
             $editabletypes = repository::get_editable_types($usercontext);
             if ($usercontext->contextlevel == CONTEXT_USER && !empty($editabletypes)) {
                 $url = new moodle_url($CFG->wwwroot .'/repository/manage_instances.php', array('contextid'=>$usercontext->id));
-                $usersetting->add(get_string('repositories', 'repository'), null, null, self::TYPE_SETTING, $url);
+                $usersetting->add(get_string('repositories', 'repository'), $url, null, null, self::TYPE_SETTING);
             }
         }
 
         // Messaging
         if (empty($userindexpage) && has_capability('moodle/user:editownmessageprofile', $systemcontext)) {
             $url = new moodle_url($CFG->wwwroot.'/message/edit.php', array('id'=>$user->id, 'course'=>$course->id));
-            $usersetting->add(get_string('editmymessage', 'message'), null, null, self::TYPE_SETTING, $url);
+            $usersetting->add(get_string('editmymessage', 'message'), $url, null, null, self::TYPE_SETTING);
         }
 
         return $usersettingskey;
@@ -2831,11 +2831,11 @@ class settings_navigation extends navigation_node {
                 $url->param('edit', 'on');
                 $editstring = get_string('turneditingon');
             }
-            $this->get($frontpage)->add($editstring, null, null, self::TYPE_SETTING, $url, $OUTPUT->old_icon_url('i/edit'));
+            $this->get($frontpage)->add($editstring, $url, null, null, self::TYPE_SETTING, $OUTPUT->old_icon_url('i/edit'));
 
             // Add the course settings link
             $url = new moodle_url($CFG->wwwroot.'/admin/settings.php', array('section'=>'frontpagesettings'));
-            $this->get($frontpage)->add(get_string('settings'), null, null, self::TYPE_SETTING, $url, $OUTPUT->old_icon_url('i/settings'));
+            $this->get($frontpage)->add(get_string('settings'), $url, null, null, self::TYPE_SETTING, $OUTPUT->old_icon_url('i/settings'));
         }
     }
 
index f4d1b2e54c0cb194c41aa737b0319313bf8eb73c..0b6e9ccef65f1174d528fa2eb947552120508ca5 100644 (file)
@@ -1624,7 +1624,7 @@ class page_generic_activity extends page_base {
                     if (array_key_exists('link', $navitem)) {
                         $link = $navitem['link'];
                     }
-                    $PAGE->navbar->add($navitem['name'], null, null, navigation_node::TYPE_CUSTOM, $link);
+                    $PAGE->navbar->add($navitem['name'], $link);
                 }
             }
         }
@@ -1632,7 +1632,7 @@ class page_generic_activity extends page_base {
         $PAGE->set_title($title);
         $PAGE->set_heading($this->course->fullname);
         $PAGE->set_button($buttons);
-        echo $OUTPUT->heading();
+        echo $OUTPUT->header();
     }
 }
 
index a8a322ff1d7c7e5dd716e0162b34611ea5092030..9ade008ce121878ddafa81aac25c13ec0ec513ee 100644 (file)
@@ -40,18 +40,18 @@ class navigation_node_test extends UnitTestCase {
         $FULLME = 'http://www.moodle.org/test.php';
         $this->node = new navigation_node('Test Node');
         $this->node->type = navigation_node::TYPE_SYSTEM;
-        $this->node->add('demo1', null, 'demo1', navigation_node::TYPE_COURSE, 'http://www.moodle.org/',$CFG->httpswwwroot . '/pix/i/course.gif');
-        $this->node->add('demo2', null, 'demo2', navigation_node::TYPE_COURSE, 'http://www.moodle.com/',$CFG->httpswwwroot . '/pix/i/course.gif');
-        $this->node->add('demo3', null, 'demo3', navigation_node::TYPE_CATEGORY, 'http://www.moodle.org/',$CFG->httpswwwroot . '/pix/i/course.gif');
-        $this->node->get('demo3')->add('demo4', null, 'demo4', navigation_node::TYPE_COURSE, new moodle_url('http://www.moodle.org/'),$CFG->httpswwwroot . '/pix/i/course.gif');
-        $this->node->get('demo3')->add('demo5', null, 'demo5', navigation_node::TYPE_COURSE, 'http://www.moodle.org/test.php',$CFG->httpswwwroot . '/pix/i/course.gif');
+        $this->node->add('demo1', 'http://www.moodle.org/',$CFG->httpswwwroot . '/pix/i/course.gif', null, 'demo1', navigation_node::TYPE_COURSE);
+        $this->node->add('demo2', 'http://www.moodle.com/',$CFG->httpswwwroot . '/pix/i/course.gif', null, 'demo2', navigation_node::TYPE_COURSE);
+        $this->node->add('demo3', 'http://www.moodle.org/',$CFG->httpswwwroot . '/pix/i/course.gif', null, 'demo3', navigation_node::TYPE_CATEGORY);
+        $this->node->get('demo3')->add('demo4', new moodle_url('http://www.moodle.org/'), null, 'demo4', navigation_node::TYPE_COURSE, $CFG->httpswwwroot . '/pix/i/course.gif');
+        $this->node->get('demo3')->add('demo5', 'http://www.moodle.org/test.php', null, 'demo5', navigation_node::TYPE_COURSE,$CFG->httpswwwroot . '/pix/i/course.gif');
         $this->node->get('demo3')->get('demo5')->make_active();
-        $this->node->get('demo3')->get('demo5')->add('activity1', null, 'activity1',navigation_node::TYPE_ACTIVITY);
+        $this->node->get('demo3')->get('demo5')->add('activity1', null, null, 'activity1',navigation_node::TYPE_ACTIVITY);
         $this->node->get('demo3')->get('demo5')->get('activity1')->make_active();
-        $this->node->add('hiddendemo1', null, 'hiddendemo1', navigation_node::TYPE_CATEGORY, 'http://www.moodle.org/',$CFG->httpswwwroot . '/pix/i/course.gif');
+        $this->node->add('hiddendemo1', 'http://www.moodle.org/', null, 'hiddendemo1', navigation_node::TYPE_CATEGORY,$CFG->httpswwwroot . '/pix/i/course.gif');
         $this->node->get('hiddendemo1')->hidden = true;
-        $this->node->get('hiddendemo1')->add('hiddendemo2', null, 'hiddendemo2', navigation_node::TYPE_COURSE, new moodle_url('http://www.moodle.org/'),$CFG->httpswwwroot . '/pix/i/course.gif');
-        $this->node->get('hiddendemo1')->add('hiddendemo3', null, 'hiddendemo3', navigation_node::TYPE_COURSE, new moodle_url('http://www.moodle.org/'),$CFG->httpswwwroot . '/pix/i/course.gif');
+        $this->node->get('hiddendemo1')->add('hiddendemo2', new moodle_url('http://www.moodle.org/'),null, 'hiddendemo2', navigation_node::TYPE_COURSE, $CFG->httpswwwroot . '/pix/i/course.gif');
+        $this->node->get('hiddendemo1')->add('hiddendemo3', new moodle_url('http://www.moodle.org/'),null, 'hiddendemo3', navigation_node::TYPE_COURSE, $CFG->httpswwwroot . '/pix/i/course.gif');
         $this->node->get('hiddendemo1')->get('hiddendemo2')->helpbutton = 'Here is a help button';
         $this->node->get('hiddendemo1')->get('hiddendemo3')->display = false;
         $FULLME = $oldfullme;
@@ -77,9 +77,9 @@ class navigation_node_test extends UnitTestCase {
     public function test_add() {
         global $CFG;
         // Add a node with all args set
-        $key1 = $this->node->add('test_add_1','testadd1','key',navigation_node::TYPE_COURSE,'http://www.moodle.org/',$CFG->httpswwwroot . '/pix/i/course.gif');
+        $key1 = $this->node->add('test_add_1','http://www.moodle.org/','testadd1','key',navigation_node::TYPE_COURSE,$CFG->httpswwwroot . '/pix/i/course.gif');
         // Add a node with the minimum args required
-        $key2 = $this->node->add('test_add_2','testadd2');
+        $key2 = $this->node->add('test_add_2',null, 'testadd2');
         $key3 = $this->node->add(str_repeat('moodle ', 15),str_repeat('moodle', 15));
         $this->assertEqual('key',$key1);
         $this->assertEqual($key2, $this->node->get($key2)->key);
@@ -102,7 +102,7 @@ class navigation_node_test extends UnitTestCase {
     public function test_add_to_path() {
         global $CFG;
         $path = array('demo3','demo5');
-        $key1 = $this->node->add_to_path($path, 'testatp1', 'Test add to path 1', 'testatp1',  navigation_node::TYPE_COURSE, 'http://www.moodle.org/',$CFG->httpswwwroot . '/pix/i/course.gif');
+        $key1 = $this->node->add_to_path($path, 'http://www.moodle.org/','testatp1', 'Test add to path 1', 'testatp1',  navigation_node::TYPE_COURSE, $CFG->httpswwwroot . '/pix/i/course.gif');
         $this->assertEqual($key1, 'testatp1');
 
         // This should generate an exception as we have not provided any text for
@@ -248,8 +248,8 @@ class navigation_node_test extends UnitTestCase {
 
     public function test_make_active() {
         global $CFG;
-        $key1 = $this->node->add('active node 1', null, 'anode1');
-        $key2 = $this->node->add('active node 2', null, 'anode2', navigation_node::TYPE_COURSE, new moodle_url($CFG->wwwroot));
+        $key1 = $this->node->add('active node 1', null, null, 'anode1');
+        $key2 = $this->node->add('active node 2', new moodle_url($CFG->wwwroot), null, 'anode2', navigation_node::TYPE_COURSE);
         $this->node->get($key1)->make_active();
         $this->node->get($key2)->make_active();
         $this->assertTrue($this->node->get($key1)->isactive);
@@ -268,9 +268,9 @@ class navigation_node_test extends UnitTestCase {
         $FULLME = $oldfullme;
     }
     public function test_remove_child() {
-        $this->node->add('child to remove 1', null, 'remove1');
-        $this->node->add('child to remove 2', null, 'remove2');
-        $this->node->get('remove2')->add('child to remove 3', null, 'remove3');
+        $this->node->add('child to remove 1', null, null, 'remove1');
+        $this->node->add('child to remove 2', null, null, 'remove2');
+        $this->node->get('remove2')->add('child to remove 3', null, null, 'remove3');
         $this->assertIsA($this->node->get('remove1'), 'navigation_node');
         $this->assertTrue($this->node->remove_child('remove1'));
         $this->assertFalse($this->node->remove_child('remove3'));
@@ -329,24 +329,24 @@ class global_navigation_test extends UnitTestCase {
         $this->cache = new navigation_cache('simpletest_nav');
         $this->node = new exposed_global_navigation();
         // Create an initial tree structure to work with
-        $this->node->add('category 1', null, 'cat1', navigation_node::TYPE_CATEGORY);
-        $this->node->add('category 2', null, 'cat2', navigation_node::TYPE_CATEGORY);
-        $this->node->add('category 3', null, 'cat3', navigation_node::TYPE_CATEGORY);
-        $this->node->get('cat2')->add('sub category 1', null, 'sub1', navigation_node::TYPE_CATEGORY);
-        $this->node->get('cat2')->add('sub category 2', null, 'sub2', navigation_node::TYPE_CATEGORY);
-        $this->node->get('cat2')->add('sub category 3', null, 'sub3', navigation_node::TYPE_CATEGORY);
-        $this->node->get('cat2')->get('sub2')->add('course 1', null, 'course1', navigation_node::TYPE_COURSE);
-        $this->node->get('cat2')->get('sub2')->add('course 2', null, 'course2', navigation_node::TYPE_COURSE);
-        $this->node->get('cat2')->get('sub2')->add('course 3', null, 'course3', navigation_node::TYPE_COURSE);
-        $this->node->get('cat2')->get('sub2')->get('course2')->add('section 1', null, 'sec1', navigation_node::TYPE_COURSE);
-        $this->node->get('cat2')->get('sub2')->get('course2')->add('section 2', null, 'sec2', navigation_node::TYPE_COURSE);
-        $this->node->get('cat2')->get('sub2')->get('course2')->add('section 3', null, 'sec3', navigation_node::TYPE_COURSE);
-        $this->node->get('cat2')->get('sub2')->get('course2')->get('sec2')->add('activity 1', null, 'act1', navigation_node::TYPE_ACTIVITY);
-        $this->node->get('cat2')->get('sub2')->get('course2')->get('sec2')->add('activity 2', null, 'act2', navigation_node::TYPE_ACTIVITY);
-        $this->node->get('cat2')->get('sub2')->get('course2')->get('sec2')->add('activity 3', null, 'act3', navigation_node::TYPE_ACTIVITY);
-        $this->node->get('cat2')->get('sub2')->get('course2')->get('sec2')->add('resource 1', null, 'res1', navigation_node::TYPE_RESOURCE);
-        $this->node->get('cat2')->get('sub2')->get('course2')->get('sec2')->add('resource 2', null, 'res2', navigation_node::TYPE_RESOURCE);
-        $this->node->get('cat2')->get('sub2')->get('course2')->get('sec2')->add('resource 3', null, 'res3', navigation_node::TYPE_RESOURCE);
+        $this->node->add('category 1', null, null, 'cat1', navigation_node::TYPE_CATEGORY);
+        $this->node->add('category 2', null, null, 'cat2', navigation_node::TYPE_CATEGORY);
+        $this->node->add('category 3', null, null, 'cat3', navigation_node::TYPE_CATEGORY);
+        $this->node->get('cat2')->add('sub category 1', null, null, 'sub1', navigation_node::TYPE_CATEGORY);
+        $this->node->get('cat2')->add('sub category 2', null, null, 'sub2', navigation_node::TYPE_CATEGORY);
+        $this->node->get('cat2')->add('sub category 3', null, null, 'sub3', navigation_node::TYPE_CATEGORY);
+        $this->node->get('cat2')->get('sub2')->add('course 1', null, null, 'course1', navigation_node::TYPE_COURSE);
+        $this->node->get('cat2')->get('sub2')->add('course 2', null, null, 'course2', navigation_node::TYPE_COURSE);
+        $this->node->get('cat2')->get('sub2')->add('course 3', null, null, 'course3', navigation_node::TYPE_COURSE);
+        $this->node->get('cat2')->get('sub2')->get('course2')->add('section 1', null, null, 'sec1', navigation_node::TYPE_COURSE);
+        $this->node->get('cat2')->get('sub2')->get('course2')->add('section 2', null, null, 'sec2', navigation_node::TYPE_COURSE);
+        $this->node->get('cat2')->get('sub2')->get('course2')->add('section 3', null, null, 'sec3', navigation_node::TYPE_COURSE);
+        $this->node->get('cat2')->get('sub2')->get('course2')->get('sec2')->add('activity 1', null, null, 'act1', navigation_node::TYPE_ACTIVITY);
+        $this->node->get('cat2')->get('sub2')->get('course2')->get('sec2')->add('activity 2', null, null, 'act2', navigation_node::TYPE_ACTIVITY);
+        $this->node->get('cat2')->get('sub2')->get('course2')->get('sec2')->add('activity 3', null, null, 'act3', navigation_node::TYPE_ACTIVITY);
+        $this->node->get('cat2')->get('sub2')->get('course2')->get('sec2')->add('resource 1', null, null, 'res1', navigation_node::TYPE_RESOURCE);
+        $this->node->get('cat2')->get('sub2')->get('course2')->get('sec2')->add('resource 2', null, null, 'res2', navigation_node::TYPE_RESOURCE);
+        $this->node->get('cat2')->get('sub2')->get('course2')->get('sec2')->add('resource 3', null, null, 'res3', navigation_node::TYPE_RESOURCE);
 
         $this->cache->clear();
         $this->cache->modinfo5 = unserialize('O:6:"object":6:{s:8:"courseid";s:1:"5";s:6:"userid";s:1:"2";s:8:"sections";a:1:{i:0;a:1:{i:0;s:3:"288";}}s:3:"cms";a:1:{i:288;O:6:"object":17:{s:2:"id";s:3:"288";s:8:"instance";s:2:"19";s:6:"course";s:1:"5";s:7:"modname";s:5:"forum";s:4:"name";s:10:"News forum";s:7:"visible";s:1:"1";s:10:"sectionnum";s:1:"0";s:9:"groupmode";s:1:"0";s:10:"groupingid";s:1:"0";s:16:"groupmembersonly";s:1:"0";s:6:"indent";s:1:"0";s:10:"completion";s:1:"0";s:5:"extra";s:0:"";s:4:"icon";s:0:"";s:11:"uservisible";b:1;s:9:"modplural";s:6:"Forums";s:9:"available";b:1;}}s:9:"instances";a:1:{s:5:"forum";a:1:{i:19;R:8;}}s:6:"groups";N;}');
@@ -354,7 +354,7 @@ class global_navigation_test extends UnitTestCase {
         $this->cache->canviewhiddenactivities = true;
         $this->cache->canviewhiddensections = true;
         $this->cache->canviewhiddencourses = true;
-        $this->node->get('cat2')->get('sub2')->add('Test Course 5',null,'5',navigation_node::TYPE_COURSE, new moodle_url('http://moodle.org'));
+        $this->node->get('cat2')->get('sub2')->add('Test Course 5', new moodle_url('http://moodle.org'),null,'5',navigation_node::TYPE_COURSE);
     }
     public function test_add_categories() {
         $categories = array();
@@ -482,7 +482,7 @@ class global_navigation_test extends UnitTestCase {
         $keys = array('cat2', 'sub2', '5');
         $course = new stdClass;
         $course->id = '5';
-        $this->node->get_by_path($keys)->add('Test Section 1', null, $this->cache->coursesections5[1]->id, navigation_node::TYPE_SECTION);
+        $this->node->get_by_path($keys)->add('Test Section 1', null, null, $this->cache->coursesections5[1]->id, navigation_node::TYPE_SECTION);
         $modinfo = $this->cache->modinfo5;
         $modinfo->sections[1] = array(289, 290);
         $modinfo->cms[289] = clone($modinfo->cms[288]);
@@ -564,7 +564,7 @@ class navbar_test extends UnitTestCase {
     public function test_add() {
         global $CFG;
         // Add a node with all args set
-        $this->node->add('test_add_1','testadd1','testadd1',navigation_node::TYPE_COURSE,'http://www.moodle.org/',$CFG->httpswwwroot . '/pix/i/course.gif');
+        $this->node->add('test_add_1','http://www.moodle.org/','testadd1','testadd1',navigation_node::TYPE_COURSE,$CFG->httpswwwroot . '/pix/i/course.gif');
         // Add a node with the minimum args required
         $key2 = $this->node->add('test_add_2');
         $this->assertIsA($this->node->get('testadd1'), 'navigation_node');
@@ -584,7 +584,7 @@ class navbar_test extends UnitTestCase {
     }
     public function test_parse_branch_to_html() {
         global $CFG;
-        $key = $this->node->add('test_add_1','testadd1','testadd1',navigation_node::TYPE_COURSE,'http://www.moodle.org/',$CFG->httpswwwroot . '/pix/i/course.gif');
+        $key = $this->node->add('test_add_1','http://www.moodle.org/','testadd1','testadd1',navigation_node::TYPE_COURSE,$CFG->httpswwwroot . '/pix/i/course.gif');
         $this->node->get($key)->make_active();
         $html = $this->node->exposed_parse_branch_to_html($this->node->children, true, true);
         $this->assert(new ContainsTagWithAttribute('a','href',$this->node->action->out()), $html);
@@ -682,10 +682,10 @@ class settings_navigation_test extends UnitTestCase {
         $this->assertFalse($this->node->exposed_in_alternative_role());
     }
     public function test_remove_empty_root_branches() {
-        $this->node->add('rootbranch1', null, 'rootbranch1');
-        $this->node->add('rootbranch2', null, 'rootbranch2');
-        $this->node->add('rootbranch3', null, 'rootbranch3');
-        $this->node->get('rootbranch2')->add('something', null, null, navigation_node::TYPE_SETTING);
+        $this->node->add('rootbranch1', null, null, 'rootbranch1');
+        $this->node->add('rootbranch2', null, null, 'rootbranch2');
+        $this->node->add('rootbranch3', null, null, 'rootbranch3');
+        $this->node->get('rootbranch2')->add('something', null, null, null, navigation_node::TYPE_SETTING);
         $this->node->remove_empty_root_branches();
         $this->assertFalse($this->node->get('rootbranch1'));
         $this->assertIsA($this->node->get('rootbranch2'), 'navigation_node');
index 27b675846c0681e86c9192d0ee7284efe1daf60e..442f916f567fc466db7f82561fa562d13badf33b 100644 (file)
 
         $fullname = fullname($USER, true);
 
-        $PAGE->navbar->add($fullname, null, null, navigation_node::TYPE_CUSTOM,
-                           new moodle_url($CFG->wwwroot.'/user/view.php', array('id'=>$USER->id, 'course'=>$course->id)));
+        $PAGE->navbar->add($fullname, new moodle_url($CFG->wwwroot.'/user/view.php', array('id'=>$USER->id, 'course'=>$course->id)));
         $PAGE->navbar->add($strpasswordchanged);
         $PAGE->set_title($strpasswordchanged);
-        $PAGE->set_header($strpasswordchanged);
+        $PAGE->set_heading($strpasswordchanged);
         echo $OUTPUT->header();
 
         if (empty($SESSION->wantsurl) or $SESSION->wantsurl == $CFG->httpswwwroot.'/login/change_password.php') {
 
     $fullname = fullname($USER, true);
 
-    $PAGE->navbar->add($fullname, null, null, navigation_node::TYPE_CUSTOM,
-                           new moodle_url($CFG->wwwroot.'/user/view.php', array('id'=>$USER->id, 'course'=>$course->id)));
+    $PAGE->navbar->add($fullname, new moodle_url($CFG->wwwroot.'/user/view.php', array('id'=>$USER->id, 'course'=>$course->id)));
     $PAGE->navbar->add($strchangepassword);
     $PAGE->set_title($strchangepassword);
-    $PAGE->set_header($strchangepassword);
+    $PAGE->set_heading($strchangepassword);
     echo $OUTPUT->header();
 
     if (get_user_preferences('auth_forcepasswordchange')) {
index d29aa1c12c92876ccc60b6c5ed4ee104c350eee4..24f831d99c525ddaddfcab4b66abab0a1f288c28 100644 (file)
@@ -18,7 +18,7 @@ $systemcontext = get_context_instance(CONTEXT_SYSTEM);
 $strforgotten = get_string('passwordforgotten');
 $strlogin     = get_string('login');
 
-$PAGE->navbar->add($strlogin, null, null, navigation_node::TYPE_CUSTOM, get_login_url());
+$PAGE->navbar->add($strlogin, get_login_url());
 $PAGE->navbar->add($strforgotten);
 
 // if alternatepasswordurl is defined, then we'll just head there
index 0b58c1304c91c52550637b1f6d4a90a831a6c578..8d43000f163d5c60343d72e7a22a8ec1361de581 100644 (file)
 
     if (has_capability('moodle/course:viewparticipants', $coursecontext) || 
         has_capability('moodle/site:viewparticipants', $systemcontext)) {
-        $PAGE->navbar->add($strparticipants, null, null, navigation_node::TYPE_CUSTOM,
-                           new moodle_url($CFG->wwwroot.'/message/index.php', array('id'=>$course->id)));
+        $PAGE->navbar->add($strparticipants, new moodle_url($CFG->wwwroot.'/message/index.php', array('id'=>$course->id)));
     }
-    $PAGE->navbar->add($userfullname, null, null, navigation_node::TYPE_CUSTOM,
-                       new moodle_url($CFG->wwwroot.'/message/view.php', array('id'=>$user->id, 'course'=>$course->id)));
+    $PAGE->navbar->add($userfullname, new moodle_url($CFG->wwwroot.'/message/view.php', array('id'=>$user->id, 'course'=>$course->id)));
     $PAGE->navbar->add($streditmymessage);
     $PAGE->set_title("$course->shortname: $streditmymessage");
     if ($course->id != SITEID) {
index f7d2e35f343b15b7249c1ebc26c716e917a29236..769898703744660e5c87d80d3eeadd6b2fe64ffd 100644 (file)
@@ -8203,7 +8203,7 @@ function forum_extend_navigation($navref, $course, $module, $cm) {
     foreach ($discussions as $discussion) {
         $icon = $OUTPUT->old_icon_url('i/feedback');
         $url = new moodle_url($CFG->wwwroot.'/mod/forum/discuss.php', array('d'=>$discussion->discussion));
-        $navref->get($discussionkey)->add($discussion->subject, null, null, null, $url, $icon);
+        $navref->get($discussionkey)->add($discussion->subject, $url, null, null, null, $icon);
     }
 
     if ($discussioncount > count($discussions)) {
@@ -8212,7 +8212,7 @@ function forum_extend_navigation($navref, $course, $module, $cm) {
         } else {
             $url = new moodle_url($CFG->wwwroot.'/mod/forum/view.php', array('id'=>$cm->id));
         }
-        $childkey = $navref->get($discussionkey)->add(get_string('viewalldiscussions', 'forum'), null, null, null, $url, $icon);
+        $childkey = $navref->get($discussionkey)->add(get_string('viewalldiscussions', 'forum'), $url, null, null, null, $icon);
     }
 
     $index = 0;
@@ -8232,7 +8232,7 @@ function forum_extend_navigation($navref, $course, $module, $cm) {
             $icon = $OUTPUT->old_icon_url('i/feedback');
             $url = new moodle_url($CFG->wwwroot.'/mod/forum/discuss.php', array('d'=>$post->content->discussion));
             $title = $post->content->subject."\n".userdate($post->timestamp, get_string('strftimerecent', 'langconfig'))."\n".$post->user->firstname.' '.$post->user->lastname;
-            $navref->get($recentkey)->add($title, null, null, null, $url, $icon);
+            $navref->get($recentkey)->add($title, $url, null, null, null, $icon);
         }
     }
 }
@@ -8265,7 +8265,7 @@ function forum_extend_settings_navigation($settingsnav, $module=null) {
             $helpbutton->module = "forum";
             if (has_capability('mod/forum:managesubscriptions', $PAGE->cm->context)) {
                 $url = new moodle_url($CFG->wwwroot.'/mod/forum/subscribe.php', array('id'=>$forumobject->id, 'force'=>'no'));
-                $forum->add($string, null, null, settings_navigation::TYPE_SETTING, $url);
+                $forum->add($string, $url);
             } else {
                 $forum->add(get_string('everyoneisnowsubscribed', 'forum'));
             }
@@ -8287,13 +8287,13 @@ function forum_extend_settings_navigation($settingsnav, $module=null) {
 
             if (has_capability('mod/forum:managesubscriptions', $PAGE->cm->context)) {
                 $url = new moodle_url($CFG->wwwroot.'/mod/forum/subscribe.php', array('id'=>$forumobject->id, 'force'=>'yes'));
-                $forum->add($string, null, null, settings_navigation::TYPE_SETTING, $url);
+                $forum->add($string, $url);
             } else {
                 $forum->add(get_string('everyonecannowchoose', 'forum'));
             }
             if(has_capability('mod/forum:viewsubscribers', $PAGE->cm->context)){
                 $url = new moodle_url($CFG->wwwroot.'/mod/forum/subscribers.php', array('id'=>$forumobject->id));
-                $forum->add(get_string('showsubscribers', 'forum'), null, null, settings_navigation::TYPE_SETTING, $url);
+                $forum->add(get_string('showsubscribers', 'forum'), $url);
             }
             
             if (forum_is_forcesubscribed($forumobject) || ($forumobject->forcesubscribe == FORUM_DISALLOWSUBSCRIBE && !has_capability('mod/forum:managesubscriptions', $PAGE->cm->context))) {
@@ -8305,7 +8305,7 @@ function forum_extend_settings_navigation($settingsnav, $module=null) {
                     $linktext = get_string('subscribe', 'forum');
                 }
                 $url = new moodle_url($CFG->wwwroot . '/mod/forum/subscribe.php', array('id'=>$forumobject->id));
-                $forum->add($linktext, null, null, settings_navigation::TYPE_SETTING, $url);
+                $forum->add($linktext, $url);
             }
         }
 
@@ -8316,7 +8316,7 @@ function forum_extend_settings_navigation($settingsnav, $module=null) {
                 $linktext = get_string('trackforum', 'forum');
             }
             $url = new moodle_url($CFG->wwwroot . '/mod/forum/settracking.php', array('id'=>$forumobject->id));
-            $forum->add($linktext, null, null, settings_navigation::TYPE_SETTING, $url);
+            $forum->add($linktext, $url);
         }
         if ($notekey!==false) {
             $forum->get($notekey)->add_class('note');
@@ -8328,7 +8328,7 @@ function forum_extend_settings_navigation($settingsnav, $module=null) {
             $modulename = get_string('modulename', 'forum');
             $string = get_string('updatethis', '', $modulename);
             $url = new moodle_url("$CFG->wwwroot/course/mod.php", array('update' => $PAGE->cm->id, 'return' => true, 'sesskey' => sesskey()));
-            $forum->add($string, null, null, settings_navigation::TYPE_SETTING, $url);
+            $forum->add($string, $url);
         }
     }
 
@@ -8349,7 +8349,7 @@ function forum_extend_settings_navigation($settingsnav, $module=null) {
             $userid = $USER->id;
         }
         $url = new moodle_url(rss_get_url($PAGE->course->id, $userid, "forum", $forumobject->id));
-        $forum->add($string, null, null, settings_navigation::TYPE_SETTING, $url, $OUTPUT->old_icon_url('i/rss'));
+        $forum->add($string, $url, null, null, settings_navigation::TYPE_SETTING, $OUTPUT->old_icon_url('i/rss'));
     }
 
     return $forumkey;
index d3d2a9bd4dff5eb06f8c7a8f8ccb378668599963..5419d3daeaaeb87bf01f862fabcdd233bf198b8a 100755 (executable)
@@ -50,8 +50,7 @@
             // The module SCORM/AICC activity with the first id is the course
             $firstscorm = current($scorms);
             if (!(($course->format == 'scorm') && ($firstscorm->id == $scorm->id))) {
-                $PAGE->navbar->add($strscorms, null ,null, navigation_node::TYPE_CUSTOM,
-                                   new moodle_url($CFG->wwwroot.'/mod/scorm/index.php', array('id'=>$course->id)));
+                $PAGE->navbar->add($strscorms, new moodle_url($CFG->wwwroot.'/mod/scorm/index.php', array('id'=>$course->id)));
             }
         }
     }
@@ -59,8 +58,7 @@
     $pagetitle = strip_tags("$course->shortname: ".format_string($scorm->name));
     $PAGE->set_title($pagetitle);
     $PAGE->set_heading($course->fullname);
-    $PAGE->navbar->add(format_string($scorm->name,true), null ,null, navigation_node::TYPE_CUSTOM,
-                       new moodle_url($CFG->wwwroot.'/mode/scorm/view.php', array('id'=>$cm->id)));
+    $PAGE->navbar->add(format_string($scorm->name,true), new moodle_url($CFG->wwwroot.'/mode/scorm/view.php', array('id'=>$cm->id)));
     $PAGE->set_button(update_module_button($cm->id, $course->id, $strscorm));
 
     if (!$cm->visible and !has_capability('moodle/course:viewhiddenactivities', get_context_instance(CONTEXT_COURSE,$course->id))) {
index 0756e0549142bea913b69390cc5dc5ab45bce169..e7ebebccac1293476b40392d668d7929f29fefa4 100755 (executable)
 
         $PAGE->set_title("$course->shortname: ".format_string($scorm->name));
         $PAGE->set_heading($course->fullname);
-        $PAGE->navbar->add($strreport, null, null, navigation_node::TYPE_CUSTOM,
-                           new moodle_url($CFG->wwwroot.'/mod/scorm/report.php', array('id'=>$cm->id)));
+        $PAGE->navbar->add($strreport, new moodle_url($CFG->wwwroot.'/mod/scorm/report.php', array('id'=>$cm->id)));
 
         if (empty($b)) {
             if (!empty($a)) {
                 $PAGE->navbar->add("$strattempt $attempt - ".fullname($userdata));
             }
         } else {
-            $PAGE->navbar->add("$strattempt $attempt - ".fullname($userdata), null, null, navigation_node::TYPE_CUSTOM,
-                                new moodle_url($CFG->wwwroot.'/mod/scorm/report.php', array('a'=>$a, 'user'=>$user, 'attempt'=>$attempt)));
+            $PAGE->navbar->add("$strattempt $attempt - ".fullname($userdata), new moodle_url($CFG->wwwroot.'/mod/scorm/report.php', array('a'=>$a, 'user'=>$user, 'attempt'=>$attempt)));
             $PAGE->navbar->add($sco->title);
         }
         echo $OUTPUT->header();
index 8dd2df40c1238dff82093e88398497ba1a7a8cbe..5b8e0501b50595749cfde3b1ae19472a4aa90e92 100644 (file)
     if (has_capability('moodle/course:viewparticipants', $coursecontext) || has_capability('moodle/site:viewparticipants', $systemcontext)) {
         $link = new moodle_url($CFG->wwwroot."/user/index.php", array('id'=>$course->id));
     }
-    $PAGE->navbar->add($strparticipants, null, null, navigation_node::TYPE_SETTING, $link);
+    $PAGE->navbar->add($strparticipants, $link);
     $link = new moodle_url($CFG->wwwroot.'/user/view.php', array('id'=>$user->id, 'course'=>$course->id));
-    $PAGE->navbar->add($userfullname, null, null, navigation_node::TYPE_SETTING, $link);
+    $PAGE->navbar->add($userfullname, $link);
     $PAGE->navbar->add($streditmyprofile);
     $PAGE->set_title("$course->shortname: $streditmyprofile");
     $PAGE->set_heading($course->fullname);
index b8961e5e239af4fe0ea1d798e7b82ba42e2673b6..c2377e17b2c5d43d58a11d705cf13047adb91302 100644 (file)
         if (has_capability('moodle/course:viewparticipants', $coursecontext) || has_capability('moodle/site:viewparticipants', $systemcontext)) {
             $link = new moodle_url($CFG->wwwroot."/user/index.php", array('id'=>$course->id));
         }
-        $PAGE->navbar->add($strparticipants, null, null, navigation_node::TYPE_SETTING, $link);
+        $PAGE->navbar->add($strparticipants, $link);
         $link = new moodle_url($CFG->wwwroot.'/user/view.php', array('id'=>$user->id, 'course'=>$course->id));
-        $PAGE->navbar->add($userfullname, null, null, navigation_node::TYPE_SETTING, $link);
+        $PAGE->navbar->add($userfullname, $link);
         $PAGE->navbar->add($streditmyprofile);
 
         $PAGE->set_title("$course->shortname: $streditmyprofile");
index 7414f50a38f0f4992e04a2dd9f225b57e4ae6ef4..3d8bf4db0de3ceb34c9b9fbe030186862c01c32b 100644 (file)
@@ -60,7 +60,7 @@
     if (has_capability('moodle/course:viewparticipants', $coursecontext) || has_capability('moodle/site:viewparticipants', $systemcontext)) {
         $link = new moodle_url($CFG->wwwroot."/user/index.php", array('id'=>$course->id));
     }
-    $PAGE->navbar->add(get_string('participants'), null, null, navigation_node::TYPE_SETTING, $link);
+    $PAGE->navbar->add(get_string('participants'), $link);
     $PAGE->navbar->add($strtitle);
     $PAGE->set_title($strtitle);
     $PAGE->set_heading($strtitle);
index 77f8547e46c8d0574208d564d39d27ff8e207f2e..db59f2e30f70997dc99439155fa1f058e303c61d 100644 (file)
@@ -22,7 +22,7 @@ $pluginstr = get_string('plugin', 'repository');
 require_login($course, false);
 
 $link = new moodle_url($CFG->wwwroot . '/user/view.php', array('id'=>$user->id));
-$PAGE->navbar->add($fullname, null, null, navigation_node::TYPE_SETTING, $link);
+$PAGE->navbar->add($fullname, $link);
 $PAGE->navbar->add($strrepos);
 $PAGE->set_title("$course->fullname: $fullname: $strrepos");
 $PAGE->set_heading($course->fullname);
index a1e197043be869e42fc07fb6a55a0eea2ed0490c..57ab8a03248be0d9537bb1a4f8918ac32187cec0 100644 (file)
@@ -78,7 +78,7 @@
     if (has_capability('moodle/course:viewparticipants', $coursecontext) || has_capability('moodle/site:viewparticipants', $systemcontext)) {
         $link = new moodle_url($CFG->wwwroot."/user/index.php", array('id'=>$course->id));
     }
-    $PAGE->navbar->add($strparticipants, null, null, navigation_node::TYPE_SETTING, $link);
+    $PAGE->navbar->add($strparticipants, $link);
 
 /// If the user being shown is not ourselves, then make sure we are allowed to see them!