$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" />'; } $row = array('<a href="' . $attemptobj->attempt_url($question->id) . '">' . $number . $flag . '</a>', get_string($attemptobj->get_question_status($question->id), 'quiz')); if ($scorescolumn) { $row[] = $attemptobj->get_question_score($question->id); } $table->data[] = $row; } /// Print the summary table. print_table($table); /// countdown timer echo $attemptobj->get_timer_html(); /// Finish attempt button. echo "<div class=\"submitbtns mdl-align\">\n"; $options = array('attempt' => $attemptobj->get_attemptid(), 'finishattempt' => 1, 'timeup' => 0, 'questionids' => '', 'sesskey' => sesskey()); print_single_button($attemptobj->processattempt_url(), $options, get_string('finishattempt', 'quiz'), 'post', '', false, '', false, get_string('confirmclose', 'quiz'), 'responseform'); echo "</div>\n"; /// Finish the page $accessmanager->show_attempt_timer_if_needed($attemptobj->get_attempt(), time()); if ($accessmanager->securewindow_required($attemptobj->is_preview_user())) {
$quiz = $DB->get_record('quiz', array('id' => $attemptobj->get_quizid())); echo "<caption>" . $attemptobj->get_quiz_name() . ": " . $qca->username . "</caption>"; echo "<thead>"; echo "<tr>"; echo "<th>Question</th>"; echo "<th>Answer</th>"; echo "<th>Score</th>"; echo "</tr>"; echo "</thead>"; echo "<tbody>"; $cnt = 0; $score = 0; // Print Quiz Attempt Review foreach ($attemptobj->get_question_ids($page) as $id) { $cnt++; $score += $attemptobj->get_question_score($id); $actual = $attemptobj->get_actual_id($id, false, $attemptobj->attempt_url($id, $page)); $question = $DB->get_record('question', array('id' => $actual)); $responses = get_question_actual_response($attemptobj->get_question($id), $attemptobj->get_question_state($id)); echo "<tr class='odd'><td colspan='3'>Question: " . $cnt . "</td></tr>"; echo "<tr>"; // Question echo "<td>" . replace_keywords($attemptid, $question->questiontext) . "</td>"; echo "<td>"; // Answer foreach ($responses as $r) { echo replace_keywords($attemptid, $r); } echo "</td>"; // Score echo "<td>" . $attemptobj->get_question_score($id) . "</td>";