]> git.mjollnir.org Git - moodle.git/commitdiff
login MDL-19800 Upgraded print_header and build_navigation calls to use PAGE and...
authorsamhemelryk <samhemelryk>
Thu, 3 Sep 2009 06:04:29 +0000 (06:04 +0000)
committersamhemelryk <samhemelryk>
Thu, 3 Sep 2009 06:04:29 +0000 (06:04 +0000)
login/change_password.php
login/confirm.php
login/forgot_password.php
login/index.php
login/logout.php
login/mnet_email.php
login/signup.php

index 149968172e63bae74a0a1eee87369e7baa52a475..27b675846c0681e86c9192d0ee7284efe1daf60e 100644 (file)
 
         $fullname = fullname($USER, true);
 
-        $navlinks[] = array('name' => $fullname,
-                            'link' => "$CFG->wwwroot/user/view.php?id=$USER->id&amp;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&amp;course=$id";
 
     $fullname = fullname($USER, true);
 
-    $navlinks[] = array('name' => $fullname, 'link' => "$CFG->wwwroot/user/view.php?id=$USER->id&amp;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'));
     }
index 029a6eb079c5e8e42c7560be752c6a6ce99320e7..775ace2db8e0b3b0be3f2d3f795d90afeb519970 100644 (file)
@@ -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 "<h3>".get_string("thanks").", ". fullname($user) . "</h3>\n";
             echo "<p>".get_string("alreadyconfirmed")."</p>\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 "<h3>".get_string("thanks").", ". fullname($USER) . "</h3>\n";
             echo "<p>".get_string("confirmed")."</p>\n";
index 153c1b2de02ee51557bf823be2d2d7b9b5c777c8..d29aa1c12c92876ccc60b6c5ed4ee104c350eee4 100644 (file)
@@ -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();
 
index f2d8127781fb7efef318c9b33f05c6081aff7e37..099c60c80391fece3136637f82dfe7ae6841d661 100644 (file)
@@ -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
             }
 
             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();
                     $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("<div class=\"langmenu\">$langmenu</div>");
                 if (intval($days2expire) > 0 && intval($days2expire) < intval($userauth->config->expiration_warning)) {
-                    print_header("$site->fullname: $loginsite", "$site->fullname", $navigation, '', '', true, "<div class=\"langmenu\">$langmenu</div>");
+                    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, "<div class=\"langmenu\">$langmenu</div>");
+                    echo $OUTPUT->header();
                     echo $OUTPUT->confirm(get_string('auth_passwordisexpired', 'auth'), $passwordchangeurl, $urltogo);
                     echo $OUTPUT->footer();
                     exit;
         $show_instructions = false;
     }
 
-    print_header("$site->fullname: $loginsite", $site->fullname, $navigation, $focus,
-                 '', true, '<div class="langmenu">'.$langmenu.'</div>');
+    $PAGE->set_title("$site->fullname: $loginsite");
+    $PAGE->set_heading("$site->fullname");
+    $PAGE->set_headingmenu("<div class=\"langmenu\">$langmenu</div>");
+    $PAGE->set_focuscontrol($focus);
 
+    echo $OUTPUT->header();
     include("index_form.html");
-
     echo $OUTPUT->footer();
 
 
index fb5f3a633e875495c24552f93ac265a7f7006615..d28511b629cfbe216a28897ff21bf4a0b79e80ef 100644 (file)
@@ -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;
index 5faf587a109f483e52bc0b5d758dc753cccb140e..e556c7ac95a2f5e5d0025a8114fc05d6f67f626b 100644 (file)
@@ -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');
   <form method="post">
     <input type="hidden" name="sesskey" value="<?php echo $sesskey; ?>">
     <?php echo get_string('email') ?>:
-    <input type="text" name="email" size="" maxlength="100" />
+    <input type="text" name="email" id="email" size="" maxlength="100" />
     <input type="submit" value="Find Login" />
   </form>
 <?php
index 82b2c737e23360dd71b1c5be12bdf5ea715629a2..2c366291e663c2665399fbb663cba339f4bc3556 100644 (file)
         $langmenu = $OUTPUT->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, "<div class=\"langmenu\">$langmenu</div>");
-    
+    $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("<div class=\"langmenu\">$langmenu</div>");
+
+    echo $OUTPUT->header();
     $mform_signup->display();
     echo $OUTPUT->footer();