get_courseid(), false, $attemptobj->get_cm()); $attemptobj->check_review_capability(); /// Permissions checks for normal users who do not have quiz:viewreports capability. if (!$attemptobj->has_capability('mod/quiz:viewreports')) { /// Can't review during the attempt - send them back to the attempt page. if (!$attemptobj->is_finished()) { notify(get_string('cannotreviewopen', 'quiz')); echo $OUTPUT->close_window_button(); } /// Can't review other users' attempts. if (!$attemptobj->is_own_attempt()) { notify(get_string('notyourattempt', 'quiz')); echo $OUTPUT->close_window_button(); } /// Can't review unless Students may review -> Responses option is turned on. if (!$options->responses) { $accessmanager = $attemptobj->get_access_manager(time()); notify($accessmanager->cannot_review_message($attemptobj->get_review_options())); echo $OUTPUT->close_window_button(); } } /// Load the questions and states. $questionids = array($questionid); $attemptobj->load_questions($questionids); $attemptobj->load_question_states($questionids); /// If it was asked for, load another state, instead of the latest. if ($stateid) { $attemptobj->load_specific_question_state($questionid, $stateid); } /// Work out the base URL of this page. $baseurl = $CFG->wwwroot . '/mod/quiz/reviewquestion.php?attempt=' . $attemptobj->get_attemptid() . '&question=' . $questionid; /// Log this review. add_to_log($attemptobj->get_courseid(), 'quiz', 'review', 'reviewquestion.php?attempt=' . $attemptobj->get_attemptid() . '&question=' . $questionid . ($stateid ? '&state=' . $stateid : ''), $attemptobj->get_quizid(), $attemptobj->get_cmid()); /// Print the page header $headtags = $attemptobj->get_question_html_head_contributions($questionid); print_header('', '', '', '', $headtags); echo ''; // for overlib /// Print infobox $rows = array(); /// User picture and name. if ($attemptobj->get_userid() <> $USER->id) { // Print user picture and name $student = $DB->get_record('user', array('id' => $attemptobj->get_userid())); $picture = print_user_picture($student, $attemptobj->get_courseid(), $student->picture, false, true); $rows[] = '' . $picture . '' . fullname($student, true) . ''; } /// Quiz name. $rows[] = '' . get_string('modulename', 'quiz') . '' . format_string($attemptobj->get_quiz_name()) . ''; /// Question name. $rows[] = '' . get_string('question', 'quiz') . '' . format_string( $attemptobj->get_question($questionid)->name) . ''; /// Other attempts at the quiz. if ($attemptobj->has_capability('mod/quiz:viewreports')) { $attemptlist = $attemptobj->links_to_other_attempts($baseurl); if ($attemptlist) { $rows[] = '' . get_string('attempts', 'quiz') . '' . $attemptlist . ''; } } /// Timestamp of this action. $timestamp = $attemptobj->get_question_state($questionid)->timestamp; if ($timestamp) { $rows[] = '' . get_string('completedon', 'quiz') . '' . userdate($timestamp) . ''; } /// Now output the summary table, if there are any rows to be shown. if (!empty($rows)) { echo '', "\n"; echo implode("\n", $rows); echo "\n
\n"; } /// Print the question in the requested state. if ($stateid) { $baseurl .= '&state=' . $stateid; } $attemptobj->print_question($questionid, true, $baseurl); /// Finish the page echo $OUTPUT->footer(); ?>