function quiz_feedback_can_review in Quiz 7.6
Same name and namespace in other branches
- 7.5 quiz.module \quiz_feedback_can_review()
Can the quiz taker view the requested review?
There's a workaround in here: @kludge
When review for the question is enabled, and it is the last question, technically it is the end of the quiz, and the "end of quiz" review settings apply. So we check to make sure that we are in question taking and the feedback is viewed within 5 seconds of completing the question/quiz.
2 calls to quiz_feedback_can_review()
- QuizQuestionResponse::canReview in question_types/
quiz_question/ quiz_question.core.inc - Can the quiz taker view the requested review?
- theme_quiz_result in ./
quiz.pages.inc - Theme the result page.
File
- ./
quiz.module, line 3860 - quiz.module Main file for the Quiz module.
Code
function quiz_feedback_can_review($option, $quiz_result) {
$quiz = node_load($quiz_result->nid, $quiz_result->vid);
// Check what context the result is in.
if ($quiz_result->time_end && arg(2) != 'take') {
// Quiz is over. Pull from the "at quiz end" settings.
return !empty($quiz->review_options['end'][$option]);
}
if (!$quiz_result->time_end || $quiz_result->time_end >= REQUEST_TIME - 5) {
// Quiz ongoing. Pull from the "after question" settings.
return !empty($quiz->review_options['question'][$option]);
}
}