]> git.mjollnir.org Git - moodle.git/commitdiff
enrol MDL-19795 Upgraded print_header and build_navigation calls to OUTPUT/PAGE equiv...
authorsamhemelryk <samhemelryk>
Fri, 4 Sep 2009 06:29:26 +0000 (06:29 +0000)
committersamhemelryk <samhemelryk>
Fri, 4 Sep 2009 06:29:26 +0000 (06:29 +0000)
enrol/authorize/enrol.php
enrol/authorize/locallib.php
enrol/authorize/uploadcsv.php
enrol/imsenterprise/importnow.php
enrol/manual/enrol.php
enrol/paypal/enrol.php
enrol/paypal/return.php

index 686263542eb1bae989ec20a03821e2881fb403b0..c74f05ea98388c61606e45a889a5e28d1a3a4405 100755 (executable)
@@ -29,8 +29,7 @@ class enrolment_plugin_authorize
      */
     public function print_entry($course)
     {
-        global $CFG, $USER, $OUTPUT;
-        global $form;
+        global $CFG, $USER, $OUTPUT, $PAGE, $form;
 
         $zerocost = zero_cost($course);
         if ($zerocost) {
@@ -58,12 +57,11 @@ class enrolment_plugin_authorize
         $strcourses = get_string('courses');
         $strloginto = get_string('loginto', '', $course->shortname);
 
-        $navlinks = array();
-        $navlinks[] = array('name' => $strcourses, 'link' => "$CFG->wwwroot/course/", 'type' => 'misc');
-        $navlinks[] = array('name' => $strloginto, 'link' => null, 'type' => 'misc');
-        $navigation = build_navigation($navlinks);
-
-        print_header($strloginto, $course->fullname, $navigation);
+        $PAGE->navbar->add($strcourses, new moodle_url($CFG->wwwroot.'/course/'));
+        $PAGE->navbar->add($strloginto);
+        $PAGE->set_title($strloginto);
+        $PAGE->set_heading($course->fullname);
+        echo $OUTPUT->header();
         print_course($course, '80%');
 
         if ($course->password) {
index ef4105145c813fa1cef4c77561bb58f6999a5091..33118ddd10d41eaabdfeace09ffbae14f6c51512 100644 (file)
@@ -77,13 +77,15 @@ function authorize_print_orders($courseid, $userid) {
         $popupmenu .= $OUTPUT->checkbox($checkbox, 'showonlymy');
     }
 
-    $navlinks = array();
     if (SITEID != $courseid) {
-        $navlinks[] = array('name' => $course->shortname, 'link' => "$CFG->wwwroot/course/view.php?id=".$course->id, 'type' => 'misc');
+        $PAGE->navbar->add($course->shortname, new moodle_url($CFG->wwwroot.'/course/view.php', array('id'=>$course->id)));
     }
-    $navlinks[] = array('name' => $authstrs->paymentmanagement, 'link' => 'index.php', 'type' => 'misc');
-    $navigation = build_navigation($navlinks);
-    print_header("$course->shortname: $authstrs->paymentmanagement", $authstrs->paymentmanagement, $navigation, '', '', false, $buttons, $popupmenu);
+    $PAGE->navbar->add($authstrs->paymentmanagement, 'index.php');
+    $PAGE->set_title("$course->shortname: $authstrs->paymentmanagement");
+    $PAGE->set_heading($authstrs->paymentmanagement);
+    $PAGE->set_headingmenu($popupmenu);
+    $PAGE->set_button($buttons);
+    echo $OUTPUT->header();
 
     $table = new flexible_table('enrol-authorize');
     $table->set_attribute('width', '100%');
@@ -221,7 +223,7 @@ function authorize_print_orders($courseid, $userid) {
  */
 function authorize_print_order($orderid)
 {
-    global $CFG, $USER, $DB, $OUTPUT;
+    global $CFG, $USER, $DB, $OUTPUT, $PAGE;
     global $strs, $authstrs;
 
     $do = optional_param('do', '', PARAM_ALPHA);
@@ -265,14 +267,16 @@ function authorize_print_order($orderid)
         }
     }
 
-    $navlinks = array();
-    if (SITEID != $course->id) {
-        $navlinks[] = array('name' => $course->shortname, 'link' => "$CFG->wwwroot/course/view.php?id=".$course->id, 'type' => 'misc');
+    if (SITEID != $courseid) {
+        $PAGE->navbar->add($course->shortname, new moodle_url($CFG->wwwroot.'/course/view.php', array('id'=>$course->id)));
     }
-    $navlinks[] = array('name' => $authstrs->paymentmanagement, 'link' => 'index.php?course='.$course->id, 'type' => 'misc');
-    $navlinks[] = array('name' => $authstrs->orderid . ': ' . $orderid, 'link' => '', 'type' => 'misc');
-    $navigation = build_navigation($navlinks);
-    print_header("$course->shortname: $authstrs->paymentmanagement", $authstrs->orderdetails, $navigation, '', '', false, $buttons);
+    $PAGE->navbar->add($authstrs->paymentmanagement, 'index.php?course='.$course->id);
+    $PAGE->navbar->add($authstrs->orderid . ': ' . $orderid, 'index.php');
+    $PAGE->set_title("$course->shortname: $authstrs->paymentmanagement");
+    $PAGE->set_heading($authstrs->orderdetails);
+    $PAGE->set_cacheable(false);
+    $PAGE->set_button($buttons);
+    echo $OUTPUT->header();
 
     $table = new html_table();
     $table->width = '100%';
index 4ddc1ba308a7c7fe2c6aa2603977b76fd9fe8a01..8f8ecaa54624fa564f7d0c8e42a1e4b393642b6a 100644 (file)
 
 /// Print header
     $struploadcsv = get_string('uploadcsv', 'enrol_authorize');
-    $navlinks = array();
-    $navlinks[] = array('name' => get_string('paymentmanagement', 'enrol_authorize'), 'link' => 'index.php', 'type' => 'misc');
-    $navlinks[] = array('name' => $struploadcsv, 'link' => "uploadcsv.php", 'type' => 'misc');
-    $navigation = build_navigation($navlinks);
-
     $managebutton = "<form method='get' action='index.php'><div><input type='submit' value='".get_string('paymentmanagement', 'enrol_authorize')."' /></div></form>";
 
-    print_header_simple($struploadcsv, '', $navigation, '', '', false, $managebutton);
+    $PAGE->navbar->add(get_string('paymentmanagement', 'enrol_authorize'), 'index.php');
+    $PAGE->navbar->add($struploadcsv, 'uploadcsv.php');
+    $PAGE->set_title($struploadcsv);
+    $PAGE->set_cacheable(false);
+    $PAGE->set_button($managebutton);
+    echo $OUTPUT->header();
     print_heading_with_help($struploadcsv, 'authorize/uploadcsv', 'enrol');
 
 /// Handle CSV file
index 681c0f8807ca2b1b0dbef42db22522e342b5eca4..05fefb8d1825dbe22152e83785794e88bd7a6b27 100644 (file)
@@ -9,13 +9,13 @@ if (!$site = get_site()) {
 
 /// get language strings
 $str = get_strings(array('enrolments', 'users', 'administration', 'settings'));
-$navlinks = array();
-$navlinks[] = array('name' => $str->administration, 'link' => "../../$CFG->admin/index.php", 'type' => 'misc');
-$navlinks[] = array('name' => $str->enrolments, 'link' => null, 'type' => 'misc');
-$navlinks[] = array('name' => 'IMS import', 'link' => null, 'type' => 'misc');
-$navigation = build_navigation($navlinks);
 
-print_header("$site->shortname: $str->enrolments", $site->fullname, $navigation);
+$PAGE->set_title("$site->shortname: $str->enrolments");
+$PAGE->set_heading($site->fullname);
+$PAGE->navbar->add($str->administration, new moodle_url($CFG->wwwroot.'/'.$CFG->admin.'/index.php'));
+$PAGE->navbar->add($str->enrolments);
+$PAGE->navbar->add('IMS import');
+echo $OUTPUT->header();
 
 require_once('enrol.php');
 
index 862b8db3f16399b51aac6a288be4114c24862618..08fc51d57e912395841e325c09af497eaf9c4f99 100644 (file)
@@ -48,7 +48,7 @@ var $errormsg;
 * @param    course  current course object
 */
 function print_entry($course) {
-    global $CFG, $USER, $SESSION, $THEME, $OUTPUT;
+    global $CFG, $USER, $SESSION, $THEME, $OUTPUT, $PAGE;
 
     $strloginto = get_string('loginto', '', $course->shortname);
     $strcourses = get_string('courses');
@@ -57,10 +57,8 @@ function print_entry($course) {
 
     $context = get_context_instance(CONTEXT_SYSTEM);
 
-    $navlinks = array();
-    $navlinks[] = array('name' => $strcourses, 'link' => ".", 'type' => 'misc');
-    $navlinks[] = array('name' => $strloginto, 'link' => null, 'type' => 'misc');
-    $navigation = build_navigation($navlinks);
+    $PAGE->navbar->add($strcourses);
+    $PAGE->navbar->add($strloginto);
 
     if ($course->password == '') {   // no password, so enrol
 
@@ -68,8 +66,9 @@ function print_entry($course) {
             add_to_log($course->id, 'course', 'guest', 'view.php?id='.$course->id, getremoteaddr());
 
         } else if (empty($_GET['confirm']) && empty($_GET['cancel'])) {
-
-            print_header($strloginto, $course->fullname, $navigation);
+            $PAGE->set_title($strloginto);
+            $PAGE->set_heading($course->fullname);
+            echo $OUTPUT->header();
             echo '<br />';
             echo $OUTPUT->confirm(get_string('enrolmentconfirmation'), "enrol.php?id=$course->id&confirm=1", "enrol.php?id=$course->id&cancel=1");
             echo $OUTPUT->footer();
@@ -110,7 +109,10 @@ function print_entry($course) {
         $password = '';
     }
 
-    print_header($strloginto, $course->fullname, $navigation, "form.password");
+    $PAGE->set_title($strloginto);
+    $PAGE->set_heading($course->fullname);
+    $PAGE->set_focuscontrol('form.password');
+    echo $OUTPUT->header();
 
     print_course($course, "80%");
 
index a74b9456015595cbcc82d02fe4e131cad3d823d3..c7a9dce7ab67c5b0f7438f500d8a530daa3fc7b0 100644 (file)
@@ -9,7 +9,7 @@ class enrolment_plugin_paypal {
 
 /// Override the base print_entry() function
 function print_entry($course) {
-    global $CFG, $USER, $OUTPUT;
+    global $CFG, $USER, $OUTPUT, $PAGE;
 
 
     $strloginto = get_string("loginto", "", $course->shortname);
@@ -29,12 +29,11 @@ function print_entry($course) {
         $manual->print_entry($course);
 
     } else {
-        $navlinks = array();
-        $navlinks[] = array('name' => $strcourses, 'link' => "$CFG->wwwroot/course", 'type' => 'misc');
-        $navlinks[] = array('name' => $strloginto, 'link' => null, 'type' => 'misc');
-        $navigation = build_navigation($navlinks);
-
-        print_header($strloginto, $course->fullname, $navigation);
+        $PAGE->navbar->add($strcourses, new moodle_url($CFG->wwwroot.'/course/'));
+        $PAGE->navbar->add($strloginto);
+        $PAGE->set_title($strloginto);
+        $PAGE->set_heading($course->fullname);
+        echo $OUTPUT->header();
         print_course($course, "80%");
 
         if ($course->password) {  // Presenting two options
index 7d6724aef56086d21063dc08cef39bdd48f169e0..400beba4462e5f7b6b6f1f41e976dd2bb80ab6fc 100644 (file)
@@ -29,7 +29,7 @@
         redirect($destination, get_string('paymentthanks', '', $course->fullname));
 
     } else {   /// Somehow they aren't enrolled yet!  :-(
-        print_header();
+        echo $OUTPUT->header();
         notice(get_string('paymentsorry', '', get_string('defaultcourseteacher')), $destination);
     }