if ($attemptobj->is_preview_user()) { $currenttab = 'preview'; include 'tabs.php'; } /// Print heading. print_heading(format_string($attemptobj->get_quiz_name())); if ($attemptobj->is_preview_user()) { $attemptobj->print_restart_preview_button(); } print_heading($title); /// Prepare the summary table header $table->class = 'generaltable quizsummaryofattempt'; $table->head = array(get_string('question', 'quiz'), get_string('status', 'quiz')); $table->align = array('left', 'left'); $table->size = array('', ''); $scorescolumn = $attemptobj->get_review_options()->scores; if ($scorescolumn) { $table->head[] = get_string('marks', 'quiz'); $table->align[] = 'left'; $table->size[] = ''; } $table->data = array(); /// Get the summary info for each question. $questionids = $attemptobj->get_question_ids(); foreach ($attemptobj->get_question_iterator() as $number => $question) { if ($question->length == 0) { continue; } $flag = ''; if ($attemptobj->is_question_flagged($question->id)) { $flag = ' <img src="' . $CFG->pixpath . '/i/flagged.png" alt="' . get_string('flagged', 'question') . '" class="questionflag" />';
/// 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()) { echo $OUTPUT->notification(get_string('cannotreviewopen', 'quiz')); echo $OUTPUT->close_window_button(); } /// Can't review other users' attempts. if (!$attemptobj->is_own_attempt()) { echo $OUTPUT->notification(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()); echo $OUTPUT->notification($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());
/// 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')); close_window_button(); } /// Can't review other users' attempts. if (!$attemptobj->is_own_attempt()) { notify(get_string('notyourattempt', 'quiz')); 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())); 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());
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License * @package quiz */ require_once dirname(__FILE__) . '/../../config.php'; require_once $CFG->dirroot . '/mod/quiz/locallib.php'; require_once $CFG->dirroot . '/mod/quiz/report/reportlib.php'; $attemptid = required_param('attempt', PARAM_INT); $page = optional_param('page', 0, PARAM_INT); $showall = optional_param('showall', 0, PARAM_BOOL); $attemptobj = new quiz_attempt($attemptid); /// Check login. require_login($attemptobj->get_courseid(), false, $attemptobj->get_cm()); $attemptobj->check_review_capability(); /// Create an object to manage all the other (non-roles) access rules. $accessmanager = $attemptobj->get_access_manager(time()); $options = $attemptobj->get_review_options(); /// Permissions checks for normal users who do not have quiz:viewreports capability. if (!$attemptobj->has_capability('mod/quiz:viewreports')) { /// Can't review other users' attempts. if (!$attemptobj->is_own_attempt()) { quiz_error($attemptobj->get_quiz(), 'notyourattempt'); } /// Can't review during the attempt - send them back to the attempt page. if (!$attemptobj->is_finished()) { redirect($attemptobj->attempt_url(0, $page)); } /// Can't review unless Students may review -> Responses option is turned on. if (!$options->responses) { $accessmanager->back_to_view_page($attemptobj->is_preview_user(), $accessmanager->cannot_review_message($options)); } }