diff --git a/user/addnote.php b/user/addnote.php index 23b6d3c26ed..a5f22a870f4 100644 --- a/user/addnote.php +++ b/user/addnote.php @@ -47,11 +47,11 @@ if (!empty($users) && confirm_sesskey()) { $straddnote = get_string('addnewnote', 'notes'); -$navlinks = array(); -$navlinks[] = array('name' => $straddnote, 'link' => null, 'type' => 'misc'); -$navigation = build_navigation($navlinks); +$PAGE->navbar->add($straddnote); +$PAGE->set_title("$course->shortname: ".get_string('extendenrol')); +$PAGE->set_heading($course->fullname); -print_header("$course->shortname: ".get_string('extendenrol'), $course->fullname, $navigation, "", "", true, " ", navmenu($course)); +echo $OUTPUT->header(); // this will contain all available the based On select options, but we'll disable some on them on a per user basis diff --git a/user/edit.php b/user/edit.php index 7c7b8532a3a..8dd2df40c12 100644 --- a/user/edit.php +++ b/user/edit.php @@ -82,7 +82,7 @@ } if ($user->deleted) { - print_header(); + echo $OUTPUT->header(); echo $OUTPUT->heading(get_string('userdeleted')); echo $OUTPUT->footer(); die; @@ -207,16 +207,18 @@ $strparticipants = get_string('participants'); $userfullname = fullname($user, true); - $navlinks = array(); + $link = null; if (has_capability('moodle/course:viewparticipants', $coursecontext) || has_capability('moodle/site:viewparticipants', $systemcontext)) { - $navlinks[] = array('name' => $strparticipants, 'link' => "index.php?id=$course->id", 'type' => 'misc'); + $link = new moodle_url($CFG->wwwroot."/user/index.php", array('id'=>$course->id)); } - $navlinks[] = array('name' => $userfullname, - 'link' => "view.php?id=$user->id&course=$course->id", - 'type' => 'misc'); - $navlinks[] = array('name' => $streditmyprofile, 'link' => null, 'type' => 'misc'); - $navigation = build_navigation($navlinks); - print_header("$course->shortname: $streditmyprofile", $course->fullname, $navigation, ""); + $PAGE->navbar->add($strparticipants, null, null, navigation_node::TYPE_SETTING, $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($streditmyprofile); + $PAGE->set_title("$course->shortname: $streditmyprofile"); + $PAGE->set_heading($course->fullname); + + echo $OUTPUT->header(); /// Print tabs at the top $showroles = 1; diff --git a/user/editadvanced.php b/user/editadvanced.php index b1f19f2b435..b8961e5e239 100644 --- a/user/editadvanced.php +++ b/user/editadvanced.php @@ -60,7 +60,7 @@ } if ($user->deleted) { - print_header(); + echo $OUTPUT->header(); echo $OUTPUT->heading(get_string('userdeleted')); echo $OUTPUT->footer(); die; @@ -203,8 +203,13 @@ } else if (!empty($USER->newadminuser)) { $strinstallation = get_string('installation', 'install'); $strprimaryadminsetup = get_string('primaryadminsetup'); - $navigation = build_navigation(array(array('name'=>$strprimaryadminsetup, 'link'=>null, 'type'=>'misc'))); - print_header($strinstallation, $strinstallation, $navigation, "", "", false, " ", " "); + + $PAGE->navbar->add($strprimaryadminsetup); + $PAGE->set_title($strinstallation); + $PAGE->set_heading($strinstallation); + $PAGE->set_cacheable(false); + + echo $OUTPUT->header(); echo $OUTPUT->box(get_string('configintroadmin', 'admin'), 'generalbox boxwidthnormal boxaligncenter'); echo '
'; } else { @@ -213,17 +218,19 @@ $strnewuser = get_string('newuser'); $userfullname = fullname($user, true); - $navlinks = array(); + $link = null; if (has_capability('moodle/course:viewparticipants', $coursecontext) || has_capability('moodle/site:viewparticipants', $systemcontext)) { - $navlinks[] = array('name' => $strparticipants, 'link' => "index.php?id=$course->id", 'type' => 'misc'); + $link = new moodle_url($CFG->wwwroot."/user/index.php", array('id'=>$course->id)); } - $navlinks[] = array('name' => $userfullname, - 'link' => "view.php?id=$user->id&course=$course->id", - 'type' => 'misc'); - $navlinks[] = array('name' => $streditmyprofile, 'link' => null, 'type' => 'misc'); - $navigation = build_navigation($navlinks); - print_header("$course->shortname: $streditmyprofile", $course->fullname, $navigation, ""); + $PAGE->navbar->add($strparticipants, null, null, navigation_node::TYPE_SETTING, $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($streditmyprofile); + $PAGE->set_title("$course->shortname: $streditmyprofile"); + $PAGE->set_heading($course->fullname); + + echo $OUTPUT->header(); /// Print tabs at the top $showroles = 1; $currenttab = 'editprofile'; diff --git a/user/emailupdate.php b/user/emailupdate.php index 6d0eb00e632..44be5513a23 100755 --- a/user/emailupdate.php +++ b/user/emailupdate.php @@ -15,7 +15,11 @@ $preferences = get_user_preferences(null, null, $user->id); $a = new stdClass(); $a->fullname = fullname($user, true); $stremailupdate = get_string('auth_emailupdate', 'auth_email', $a); -print_header(format_string($SITE->fullname) . ": $stremailupdate", format_string($SITE->fullname) . ": $stremailupdate"); + +$PAGE->set_title(format_string($SITE->fullname) . ": $stremailupdate"); +$PAGE->set_heading(format_string($SITE->fullname) . ": $stremailupdate"); + +echo $OUTPUT->header(); if (empty($preferences['newemailattemptsleft'])) { redirect("$CFG->wwwroot/user/view.php?id=$user->id"); diff --git a/user/extendenrol.php b/user/extendenrol.php index e37d15b24d5..f752a4f9b4e 100644 --- a/user/extendenrol.php +++ b/user/extendenrol.php @@ -81,11 +81,11 @@ if ((count($users) > 0) and ($form = data_submitted()) and confirm_sesskey()) { /// Print headers -$navlinks = array(); -$navlinks[] = array('name' => get_string('extendenrol'), 'link' => null, 'type' => 'misc'); -$navigation = build_navigation($navlinks); +$PAGE->navbar->add(get_string('extendenrol')); +$PAGE->set_title("$course->shortname: ".get_string('extendenrol')); +$PAGE->set_heading( $course->fullname); -print_header("$course->shortname: ".get_string('extendenrol'), $course->fullname, $navigation, "", "", true, " ", navmenu($course)); +echo $OUTPUT->header(); $timeformat = get_string('strftimedate'); $unlimited = get_string('unlimited'); diff --git a/user/groupaddnote.php b/user/groupaddnote.php index 7431281bfbc..031c49da4c6 100644 --- a/user/groupaddnote.php +++ b/user/groupaddnote.php @@ -41,15 +41,14 @@ if (!empty($users) && !empty($content) && confirm_sesskey()) { redirect("$CFG->wwwroot/user/index.php?id=$id"); } -/// Print headers - $straddnote = get_string('groupaddnewnote', 'notes'); -$navlinks = array(); -$navlinks[] = array('name' => $straddnote, 'link' => null, 'type' => 'misc'); -$navigation = build_navigation($navlinks); +$PAGE->navbar->add($straddnote); +$PAGE->set_title("$course->shortname: ".get_string('extendenrol')); +$PAGE->set_heading($course->fullname); -print_header("$course->shortname: ".get_string('extendenrol'), $course->fullname, $navigation, "", "", true, " ", navmenu($course)); +/// Print headers +echo $OUTPUT->header(); // this will contain all available the based On select options, but we'll disable some on them on a per user basis diff --git a/user/groupextendenrol.php b/user/groupextendenrol.php index ecbbde31068..cf020a4220e 100755 --- a/user/groupextendenrol.php +++ b/user/groupextendenrol.php @@ -77,13 +77,12 @@ if ((count($users) > 0) and ($form = data_submitted()) and confirm_sesskey()) { redirect("$CFG->wwwroot/user/index.php?id=$id", get_string('changessaved')); } +$PAGE->navbar->add(get_string('extendenrol')); +$PAGE->set_title("$course->shortname: ".get_string('extendenrol')); +$PAGE->set_heading($course->fullname); + /// Print headers - -$navlinks = array(); -$navlinks[] = array('name' => get_string('extendenrol'), 'link' => null, 'type' => 'misc'); -$navigation = build_navigation($navlinks); - -print_header("$course->shortname: ".get_string('extendenrol'), $course->fullname, $navigation, "", "", true, " ", navmenu($course)); +echo $OUTPUT->header(); $timeformat = get_string('strftimedate'); $unlimited = get_string('unlimited'); diff --git a/user/index.php b/user/index.php index 91852c2b73a..0b5c6af6a2a 100644 --- a/user/index.php +++ b/user/index.php @@ -150,12 +150,14 @@ $isseparategroups = ($course->groupmode == SEPARATEGROUPS and !has_capability('moodle/site:accessallgroups', $context)); - if ($isseparategroups and (!$currentgroup) ) { - $navlinks = array(); - $navlinks[] = array('name' => get_string('participants'), 'link' => null, 'type' => 'misc'); - $navigation = build_navigation($navlinks); + $PAGE->navbar->add(get_string('participants')); + $PAGE->set_title("$course->shortname: ".get_string('participants')); + $PAGE->set_heading($course->fullname); - print_header("$course->shortname: ".get_string('participants'), $course->fullname, $navigation, "", "", true, " ", navmenu($course)); + echo $OUTPUT->header(); + + if ($isseparategroups and (!$currentgroup) ) { + // The user is not in the group so show message and exit echo $OUTPUT->heading(get_string("notingroup")); echo $OUTPUT->footer(); exit; @@ -170,14 +172,6 @@ 'accesssince' => $accesssince, 'search' => s($search))); -/// Print headers - - $navlinks = array(); - $navlinks[] = array('name' => get_string('participants'), 'link' => null, 'type' => 'misc'); - $navigation = build_navigation($navlinks); - - print_header("$course->shortname: ".get_string('participants'), $course->fullname, $navigation, "", "", true, " ", navmenu($course)); - /// setting up tags if ($course->id == SITEID) { $filtertype = 'site'; diff --git a/user/messageselect.php b/user/messageselect.php index 0304a426c39..7414f50a38f 100644 --- a/user/messageselect.php +++ b/user/messageselect.php @@ -56,21 +56,19 @@ $strtitle = get_string('coursemessage'); - if (empty($messagebody)) { - $formstart = "theform.messagebody"; - } else { - $formstart = ""; - } - - $navlinks = array(); + $link = null; if (has_capability('moodle/course:viewparticipants', $coursecontext) || has_capability('moodle/site:viewparticipants', $systemcontext)) { - $navlinks[] = array('name' => get_string('participants'), 'link' => "index.php?id=$course->id", 'type' => 'misc'); + $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($strtitle); + $PAGE->set_title($strtitle); + $PAGE->set_heading($strtitle); + if (empty($messagebody)) { + $PAGE->set_focuscontrol('theform.messagebody'); } - $navlinks[] = array('name' => $strtitle, 'link' => null, 'type' => 'misc'); - $navigation = build_navigation($navlinks); - - print_header($strtitle,$strtitle,$navigation,$formstart); + echo $OUTPUT->header(); // if messaging is disabled on site, we can still allow users with capabilities to send emails instead if (empty($CFG->messaging)) { echo $OUTPUT->notification(get_string('messagingdisabled','message')); diff --git a/user/policy.php b/user/policy.php index fa1944048a7..b008a820053 100644 --- a/user/policy.php +++ b/user/policy.php @@ -33,8 +33,11 @@ $strpolicyagreement = get_string('policyagreement'); $strpolicyagreementclick = get_string('policyagreementclick'); - print_header($strpolicyagreement, $SITE->fullname, build_navigation(array(array('name'=>$strpolicyagreement, 'link'=>null, 'type'=>'misc')))); + $PAGE->set_title($strpolicyagreement); + $PAGE->set_heading($SITE->fullname); + $PAGE->navbar->add($strpolicyagreement); + echo $OUTPUT->header(); echo $OUTPUT->heading($strpolicyagreement); $mimetype = mimeinfo('type', $CFG->sitepolicy); diff --git a/user/portfolio.php b/user/portfolio.php index a8f9ccb3df2..84a204f5c03 100644 --- a/user/portfolio.php +++ b/user/portfolio.php @@ -29,14 +29,7 @@ $display = true; // set this to false in the conditions to stop processing require_login($course, false); -$navlinks[] = array('name' => $fullname, 'link' => $CFG->wwwroot . '/user/view.php?id=' . $user->id, 'type' => 'misc'); -$navlinks[] = array('name' => $strportfolios, 'link' => null, 'type' => 'misc'); - -$navigation = build_navigation($navlinks); - -print_header("$course->fullname: $fullname: $strportfolios", $course->fullname, - $navigation, "", "", true, " ", navmenu($course)); - +echo $OUTPUT->header(); $currenttab = 'portfolioconf'; $showroles = 1; include('tabs.php'); diff --git a/user/portfoliologs.php b/user/portfoliologs.php index 6e20d0ec551..d2ef8b1794f 100644 --- a/user/portfoliologs.php +++ b/user/portfoliologs.php @@ -22,13 +22,10 @@ require_login($course, false); $page = optional_param('page', 0, PARAM_INT); $perpage = optional_param('perpage', 10, PARAM_INT); -$navlinks[] = array('name' => $fullname, 'link' => $CFG->wwwroot . '/user/view.php?id=' . $user->id, 'type' => 'misc'); -$navlinks[] = array('name' => $strportfolios, 'link' => null, 'type' => 'misc'); +$PAGE->set_title("$course->fullname: $fullname: $strportfolios"); +$PAGE->set_heading($course->fullname); -$navigation = build_navigation($navlinks); - -print_header("$course->fullname: $fullname: $strportfolios", $course->fullname, - $navigation, "", "", true, " ", navmenu($course)); +echo $OUTPUT->header(); $currenttab = 'portfoliologs'; $showroles = 1; diff --git a/user/repository.php b/user/repository.php index 45c302be899..77f8547e46c 100644 --- a/user/repository.php +++ b/user/repository.php @@ -21,13 +21,13 @@ $pluginstr = get_string('plugin', 'repository'); require_login($course, false); -$navlinks[] = array('name' => $fullname, 'link' => $CFG->wwwroot . '/user/view.php?id=' . $user->id, 'type' => 'misc'); -$navlinks[] = array('name' => $strrepos, 'link' => null, 'type' => 'misc'); +$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($strrepos); +$PAGE->set_title("$course->fullname: $fullname: $strrepos"); +$PAGE->set_heading($course->fullname); -$navigation = build_navigation($navlinks); - -print_header("$course->fullname: $fullname: $strrepos", $course->fullname, - $navigation, "", "", true, " ", navmenu($course)); +echo $OUTPUT->header(); $currenttab = 'repositories'; include('tabs.php'); diff --git a/user/view.php b/user/view.php index 631adbb6698..a1e197043be 100644 --- a/user/view.php +++ b/user/view.php @@ -74,23 +74,26 @@ $fullname = fullname($user, has_capability('moodle/site:viewfullnames', $coursecontext)); - $navlinks = array(); + $link = null; if (has_capability('moodle/course:viewparticipants', $coursecontext) || has_capability('moodle/site:viewparticipants', $systemcontext)) { - $navlinks[] = array('name' => $strparticipants, 'link' => "index.php?id=$course->id", 'type' => 'misc'); + $link = new moodle_url($CFG->wwwroot."/user/index.php", array('id'=>$course->id)); } + $PAGE->navbar->add($strparticipants, null, null, navigation_node::TYPE_SETTING, $link); /// If the user being shown is not ourselves, then make sure we are allowed to see them! if (!$currentuser) { + + $PAGE->set_title("$strpersonalprofile: "); + $PAGE->set_heading("$strpersonalprofile: "); + if ($course->id == SITEID) { // Reduce possibility of "browsing" userbase at site level if ($CFG->forceloginforprofiles and !isteacherinanycourse() and !isteacherinanycourse($user->id) and !has_capability('moodle/user:viewdetails', $usercontext)) { // Teachers can browse and be browsed at site level. If not forceloginforprofiles, allow access (bug #4366) - $navlinks[] = array('name' => $struser, 'link' => null, 'type' => 'misc'); - $navigation = build_navigation($navlinks); - - print_header("$strpersonalprofile: ", "$strpersonalprofile: ", $navigation, "", "", true, " ", navmenu($course)); + $PAGE->navbar->add($struser); + echo $OUTPUT->header(); echo $OUTPUT->heading(get_string('usernotavailable', 'error')); echo $OUTPUT->footer(); exit; @@ -104,14 +107,10 @@ if (!has_capability('moodle/course:view', $coursecontext, $user->id, false)) { if (has_capability('moodle/course:view', $coursecontext)) { - $navlinks[] = array('name' => $fullname, 'link' => null, 'type' => 'misc'); - $navigation = build_navigation($navlinks); - print_header("$strpersonalprofile: ", "$strpersonalprofile: ", $navigation, "", "", true, " ", navmenu($course)); + $PAGE->navbar->add($fullname); echo $OUTPUT->heading(get_string('notenrolled', $fullname)); } else { - $navlinks[] = array('name' => $struser, 'link' => null, 'type' => 'misc'); - $navigation = build_navigation($navlinks); - print_header("$strpersonalprofile: ", "$strpersonalprofile: ", $navigation, "", "", true, " ", navmenu($course)); + $PAGE->navbar->add($struser); echo $OUTPUT->heading(get_string('notenrolledprofile')); } echo $OUTPUT->continue_button($_SERVER['HTTP_REFERER']); @@ -124,12 +123,9 @@ // If groups are in use, make sure we can see that group if (groups_get_course_groupmode($course) == SEPARATEGROUPS and !has_capability('moodle/site:accessallgroups', $coursecontext)) { require_login(); - ///this is changed because of mygroupid $gtrue = (bool)groups_get_all_groups($course->id, $user->id); if (!$gtrue) { - $navigation = build_navigation($navlinks); - print_header("$strpersonalprofile: ", "$strpersonalprofile: ", $navigation, "", "", true, " ", navmenu($course)); print_error("groupnotamember", '', "../course/view.php?id=$course->id"); } } @@ -138,13 +134,10 @@ /// We've established they can see the user's name at least, so what about the rest? - $navlinks[] = array('name' => $fullname, 'link' => null, 'type' => 'misc'); - - $navigation = build_navigation($navlinks); - - print_header("$course->fullname: $strpersonalprofile: $fullname", $course->fullname, - $navigation, "", "", true, " ", navmenu($course)); - + $PAGE->navbar->add($struser); + $PAGE->set_title("$course->fullname: $strpersonalprofile: $fullname"); + $PAGE->set_heading($course->fullname); + echo $OUTPUT->header(); if (($course->id != SITEID) and ! isguest() ) { // Need to have access to a course to see that info if (!has_capability('moodle/course:view', $coursecontext, $user->id)) {