Commit 91152a35 authored by samhemelryk's avatar samhemelryk
Browse files

navigation MDL-20216 Refactored add arguments

Moved $action argument from arg5 to arg2
parent a800639b
......@@ -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);
......
<?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");
......
......@@ -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();
......
......@@ -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();
......
......@@ -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();
......
......@@ -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();
......
......@@ -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();
......
......@@ -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();
......
......@@ -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();
......
......@@ -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();
......
......@@ -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();
......
......@@ -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();
......
......@@ -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;
......
......@@ -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);
......
......@@ -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');
......
......@@ -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();
......
......@@ -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");
......
......@@ -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;
......
......@@ -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");
......
......@@ -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");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment