]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-6368 and MDL-6369 - allow question type plugins to easily provide some bits of...
authortjhunt <tjhunt>
Tue, 24 Apr 2007 17:32:21 +0000 (17:32 +0000)
committertjhunt <tjhunt>
Tue, 24 Apr 2007 17:32:21 +0000 (17:32 +0000)
mod/quiz/review.php

index 9e83fff6785a01b5f02b6b92ba804081cb669af0..a66a55abb157c0ba44e8095005efb0849277c7a8 100644 (file)
 
     add_to_log($course->id, "quiz", "review", "review.php?id=$cm->id&amp;attempt=$attempt->id", "$quiz->id", "$cm->id");
 
+/// Load all the questions and states needed by this script
+
+    // load the questions needed by page
+    $pagelist = $showall ? quiz_questions_in_quiz($attempt->layout) : quiz_questions_on_page($attempt->layout, $page);
+    $sql = "SELECT q.*, i.grade AS maxgrade, i.id AS instance".
+           "  FROM {$CFG->prefix}question q,".
+           "       {$CFG->prefix}quiz_question_instances i".
+           " WHERE i.quiz = '$quiz->id' AND q.id = i.question".
+           "   AND q.id IN ($pagelist)";
+    if (!$questions = get_records_sql($sql)) {
+        error('No questions found');
+    }
+
+    // Load the question type specific information
+    if (!get_question_options($questions)) {
+        error('Could not load question options');
+    }
+
+    // Restore the question sessions to their most recent states
+    // creating new sessions where required
+    if (!$states = get_question_states($questions, $quiz, $attempt)) {
+        error('Could not restore question sessions');
+    }
+
 /// Print the page header
 
     $strquizzes = get_string("modulenameplural", "quiz");
     $strtimecompleted = get_string("completedon", "quiz");
     $stroverdue = get_string("overdue", "quiz");
 
+    $pagequestions = explode(',', $pagelist);
+    $headtags = get_html_head_contributions($pagequestions, $questions, $states);
     if (!empty($popup)) {
         define('MESSAGE_WINDOW', true);  // This prevents the message window coming up
-        print_header($course->shortname.': '.format_string($quiz->name), '', '', '', '', false, '', '', false, '');
+        print_header($course->shortname.': '.format_string($quiz->name), '', '', '', $headtags, false, '', '', false, '');
         /// Include Javascript protection for this page
         include('protect_js.php');
     } else {
         
         $navigation = build_navigation($crumbs);
                
-        print_header_simple(format_string($quiz->name), "", $navigation, "", "", true, $strupdatemodule);
+        print_header_simple(format_string($quiz->name), "", $navigation, "", $headtags, true, $strupdatemodule);
     }
     echo '<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>'; // for overlib
 
         print_heading(format_string($quiz->name));
     }
 
-/// Load all the questions and states needed by this script
-
-    // load the questions needed by page
-    $pagelist = $showall ? quiz_questions_in_quiz($attempt->layout) : quiz_questions_on_page($attempt->layout, $page);
-    $sql = "SELECT q.*, i.grade AS maxgrade, i.id AS instance".
-           "  FROM {$CFG->prefix}question q,".
-           "       {$CFG->prefix}quiz_question_instances i".
-           " WHERE i.quiz = '$quiz->id' AND q.id = i.question".
-           "   AND q.id IN ($pagelist)";
-    if (!$questions = get_records_sql($sql)) {
-        error('No questions found');
-    }
-
-    // Load the question type specific information
-    if (!get_question_options($questions)) {
-        error('Could not load question options');
-    }
-
-    // Restore the question sessions to their most recent states
-    // creating new sessions where required
-    if (!$states = get_question_states($questions, $quiz, $attempt)) {
-        error('Could not restore question sessions');
-    }
-
 /// Print infobox
 
     $timelimit = (int)$quiz->timelimit * 60;
 
 /// Print all the questions
 
-    $pagequestions = explode(',', $pagelist);
     $number = quiz_first_questionnumber($attempt->layout, $pagelist);
     foreach ($pagequestions as $i) {
         if (!isset($questions[$i])) {