]> git.mjollnir.org Git - moodle.git/commitdiff
mod-quiz MDL-19813 Updated print_header and build_navigation to OUTPUT and PAGE equiv...
authorsamhemelryk <samhemelryk>
Mon, 7 Sep 2009 02:11:54 +0000 (02:11 +0000)
committersamhemelryk <samhemelryk>
Mon, 7 Sep 2009 02:11:54 +0000 (02:11 +0000)
mod/quiz/accessrules.php
mod/quiz/addrandom.php
mod/quiz/attemptlib.php
mod/quiz/comment.php
mod/quiz/edit.php
mod/quiz/index.php
mod/quiz/report/default.php
mod/quiz/reviewquestion.php
mod/quiz/view.php

index 0d5c3aa15508376664e3926c9f34f33baa8b7bcd..36e3d8b2527c2d23eb12358ef78d500b9b9bb9c8 100644 (file)
@@ -226,7 +226,7 @@ class quiz_access_manager {
         global $CFG, $OUTPUT;
         $url = $this->_quizobj->view_url();
         if ($this->securewindow_required($canpreview)) {
-            print_header();
+            echo $OUTPUT->header();
             echo $OUTPUT->box_start();
             if ($message) {
                 echo '<p>' . $message . '</p><p>' . get_string('windowclosing', 'quiz') . '</p>';
@@ -599,7 +599,7 @@ class password_access_rule extends quiz_access_rule_base {
      * @return mixed return null, unless $return is true, and a form needs to be displayed.
      */
     public function do_password_check($canpreview, $accessmanager, $return = false) {
-        global $CFG, $SESSION, $OUTPUT;
+        global $CFG, $SESSION, $OUTPUT, $PAGE;
 
     /// We have already checked the password for this quiz this session, so don't ask again.
         if (!empty($SESSION->passwordcheckedquizzes[$this->_quiz->id])) {
@@ -623,7 +623,8 @@ class password_access_rule extends quiz_access_rule_base {
 
     /// Start the page and print the quiz intro, if any.
         if (!$return) {
-            print_header('', '', '', 'quizpassword');
+            $PAGE->set_focuscontrol('quizpassword');
+            echo $OUTPUT->header();
         }
         if (trim(strip_tags($this->_quiz->intro))) {
             $cm = get_coursemodule_from_id('quiz', $this->_quiz->id);
@@ -744,11 +745,15 @@ class securewindow_access_rule extends quiz_access_rule_base {
      *
      * @param string $title HTML title tag content, passed to printheader.
      * @param string $headtags extra stuff to go in the HTML head tag, passed to printheader.
+     *                $headtags has been deprectaed since Moodle 2.0
      */
-    public function setup_secure_page($title, $headtags) {
+    public function setup_secure_page($title, $headtags=null) {
+        global $OUTPUT, $PAGE;
     /// This prevents the message window coming up.
         define('MESSAGE_WINDOW', true);
-        print_header($title, '', '', '', $headtags, false, '', '', false, '');
+        $PAGE->set_title($title);
+        $PAGE->set_cacheable(false);
+        echo $OUTPUT->header();
         echo "\n\n", '<script type="text/javascript">';
     /// This used to be in protect_js.php. I really don't understand this bit.
     /// I have just moved it here for cleanliness reasons.
index 3e445eed827da334a56a59b3dbc87b8f44ff0c8c..60ab5b9528bb40cf08d3d553b59123f3f9d426c0 100644 (file)
@@ -71,7 +71,7 @@ $strupdatemodule = '';
 if (has_capability('moodle/course:manageactivities', $contexts->lowest())) {
     $strupdatemodule = update_module_button($cm->id, $course->id, get_string('modulename', 'quiz'));
 }
-$navigation = build_navigation($streditingquiz, $cm);
+$PAGE->navbar->add($streditingquiz);
 print_header_simple($streditingquiz, '', $navigation, '', '', true, $strupdatemodule);
 
 if (!$quizname = $DB->get_field($cm->modname, 'name', array('id' => $cm->instance))) {
index f04ce3a0cf0d9baf63670ecccc72d1bef63ea2d5..93419d9f21f87ac6a3c3eb655324646de33b3922 100644 (file)
@@ -334,7 +334,9 @@ class quiz {
      * parameter.
      */
     public function navigation($title) {
-        return build_navigation($title, $this->cm);
+        global $PAGE;
+        $PAGE->navbar->add($title);
+        return '';
     }
 
     // Private methods =====================================================================
index 3aa5154e3731e402a1f7fe16ee2970686f8e13a8..fe3abc3fd505c5d7ea0d6630bb242e07958c6a81 100644 (file)
@@ -35,7 +35,7 @@
             $attemptobj->get_quizid(), $attemptobj->get_cmid());
 
 /// Print the page header
-    print_header();
+    echo $OUTPUT->header();
     echo $OUTPUT->heading(format_string($attemptobj->get_question($questionid)->name));
 
 /// Process any data that was submitted.
index d2d2f2f80831f44f2862735f879aa5f81a194644..fa371944f75937d87d018b1d53ac4b5ca969ddd4 100644 (file)
@@ -443,8 +443,8 @@ $strupdatemodule = has_capability('moodle/course:manageactivities',
         update_module_button($cm->id, $course->id,
         get_string('modulename', 'quiz')) :
         "";
-$navigation = build_navigation($pagetitle, $cm);
-
+        
+$PAGE->navbar->add($pagetitle);
 $PAGE->requires->skip_link_to('questionbank',  get_string('skipto', 'access', get_string('questionbank', 'question')));
 $PAGE->requires->skip_link_to('quizcontentsblock',  get_string('skipto', 'access', get_string('questionsinthisquiz', 'quiz')));
 
index 82fce37da3f470c3dec7879eec70e70b354f5368..f34bc9f5b61c66e195c86dd6d45ba11b05cdfac2 100644 (file)
                    </div>
                  </form>";
     }
-    $navlinks = array();
-    $navlinks[] = array('name' => $strquizzes, 'link' => '', 'type' => 'activity');
-    $navigation = build_navigation($navlinks);
-
+    $PAGE->navbar->add($strquizzes);
     print_header_simple($strquizzes, '', $navigation,
                  '', '', true, $streditquestions, navmenu($course));
 
index b77bd1eff23abe0e9cdccfd873cb491a182f6a5b..5a38a7e0f0d8426d084a43a4e801bcb22298355b 100644 (file)
@@ -27,7 +27,6 @@ class quiz_default_report {
         $strquizzes = get_string("modulenameplural", "quiz");
         $strquiz  = get_string("modulename", "quiz");
     /// Print the page header
-        $navigation = build_navigation('', $cm);
         
         print_header_simple(format_string($quiz->name), "", $navigation,
                      '', '', true, update_module_button($cm->id, $course->id, $strquiz), navmenu($course, $cm));
index 8c5181284da92de59d8449c009c164f1dab35ada..f02fb41e08c0e7ff886fa89899130e4983322f91 100644 (file)
@@ -62,9 +62,9 @@
             $attemptobj->get_quizid(), $attemptobj->get_cmid());
 
 /// Print the page header
-    $headtags = $attemptobj->get_question_html_head_contributions($questionid);
-    print_header('', '', '', '', $headtags);
+    $attemptobj->get_question_html_head_contributions($questionid);
 
+    echo $OUTPUT->header();
     echo '<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>'; // for overlib
 
 /// Print infobox
index 8b082b9a60e506df8db124ee58f70be5581e8fdf..708eb15f231e1c825d433392b1a3e7e5aff3e088 100644 (file)
     }
     $buttons .= '</tr></table>';
 
-    $navigation = build_navigation(array(), $cm);
-    print_header($title, $course->fullname, $navigation, '', '', true, $buttons, navmenu($course, $cm), false, $bodytags);
+    $PAGE->set_title($title);
+    $PAGE->set_heading($course->fullname);
+    $PAGE->set_button($buttons);
+    echo $OUTPUT->header();
 
 /// Print heading and tabs (if there is more than one).
     $currenttab = 'info';