]> git.mjollnir.org Git - moodle.git/commitdiff
user MDL-19825 Upgraded print_header and build_navigation calls to use PAGE and OUTPU...
authorsamhemelryk <samhemelryk>
Wed, 2 Sep 2009 08:36:16 +0000 (08:36 +0000)
committersamhemelryk <samhemelryk>
Wed, 2 Sep 2009 08:36:16 +0000 (08:36 +0000)
14 files changed:
user/addnote.php
user/edit.php
user/editadvanced.php
user/emailupdate.php
user/extendenrol.php
user/groupaddnote.php
user/groupextendenrol.php
user/index.php
user/messageselect.php
user/policy.php
user/portfolio.php
user/portfoliologs.php
user/repository.php
user/view.php

index 23b6d3c26ed87051374989d6601300bb86e987f0..a5f22a870f4b5b2ff589669d1c2e5d1745950acc 100644 (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, "&nbsp;", 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
 
index 7c7b8532a3ab51e730ea4d0e352b79e9600d518a..8dd2df40c1238dff82093e88398497ba1a7a8cbe 100644 (file)
@@ -82,7 +82,7 @@
     }
 
     if ($user->deleted) {
-        print_header();
+        echo $OUTPUT->header();
         echo $OUTPUT->heading(get_string('userdeleted'));
         echo $OUTPUT->footer();
         die;
     $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&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;
index b1f19f2b43573710f37f553f989b3ad1d87f30ae..b8961e5e239af4fe0ea1d798e7b82ba42e2673b6 100644 (file)
@@ -60,7 +60,7 @@
     }
 
     if ($user->deleted) {
-        print_header();
+        echo $OUTPUT->header();
         echo $OUTPUT->heading(get_string('userdeleted'));
         echo $OUTPUT->footer();
         die;
     } 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, "&nbsp;", "&nbsp;");
+
+        $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 {
         $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';
index 6d0eb00e632c90cfa2c50453fa90a1d75f1ca9de..44be5513a23cfe983a00cf6212e59af857b8d8ce 100755 (executable)
@@ -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");
index e37d15b24d521267f78c26267e85c9e41b2ea990..f752a4f9b4e55f039ae39f20929fb2b36896b242 100644 (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');
index 7431281bfbc5ddd4a3ae3b939e583747938f0ba3..031c49da4c63f762ab6f1602b2e6a44e8dcb12f7 100644 (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
 
index ecbbde310689bec1ed5bd8904dbabd1fca14e053..cf020a4220e48f4b33da4cc175532270d6ba3323 100755 (executable)
@@ -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'));
 }
 
-/// 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');
index 91852c2b73a7a6e905bd08b0980d774dcac93508..0b5c6af6a2a46905638493803b6ed24e6f4c7f6a 100644 (file)
 
     $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;
             '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';
index 0304a426c39ac78438083bb8497bf724048bd5e6..7414f50a38f0f4992e04a2dd9f225b57e4ae6ef4 100644 (file)
 
     $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'));
index fa1944048a799446fcaba1a9a16f4170db6a3bd1..b008a820053d4cc7c51cf622077a3cc1d875d09a 100644 (file)
     $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);
index a8f9ccb3df23b33decc516e3b15425719a97c3d2..84a204f5c03d19f62db82041c070618ae9130b66 100644 (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');
index 6e20d0ec551d56fb924c6755c9d1d8816246b7c0..d2ef8b1794f9fb14060ec7ffc08f3ee20d65e2cc 100644 (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;
index 45c302be899ffc0e8c5fce1d3c1dc989c2ba8ac7..77f8547e46c8d0574208d564d39d27ff8e207f2e 100644 (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');
index 631adbb6698ed4efb874b4524a30866f07003c0e..a1e197043be869e42fc07fb6a55a0eea2ed0490c 100644 (file)
 
     $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;
 
             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']);
         // 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");
             }
         }
 
 /// 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)) {