From 86bb4f92f5bd586ea4ec4e2e7631b6bb095e5f44 Mon Sep 17 00:00:00 2001 From: samhemelryk Date: Thu, 3 Sep 2009 06:04:29 +0000 Subject: [PATCH] login MDL-19800 Upgraded print_header and build_navigation calls to use PAGE and OUTPUT equivilants --- login/change_password.php | 23 ++++++++++++----------- login/confirm.php | 8 ++++++-- login/forgot_password.php | 23 +++++++++++++++-------- login/index.php | 22 ++++++++++++++-------- login/logout.php | 4 +++- login/mnet_email.php | 10 +++++++--- login/signup.php | 14 ++++++++------ 7 files changed, 65 insertions(+), 39 deletions(-) diff --git a/login/change_password.php b/login/change_password.php index 149968172e..27b675846c 100644 --- a/login/change_password.php +++ b/login/change_password.php @@ -78,13 +78,12 @@ $fullname = fullname($USER, true); - $navlinks[] = array('name' => $fullname, - 'link' => "$CFG->wwwroot/user/view.php?id=$USER->id&course=$course->id", - 'type' => 'misc'); - $navlinks[] = array('name' => $strpasswordchanged, 'link' => null, 'type' => 'misc'); - $navigation = build_navigation($navlinks); - - print_header($strpasswordchanged, $strpasswordchanged, $navigation); + $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($strpasswordchanged); + $PAGE->set_title($strpasswordchanged); + $PAGE->set_header($strpasswordchanged); + echo $OUTPUT->header(); if (empty($SESSION->wantsurl) or $SESSION->wantsurl == $CFG->httpswwwroot.'/login/change_password.php') { $returnto = "$CFG->wwwroot/user/view.php?id=$USER->id&course=$id"; @@ -103,11 +102,13 @@ $fullname = fullname($USER, true); - $navlinks[] = array('name' => $fullname, 'link' => "$CFG->wwwroot/user/view.php?id=$USER->id&course=$course->id", 'type' => 'misc'); - $navlinks[] = array('name' => $strchangepassword, 'link' => null, 'type' => 'misc'); - $navigation = build_navigation($navlinks); + $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($strchangepassword); + $PAGE->set_title($strchangepassword); + $PAGE->set_header($strchangepassword); + echo $OUTPUT->header(); - print_header($strchangepassword, $strchangepassword, $navigation); if (get_user_preferences('auth_forcepasswordchange')) { echo $OUTPUT->notification(get_string('forcepasswordchangenotice')); } diff --git a/login/confirm.php b/login/confirm.php index 029a6eb079..775ace2db8 100644 --- a/login/confirm.php +++ b/login/confirm.php @@ -31,7 +31,9 @@ if ($confirmed == AUTH_CONFIRM_ALREADY) { $user = get_complete_user_data('username', $username); - print_header(get_string("alreadyconfirmed"), get_string("alreadyconfirmed"), array(), ""); + $PAGE->set_title(get_string("alreadyconfirmed")); + $PAGE->set_heading(get_string("alreadyconfirmed")); + echo $OUTPUT->header(); echo $OUTPUT->box_start('generalbox centerpara boxwidthnormal boxaligncenter'); echo "

".get_string("thanks").", ". fullname($user) . "

\n"; echo "

".get_string("alreadyconfirmed")."

\n"; @@ -56,7 +58,9 @@ redirect($goto); } - print_header(get_string("confirmed"), get_string("confirmed"), array(), ""); + $PAGE->set_title(get_string("confirmed")); + $PAGE->set_heading(get_string("confirmed")); + echo $OUTPUT->header(); echo $OUTPUT->box_start('generalbox centerpara boxwidthnormal boxaligncenter'); echo "

".get_string("thanks").", ". fullname($USER) . "

\n"; echo "

".get_string("confirmed")."

\n"; diff --git a/login/forgot_password.php b/login/forgot_password.php index 153c1b2de0..d29aa1c12c 100644 --- a/login/forgot_password.php +++ b/login/forgot_password.php @@ -18,8 +18,8 @@ $systemcontext = get_context_instance(CONTEXT_SYSTEM); $strforgotten = get_string('passwordforgotten'); $strlogin = get_string('login'); -$navigation = build_navigation(array(array('name' => $strlogin, 'link' => get_login_url(), 'type' => 'misc'), - array('name' => $strforgotten, 'link' => null, 'type' => 'misc'))); +$PAGE->navbar->add($strlogin, null, null, navigation_node::TYPE_CUSTOM, get_login_url()); +$PAGE->navbar->add($strforgotten); // if alternatepasswordurl is defined, then we'll just head there if (!empty($CFG->forgottenpasswordurl)) { @@ -38,11 +38,13 @@ if ($p_secret !== false) { update_login_count(); + $PAGE->set_title($strforgotten); + $PAGE->set_heading($strforgotten); + $user = get_complete_user_data('username', $p_username); if (!empty($user) and $user->secret === '') { - print_header($strforgotten, $strforgotten, $navigation); + echo $OUTPUT->header(); print_error('secretalreadyused'); - } else if (!empty($user) and $user->secret == $p_secret) { // make sure that url relates to a valid user @@ -71,7 +73,7 @@ if ($p_secret !== false) { $a->email = $user->email; $a->link = $changepasswordurl; - print_header($strforgotten, $strforgotten, $navigation); + echo $OUTPUT->header(); notice(get_string('emailpasswordsent', '', $a), $changepasswordurl); } else { @@ -79,7 +81,7 @@ if ($p_secret !== false) { // somebody probably tries to hack in by guessing secret - stop them! $DB->set_field('user', 'secret', '', array('id'=>$user->id)); } - print_header($strforgotten, $strforgotten, $navigation); + echo $OUTPUT->header(); print_error('forgotteninvalidurl'); } @@ -129,7 +131,9 @@ if ($mform->is_cancelled()) { } } - print_header($strforgotten, $strforgotten, $navigation); + $PAGE->set_title($strforgotten); + $PAGE->set_heading($strforgotten); + echo $OUTPUT->header(); if (empty($user->email) or !empty($CFG->protectusernames)) { // Print general confirmation message @@ -147,8 +151,11 @@ if ($mform->is_cancelled()) { /// DISPLAY FORM -print_header($strforgotten, $strforgotten, $navigation, 'id_email'); +$PAGE->set_title($strforgotten); +$PAGE->set_heading($strforgotten); +$PAGE->set_focuscontrol('id_email'); +echo $OUTPUT->header(); echo $OUTPUT->box(get_string('passwordforgotteninstructions'), 'generalbox boxwidthnormal boxaligncenter'); $mform->display(); diff --git a/login/index.php b/login/index.php index f2d8127781..099c60c803 100644 --- a/login/index.php +++ b/login/index.php @@ -53,8 +53,7 @@ } $loginsite = get_string("loginsite"); - $navlinks = array(array('name' => $loginsite, 'link' => null, 'type' => 'misc')); - $navigation = build_navigation($navlinks); + $PAGE->navbar->add($loginsite); if ($user !== false or $frm !== false) { // some auth plugin already supplied these @@ -127,7 +126,9 @@ } if (empty($user->confirmed)) { // This account was never confirmed - print_header(get_string("mustconfirm"), get_string("mustconfirm") ); + $PAGE->set_title(get_string("mustconfirm")); + $PAGE->set_heading(get_string("mustconfirm")); + echo $OUTPUT->header(); echo $OUTPUT->heading(get_string("mustconfirm")); echo $OUTPUT->box(get_string("emailconfirmsent", "", $user->email), "generalbox boxaligncenter"); echo $OUTPUT->footer(); @@ -180,13 +181,16 @@ $passwordchangeurl = $CFG->httpswwwroot.'/login/change_password.php'; } $days2expire = $userauth->password_expire($USER->username); + $PAGE->set_title("$site->fullname: $loginsite"); + $PAGE->set_heading("$site->fullname"); + $PAGE->set_headingmenu("
$langmenu
"); if (intval($days2expire) > 0 && intval($days2expire) < intval($userauth->config->expiration_warning)) { - print_header("$site->fullname: $loginsite", "$site->fullname", $navigation, '', '', true, "
$langmenu
"); + echo $OUTPUT->header(); echo $OUTPUT->confirm(get_string('auth_passwordwillexpire', 'auth', $days2expire), $passwordchangeurl, $urltogo); echo $OUTPUT->footer(); exit; } elseif (intval($days2expire) < 0 ) { - print_header("$site->fullname: $loginsite", "$site->fullname", $navigation, '', '', true, "
$langmenu
"); + echo $OUTPUT->header(); echo $OUTPUT->confirm(get_string('auth_passwordisexpired', 'auth'), $passwordchangeurl, $urltogo); echo $OUTPUT->footer(); exit; @@ -281,11 +285,13 @@ $show_instructions = false; } - print_header("$site->fullname: $loginsite", $site->fullname, $navigation, $focus, - '', true, '
'.$langmenu.'
'); + $PAGE->set_title("$site->fullname: $loginsite"); + $PAGE->set_heading("$site->fullname"); + $PAGE->set_headingmenu("
$langmenu
"); + $PAGE->set_focuscontrol($focus); + echo $OUTPUT->header(); include("index_form.html"); - echo $OUTPUT->footer(); diff --git a/login/logout.php b/login/logout.php index fb5f3a633e..d28511b629 100644 --- a/login/logout.php +++ b/login/logout.php @@ -14,7 +14,9 @@ redirect($redirect); } else if (!confirm_sesskey($sesskey)) { - print_header($SITE->fullname, $SITE->fullname, 'home'); + $PAGE->set_title($SITE->fullname); + $PAGE->set_heading($SITE->fullname); + echo $OUTPUT->header(); echo $OUTPUT->confirm(get_string('logoutconfirm'), 'logout.php', $CFG->wwwroot.'/'); echo $OUTPUT->footer(); die; diff --git a/login/mnet_email.php b/login/mnet_email.php index 5faf587a10..e556c7ac95 100644 --- a/login/mnet_email.php +++ b/login/mnet_email.php @@ -10,9 +10,13 @@ $sesskey = sesskey(); if (isloggedin() and !isguestuser()) { redirect( $CFG->wwwroot.'/', get_string('loginalready'), 5); } -$navigation = build_navigation(array(array('name' => 'MNET ID Provider', 'link' => null, 'type' => 'misc'))); -print_header('MNET ID Provider', 'MNET ID Provider', $navigation, 'form.email' ); +$PAGE->navbar->add('MNET ID Provider'); +$PAGE->set_title('MNET ID Provider'); +$PAGE->set_heading('MNET ID Provider'); +$PAGE->set_focuscontrol('email'); + +echo $OUTPUT->header(); if ($form = data_submitted() and confirm_sesskey()) { if ($user = $DB->get_record('user', array('username'=>$username, 'email'=>$form->email))) { @@ -29,7 +33,7 @@ echo $OUTPUT->box_start('generalbox boxaligncenter boxwidthnormal');
: - +
select($select); } - $navlinks = array(); - $navlinks[] = array('name' => $login, 'link' => "index.php", 'type' => 'misc'); - $navlinks[] = array('name' => $newaccount, 'link' => null, 'type' => 'misc'); - $navigation = build_navigation($navlinks); - print_header($newaccount, $newaccount, $navigation, $mform_signup->focus(), "", true, "
$langmenu
"); - + $PAGE->navbar->add($login); + $PAGE->navbar->add($newaccount); + $PAGE->set_title($newaccount); + $PAGE->set_heading($newaccount); + $PAGE->set_focuscontrol($mform_signup->focus()); + $PAGE->set_headingmenu("
$langmenu
"); + + echo $OUTPUT->header(); $mform_signup->display(); echo $OUTPUT->footer(); -- 2.39.5