Skip to content

Commit

Permalink
user MDL-19825 Upgraded print_header and build_navigation calls to us…
Browse files Browse the repository at this point in the history
…e PAGE and OUTPUT equivilants
  • Loading branch information
samhemelryk committed Sep 2, 2009
1 parent 46b0271 commit caa8363
Show file tree
Hide file tree
Showing 14 changed files with 98 additions and 109 deletions.
8 changes: 4 additions & 4 deletions user/addnote.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@

$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

Expand Down
20 changes: 11 additions & 9 deletions user/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
}

if ($user->deleted) {
print_header();
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('userdeleted'));
echo $OUTPUT->footer();
die;
Expand Down Expand Up @@ -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;
Expand Down
29 changes: 18 additions & 11 deletions user/editadvanced.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
}

if ($user->deleted) {
print_header();
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('userdeleted'));
echo $OUTPUT->footer();
die;
Expand Down Expand Up @@ -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 {
Expand All @@ -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';
Expand Down
6 changes: 5 additions & 1 deletion user/emailupdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
$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");
Expand Down
8 changes: 4 additions & 4 deletions user/extendenrol.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@

/// 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');
Expand Down
11 changes: 5 additions & 6 deletions user/groupaddnote.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,14 @@
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

Expand Down
11 changes: 5 additions & 6 deletions user/groupextendenrol.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,12 @@
redirect("$CFG->wwwroot/user/index.php?id=$id", get_string('changessaved'));
}

/// 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));
/// Print headers
echo $OUTPUT->header();

$timeformat = get_string('strftimedate');
$unlimited = get_string('unlimited');
Expand Down
20 changes: 7 additions & 13 deletions user/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

echo $OUTPUT->header();

print_header("$course->shortname: ".get_string('participants'), $course->fullname, $navigation, "", "", true, "&nbsp;", navmenu($course));
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;
Expand All @@ -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';
Expand Down
22 changes: 10 additions & 12 deletions user/messageselect.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand Down
5 changes: 4 additions & 1 deletion user/policy.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
9 changes: 1 addition & 8 deletions user/portfolio.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,7 @@

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');
Expand Down
9 changes: 3 additions & 6 deletions user/portfoliologs.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,10 @@
$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;
Expand Down
12 changes: 6 additions & 6 deletions user/repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@

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');
Expand Down
37 changes: 15 additions & 22 deletions user/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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']);
Expand All @@ -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");
}
}
Expand All @@ -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)) {
Expand Down

0 comments on commit caa8363

Please sign in to comment.