user MDL-19825 Upgraded print_header and build_navigation calls to use PAGE and OUTPUT equivilants

This commit is contained in:
samhemelryk 2009-09-02 08:36:16 +00:00
parent 46b02712fd
commit caa8363f83
14 changed files with 98 additions and 109 deletions

View File

@ -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

View File

@ -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;

View File

@ -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 '<br />';
} 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&amp;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';

View File

@ -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");

View File

@ -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, "&nbsp;", navmenu($course));
echo $OUTPUT->header();
$timeformat = get_string('strftimedate');
$unlimited = get_string('unlimited');

View File

@ -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, "&nbsp;", 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

View File

@ -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, "&nbsp;", navmenu($course));
echo $OUTPUT->header();
$timeformat = get_string('strftimedate');
$unlimited = get_string('unlimited');

View File

@ -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, "&nbsp;", 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, "&nbsp;", navmenu($course));
/// setting up tags
if ($course->id == SITEID) {
$filtertype = 'site';

View File

@ -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'));

View File

@ -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);

View File

@ -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, "&nbsp;", navmenu($course));
echo $OUTPUT->header();
$currenttab = 'portfolioconf';
$showroles = 1;
include('tabs.php');

View File

@ -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, "&nbsp;", navmenu($course));
echo $OUTPUT->header();
$currenttab = 'portfoliologs';
$showroles = 1;

View File

@ -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, "&nbsp;", navmenu($course));
echo $OUTPUT->header();
$currenttab = 'repositories';
include('tabs.php');

View File

@ -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, "&nbsp;", 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, "&nbsp;", 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, "&nbsp;", 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, "&nbsp;", 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, "&nbsp;", 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)) {