You are here

function quiz_question_feedback_access in Quiz 7.5

Same name and namespace in other branches
  1. 7.6 quiz.module \quiz_question_feedback_access()

Menu access check for question feedback.

1 string reference to 'quiz_question_feedback_access'
quiz_menu in ./quiz.module
Implements hook_menu().

File

./quiz.module, line 3663
quiz.module Main file for the Quiz module.

Code

function quiz_question_feedback_access($quiz, $question_number) {
  if ($question_number >= 1) {
    if (array_filter($quiz->review_options['question'])) {
      $question_index = $question_number;
      if (empty($_SESSION['quiz'][$quiz->nid]['result_id'])) {
        $result_id = $_SESSION['quiz']['temp']['result_id'];
      }
      else {
        $result_id = $_SESSION['quiz'][$quiz->nid]['result_id'];
      }
      $quiz_result = quiz_result_load($result_id);
      $layout = $quiz_result
        ->getLayout();
      $qinfo = $layout[$question_index];
      if ($qra = quiz_result_answer_load($result_id, $qinfo['nid'], $qinfo['vid'])) {
        return TRUE;
      }
    }
  }
}