/** * Creates any controls a the page should have. * * @param quiz_attempt $attemptobj */ public function summary_page_controls($attemptobj) { $output = ''; // Return to place button. if ($attemptobj->get_state() == quiz_attempt::IN_PROGRESS) { $button = new single_button( new moodle_url($attemptobj->attempt_url(null, $attemptobj->get_currentpage())), get_string('returnattempt', 'quiz')); $output .= $this->container($this->container($this->render($button), 'controls'), 'submitbtns mdl-align'); } // Finish attempt button. $options = array( 'attempt' => $attemptobj->get_attemptid(), 'finishattempt' => 1, 'timeup' => 0, 'slots' => '', 'sesskey' => sesskey(), ); $button = new single_button( new moodle_url($attemptobj->processattempt_url(), $options), get_string('submitallandfinish', 'quiz')); $button->id = 'responseform'; if ($attemptobj->get_state() == quiz_attempt::IN_PROGRESS) { $button->add_action(new confirm_action(get_string('confirmclose', 'quiz'), null, get_string('submitallandfinish', 'quiz'))); } $duedate = $attemptobj->get_due_date(); $message = ''; if ($attemptobj->get_state() == quiz_attempt::OVERDUE) { $message = get_string('overduemustbesubmittedby', 'quiz', userdate($duedate)); } else if ($duedate) { $message = get_string('mustbesubmittedby', 'quiz', userdate($duedate)); } $output .= $this->countdown_timer($attemptobj, time()); $output .= $this->container($message . $this->container( $this->render($button), 'controls'), 'submitbtns mdl-align'); return $output; }
/** * Creates any controls a the page should have. * * @param quiz_attempt $attemptobj */ public function summary_page_controls($attemptobj) { $output = ''; // countdown timer $output .= $this->countdown_timer(); // Finish attempt button. $options = array( 'attempt' => $attemptobj->get_attemptid(), 'finishattempt' => 1, 'timeup' => 0, 'slots' => '', 'sesskey' => sesskey(), ); $button = new single_button( new moodle_url($attemptobj->processattempt_url(), $options), get_string('submitallandfinish', 'quiz')); $button->id = 'responseform'; $button->add_action(new confirm_action(get_string('confirmclose', 'quiz'), null, get_string('submitallandfinish', 'quiz'))); $output .= $this->container($this->container($this->render($button), 'controls'), 'submitbtns mdl-align'); return $output; }
if ($messages) { print_box_start('quizaccessnotices'); print_heading(get_string('accessnoticesheader', 'quiz'), '', 3); $accessmanager->print_messages($messages); print_box_end(); } } else { /// Just a heading. if ($attemptobj->get_num_attempts_allowed() != 1) { print_heading(format_string($attemptobj->get_quiz_name()) . ' - ' . $title); } else { print_heading(format_string($attemptobj->get_quiz_name())); } } // Start the form echo '<form id="responseform" method="post" action="', $attemptobj->processattempt_url(), '" enctype="multipart/form-data" accept-charset="utf-8">', "\n"; echo '<div>'; print_js_call('init_quiz_form'); /// Print the navigation panel in a left column. print_container_start(); echo '<div id="left-column">'; $attemptobj->print_navigation_panel('quiz_attempt_nav_panel', $page); echo '</div>'; print_container_end(); /// Start the main column. echo '<div id="middle-column">'; ?> <style type="text/css"> <!-- #cd { margin: auto;
$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())) { print_footer('empty'); } else { print_footer($attemptobj->get_course()); }
/// 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="' . $OUTPUT->old_icon_url('i/flagged') . '" alt="' . get_string('flagged', 'question') . '" class="questionflag" />'; } $row = array('<a href="' . s($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. echo $OUTPUT->table($table); /// countdown timer echo $attemptobj->get_timer_html(); /// Finish attempt button. echo $OUTPUT->container_start('submitbtns mdl-align'); $options = array('attempt' => $attemptobj->get_attemptid(), 'finishattempt' => 1, 'timeup' => 0, 'questionids' => '', 'sesskey' => sesskey()); $form = html_form::make_button($attemptobj->processattempt_url(), $options, get_string('finishattempt', 'quiz')); $form->id = 'responseform'; $form->button->add_confirm_action(get_string('confirmclose', 'quiz')); echo $OUTPUT->button($form); echo $OUTPUT->container_end(); /// Finish the page $accessmanager->show_attempt_timer_if_needed($attemptobj->get_attempt(), time()); echo $OUTPUT->footer();