diff --git a/admin/dbperformance.php b/admin/dbperformance.php index 10aa4c6a22997..69364f96f3cb8 100644 --- a/admin/dbperformance.php +++ b/admin/dbperformance.php @@ -21,8 +21,7 @@ $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); diff --git a/admin/mnet/delete.html b/admin/mnet/delete.html index ac3786f841af9..2729e85989986 100644 --- a/admin/mnet/delete.html +++ b/admin/mnet/delete.html @@ -1,8 +1,6 @@ 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"); diff --git a/admin/roles/assign.php b/admin/roles/assign.php index 201639a5d5dae..5eede80e24fe9 100755 --- a/admin/roles/assign.php +++ b/admin/roles/assign.php @@ -266,15 +266,13 @@ $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(); diff --git a/admin/roles/check.php b/admin/roles/check.php index 6041234112a6c..eaff142acda69 100755 --- a/admin/roles/check.php +++ b/admin/roles/check.php @@ -108,15 +108,13 @@ $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(); diff --git a/admin/roles/override.php b/admin/roles/override.php index 3278e8418c506..89eb171442fe5 100755 --- a/admin/roles/override.php +++ b/admin/roles/override.php @@ -151,15 +151,13 @@ $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(); diff --git a/admin/roles/tabs.php b/admin/roles/tabs.php index 25b6853b75d18..bfc90a1070b75 100755 --- a/admin/roles/tabs.php +++ b/admin/roles/tabs.php @@ -52,7 +52,7 @@ 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 @@ $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 @@ $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(); diff --git a/admin/roles/usersroles.php b/admin/roles/usersroles.php index a94c591a6773a..9a1c7576abd34 100644 --- a/admin/roles/usersroles.php +++ b/admin/roles/usersroles.php @@ -126,14 +126,12 @@ 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(); diff --git a/admin/xmldb/actions/edit_field_save/edit_field_save.class.php b/admin/xmldb/actions/edit_field_save/edit_field_save.class.php index 53650a0f618ed..a62085a22b0bd 100644 --- a/admin/xmldb/actions/edit_field_save/edit_field_save.class.php +++ b/admin/xmldb/actions/edit_field_save/edit_field_save.class.php @@ -232,8 +232,8 @@ function invoke() { $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(); diff --git a/admin/xmldb/actions/edit_index_save/edit_index_save.class.php b/admin/xmldb/actions/edit_index_save/edit_index_save.class.php index d72ca9b0edc05..a6fcfefde90ce 100644 --- a/admin/xmldb/actions/edit_index_save/edit_index_save.class.php +++ b/admin/xmldb/actions/edit_index_save/edit_index_save.class.php @@ -164,8 +164,8 @@ function invoke() { $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(); diff --git a/admin/xmldb/actions/edit_key_save/edit_key_save.class.php b/admin/xmldb/actions/edit_key_save/edit_key_save.class.php index eb011fb410700..f9afce4ef7d7b 100644 --- a/admin/xmldb/actions/edit_key_save/edit_key_save.class.php +++ b/admin/xmldb/actions/edit_key_save/edit_key_save.class.php @@ -240,8 +240,8 @@ function invoke() { } /// 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(); diff --git a/admin/xmldb/actions/edit_sentence_save/edit_sentence_save.class.php b/admin/xmldb/actions/edit_sentence_save/edit_sentence_save.class.php index 4fa2fcaecd291..7db6ea5905c44 100644 --- a/admin/xmldb/actions/edit_sentence_save/edit_sentence_save.class.php +++ b/admin/xmldb/actions/edit_sentence_save/edit_sentence_save.class.php @@ -120,8 +120,8 @@ function invoke() { 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(); diff --git a/admin/xmldb/actions/edit_table_save/edit_table_save.class.php b/admin/xmldb/actions/edit_table_save/edit_table_save.class.php index 283abcdb37b38..f41dcfd7d3f28 100644 --- a/admin/xmldb/actions/edit_table_save/edit_table_save.class.php +++ b/admin/xmldb/actions/edit_table_save/edit_table_save.class.php @@ -105,8 +105,8 @@ function invoke() { $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(); diff --git a/blocks/global_navigation_tree/block_global_navigation_tree.php b/blocks/global_navigation_tree/block_global_navigation_tree.php index 327d0ab574d5a..bc58ad0f9c90a 100644 --- a/blocks/global_navigation_tree/block_global_navigation_tree.php +++ b/blocks/global_navigation_tree/block_global_navigation_tree.php @@ -278,7 +278,7 @@ protected function showmyhistory() { // 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 @@ protected function showmycourses() { } // 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; diff --git a/blocks/rss_client/editfeed.php b/blocks/rss_client/editfeed.php index f35bfe2c02dc0..dceb56b2a6158 100644 --- a/blocks/rss_client/editfeed.php +++ b/blocks/rss_client/editfeed.php @@ -218,7 +218,7 @@ public static function autodiscover_feed_url($url){ $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); diff --git a/blocks/rss_client/managefeeds.php b/blocks/rss_client/managefeeds.php index 6f77309efbb36..66482e35aabfa 100644 --- a/blocks/rss_client/managefeeds.php +++ b/blocks/rss_client/managefeeds.php @@ -85,8 +85,8 @@ $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'); diff --git a/blocks/rss_client/viewfeed.php b/blocks/rss_client/viewfeed.php index cc1ff4588608f..133d46b50389b 100644 --- a/blocks/rss_client/viewfeed.php +++ b/blocks/rss_client/viewfeed.php @@ -74,7 +74,7 @@ $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(); diff --git a/course/delete.php b/course/delete.php index 251a70dcc0b30..567b3d8f88d3e 100644 --- a/course/delete.php +++ b/course/delete.php @@ -28,12 +28,9 @@ $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"); diff --git a/course/edit.php b/course/edit.php index 7ba97e88c6e81..c551f6836be16 100644 --- a/course/edit.php +++ b/course/edit.php @@ -124,10 +124,8 @@ $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; diff --git a/course/import/activities/index.php b/course/import/activities/index.php index fda7e13808fe5..48c666ad67037 100644 --- a/course/import/activities/index.php +++ b/course/import/activities/index.php @@ -55,10 +55,8 @@ } } - $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"); diff --git a/course/import/groups/index.php b/course/import/groups/index.php index c3020c69e55d2..c52b67664870b 100755 --- a/course/import/groups/index.php +++ b/course/import/groups/index.php @@ -40,10 +40,8 @@ } /// 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"); diff --git a/course/recent.php b/course/recent.php index 97bcaea53128e..4311208821a75 100644 --- a/course/recent.php +++ b/course/recent.php @@ -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); diff --git a/course/report/log/index.php b/course/report/log/index.php index 008e7ea003beb..1c247337855a8 100644 --- a/course/report/log/index.php +++ b/course/report/log/index.php @@ -83,10 +83,8 @@ } 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(); } @@ -133,8 +131,7 @@ } 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(); } diff --git a/course/report/outline/index.php b/course/report/outline/index.php index a56c3ca398ef4..9b4c6d9207715 100644 --- a/course/report/outline/index.php +++ b/course/report/outline/index.php @@ -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)); diff --git a/course/report/participation/index.php b/course/report/participation/index.php index 970cf45545046..a9db751481dd6 100644 --- a/course/report/participation/index.php +++ b/course/report/participation/index.php @@ -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(); diff --git a/course/report/progress/index.php b/course/report/progress/index.php index 0bca1fd629425..ae295bea95f0d 100644 --- a/course/report/progress/index.php +++ b/course/report/progress/index.php @@ -86,8 +86,7 @@ function csv_quote($value) { $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(); diff --git a/course/report/stats/index.php b/course/report/stats/index.php index 48c66dd4643cc..fc7931f051bc9 100644 --- a/course/report/stats/index.php +++ b/course/report/stats/index.php @@ -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")); } diff --git a/course/search.php b/course/search.php index 8442064abf31d..e161eecebeb73 100644 --- a/course/search.php +++ b/course/search.php @@ -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); @@ -201,8 +201,8 @@ } } - $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)); } diff --git a/course/user.php b/course/user.php index 127727b7fe5ab..b5172004d1c9e 100644 --- a/course/user.php +++ b/course/user.php @@ -105,9 +105,8 @@ 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)"); diff --git a/grade/report/user/lib.php b/grade/report/user/lib.php index 1119b4c4dc7e2..d5d5e40799b66 100644 --- a/grade/report/user/lib.php +++ b/grade/report/user/lib.php @@ -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); diff --git a/lib/deprecatedlib.php b/lib/deprecatedlib.php index 0ecc9133a9f70..8176b1d2bb275 100644 --- a/lib/deprecatedlib.php +++ b/lib/deprecatedlib.php @@ -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); } } } diff --git a/lib/navigationlib.php b/lib/navigationlib.php index dd00b3109389a..ee13d52f05a2d 100644 --- a/lib/navigationlib.php +++ b/lib/navigationlib.php @@ -219,13 +219,13 @@ public function check_if_active() { * 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 optional * @param string|int $key Sets the key that can be used to retrieve this node optional * @param int $type The type of node should be one of the const types of navigation_node optional - * @param string $action Either a moodle_url or a bit of html to use instead of the text optional * @param string $icon The path to an icon to use for this node optional * @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 @@ public function add($text, $shorttext=null, $key=null, $type=null, $action=null, */ 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 @@ protected function load_for_activity() { $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 @@ public function add_courses($courses, $categoryid=null) { $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 @@ protected function load_activity($instanceid) { } $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 @@ protected function parse_branch_to_html($navarray, $firstnode=true, $moreafterth * @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 @@ public function initialise() { $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 @@ public function initialise() { * 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 @@ protected function load_administration_settings($referencebranch=null, $adminbra 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 @@ protected function load_administration_settings($referencebranch=null, $adminbra } // 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 @@ protected function load_course_settings() { $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 @@ protected function load_course_settings() { $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 @@ protected function load_course_settings() { } $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 @@ protected function load_course_settings() { } 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 @@ protected function load_course_settings() { $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 @@ protected function load_course_settings() { // 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 @@ protected function load_course_settings() { } 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 @@ protected function load_course_settings() { // 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 @@ protected function load_course_settings() { } 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 @@ protected function load_course_settings() { $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 @@ protected function load_course_settings() { 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 @@ protected function load_course_settings() { $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 @@ protected function generate_user_settings($courseid, $userid, $gstitle='usercurr 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 @@ protected function generate_user_settings($courseid, $userid, $gstitle='usercurr $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 @@ protected function generate_user_settings($courseid, $userid, $gstitle='usercurr } } $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 @@ protected function generate_user_settings($courseid, $userid, $gstitle='usercurr $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 @@ protected function load_front_page_settings() { $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')); } } diff --git a/lib/pagelib.php b/lib/pagelib.php index f4d1b2e54c0cb..0b6e9ccef65f1 100644 --- a/lib/pagelib.php +++ b/lib/pagelib.php @@ -1624,7 +1624,7 @@ function print_header($title, $morenavlinks = NULL, $bodytags = '', $meta = '') 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 @@ function print_header($title, $morenavlinks = NULL, $bodytags = '', $meta = '') $PAGE->set_title($title); $PAGE->set_heading($this->course->fullname); $PAGE->set_button($buttons); - echo $OUTPUT->heading(); + echo $OUTPUT->header(); } } diff --git a/lib/simpletest/testnavigationlib.php b/lib/simpletest/testnavigationlib.php index a8a322ff1d7c7..9ade008ce1218 100644 --- a/lib/simpletest/testnavigationlib.php +++ b/lib/simpletest/testnavigationlib.php @@ -40,18 +40,18 @@ public function setUp() { $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 @@ public function test___construct() { 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 @@ public function test_add_class() { 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 @@ public function test_get_css_type() { 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 @@ public function test_reiterate_active_nodes() { $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 @@ public function setUp() { $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 @@ public function setUp() { $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 @@ public function test_load_section_activities() { $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 @@ public function tearDown() { 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 @@ public function test_has_items() { } 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 @@ public function test_in_alternative_role() { $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'); diff --git a/login/change_password.php b/login/change_password.php index 27b675846c068..442f916f567fc 100644 --- a/login/change_password.php +++ b/login/change_password.php @@ -78,11 +78,10 @@ $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') { @@ -102,11 +101,10 @@ $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')) { diff --git a/login/forgot_password.php b/login/forgot_password.php index d29aa1c12c928..24f831d99c525 100644 --- a/login/forgot_password.php +++ b/login/forgot_password.php @@ -18,7 +18,7 @@ $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 diff --git a/message/edit.php b/message/edit.php index 0b58c1304c91c..8d43000f163d5 100644 --- a/message/edit.php +++ b/message/edit.php @@ -175,11 +175,9 @@ 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) { diff --git a/mod/forum/lib.php b/mod/forum/lib.php index f7d2e35f343b1..7698987037446 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -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; diff --git a/mod/scorm/player.php b/mod/scorm/player.php index d3d2a9bd4dff5..5419d3daeaaeb 100755 --- a/mod/scorm/player.php +++ b/mod/scorm/player.php @@ -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))) { diff --git a/mod/scorm/report.php b/mod/scorm/report.php index 0756e0549142b..e7ebebccac129 100755 --- a/mod/scorm/report.php +++ b/mod/scorm/report.php @@ -68,16 +68,14 @@ $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(); diff --git a/user/edit.php b/user/edit.php index 8dd2df40c1238..5b8e0501b5059 100644 --- a/user/edit.php +++ b/user/edit.php @@ -211,9 +211,9 @@ 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); diff --git a/user/editadvanced.php b/user/editadvanced.php index b8961e5e239af..c2377e17b2c5d 100644 --- a/user/editadvanced.php +++ b/user/editadvanced.php @@ -222,9 +222,9 @@ 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"); diff --git a/user/messageselect.php b/user/messageselect.php index 7414f50a38f0f..3d8bf4db0de3c 100644 --- a/user/messageselect.php +++ b/user/messageselect.php @@ -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); diff --git a/user/repository.php b/user/repository.php index 77f8547e46c8d..db59f2e30f709 100644 --- a/user/repository.php +++ b/user/repository.php @@ -22,7 +22,7 @@ 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); diff --git a/user/view.php b/user/view.php index a1e197043be86..57ab8a03248be 100644 --- a/user/view.php +++ b/user/view.php @@ -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!