$curstate =& $states[$historylength][$id]; } } } else { $submitted = false; $curstate =& $states[$historylength][$id]; } // TODO: should not use quiz-specific function here $options = quiz_get_renderoptions($quiz->review, $curstate); // Fill in the correct responses (unless the question is in readonly mode) if ($fillcorrect && !$options->readonly) { $curstate->responses = $QTYPES[$questions[$id]->qtype]->get_correct_responses($questions[$id], $curstate); } $strpreview = get_string('preview', 'quiz') . ' ' . format_string($questions[$id]->name); $questionlist = array($id); $headtags = get_html_head_contributions($questionlist, $questions, $states[$historylength]); print_header($strpreview, '', '', '', $headtags); print_heading($strpreview); if (!empty($quizid)) { echo '<p class="quemodname">' . get_string('modulename', 'quiz') . ': '; p(format_string($quiz->name)); echo "</p>\n"; } $number = 1; echo '<form method="post" action="' . $url->out(true) . '" enctype="multipart/form-data" id="responseform">', "\n"; print_question($questions[$id], $curstate, $number, $quiz, $options); echo '<div class="controls">'; echo $url->hidden_params_out(); // Print the mark and finish attempt buttons echo '<input name="markall" type="submit" value="' . get_string('markall', 'quiz') . "\" />\n"; echo '<input name="finishattempt" type="submit" value="' . get_string('finishattempt', 'quiz') . "\" />\n";
} if ($finishattempt) { if (!empty($SESSION->passwordcheckedquizzes[$quiz->id])) { unset($SESSION->passwordcheckedquizzes[$quiz->id]); } redirect($CFG->wwwroot . '/mod/quiz/review.php?attempt=' . $attempt->id, 0); } // Now is the right time to check the open and close times. if (!$ispreviewing && ($timestamp < $quiz->timeopen || $quiz->timeclose && $timestamp > $quiz->timeclose)) { print_error('notavailable', 'quiz', "view.php?id={$cm->id}"); } /// Print the quiz page //////////////////////////////////////////////////////// // Print the page header require_js($CFG->wwwroot . '/mod/quiz/quiz.js'); $pagequestions = explode(',', $pagelist); $headtags = get_html_head_contributions($pagequestions, $questions, $states); if (!$ispreviewing && $quiz->popup) { define('MESSAGE_WINDOW', true); // This prevents the message window coming up print_header($course->shortname . ': ' . format_string($quiz->name), '', '', '', $headtags, false, '', '', false, ' class="securewindow"'); if ($quiz->popup == 1) { include 'protect_js.php'; } } else { $strupdatemodule = has_capability('moodle/course:manageactivities', $coursecontext) ? update_module_button($cm->id, $course->id, get_string('modulename', 'quiz')) : ""; $navigation = build_navigation($strattemptnum, $cm); 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 the quiz name heading and tabs for teacher, etc.
public function get_question_html_head_contributions($questionid) { return get_html_head_contributions(array($questionid), $this->questions, $this->states); }