function _quiz_show_finish_button in Quiz 7.6
Same name and namespace in other branches
- 7.5 quiz.module \_quiz_show_finish_button()
Show the finish button?
1 call to _quiz_show_finish_button()
- quiz_question_answering_form in question_types/
quiz_question/ quiz_question.module - Get the form to show to the quiz taker.
File
- ./
quiz.module, line 3594 - quiz.module Main file for the Quiz module.
Code
function _quiz_show_finish_button($quiz) {
$quiz_result = quiz_result_load($_SESSION['quiz'][$quiz->nid]['result_id']);
$current = $_SESSION['quiz'][$quiz->nid]['current'];
foreach ($quiz_result->layout as $idx => $question) {
if ($question['type'] == 'quiz_page') {
if ($current == $idx) {
// Found a page that we are on
$in_page = TRUE;
$last_page = TRUE;
}
else {
// Found a quiz page that we are not on.
$last_page = FALSE;
}
}
elseif (empty($question['qnr_pid'])) {
// A question without a parent showed up.
$in_page = FALSE;
$last_page = FALSE;
}
}
return $last_page || !isset($quiz_result->layout[$_SESSION['quiz'][$quiz->nid]['current'] + 1]);
}