You are here

public function QuizQuestion::viewCanRevealCorrect in Quiz 7

Same name and namespace in other branches
  1. 6.4 question_types/quiz_question/quiz_question.core.inc \QuizQuestion::viewCanRevealCorrect()
  2. 7.6 question_types/quiz_question/quiz_question.core.inc \QuizQuestion::viewCanRevealCorrect()
  3. 7.4 question_types/quiz_question/quiz_question.core.inc \QuizQuestion::viewCanRevealCorrect()
  4. 7.5 question_types/quiz_question/quiz_question.core.inc \QuizQuestion::viewCanRevealCorrect()

Determines if the user can view the correct answers

Return value

boolean true iff the view may include the correct answers to the question

5 calls to QuizQuestion::viewCanRevealCorrect()
LongAnswerQuestion::getNodeView in question_types/long_answer/long_answer.classes.inc
Implementation of getNodeView
MatchingQuestion::getNodeView in question_types/matching/matching.classes.inc
Implementation of getNodeView
MultichoiceQuestion::getNodeView in question_types/multichoice/multichoice.classes.inc
Implementation of getNodeView
ShortAnswerQuestion::getNodeView in question_types/short_answer/short_answer.classes.inc
Implementation of getNodeView
TrueFalseQuestion::getNodeView in question_types/truefalse/truefalse.classes.inc
Implementation of getNodeView

File

question_types/quiz_question/quiz_question.core.inc, line 604
Classes used in the Quiz Question module.

Class

QuizQuestion
A base implementation of a quiz_question, adding a layer of abstraction between the node API, quiz API and the question types.

Code

public function viewCanRevealCorrect() {
  global $user;

  // permission overrides the hook
  if (user_access('view any quiz question correct response') || $user->uid == $this->node->uid) {
    return TRUE;
  }
  $results = module_invoke_all('answers_access', $node);
  $may_view_answers = in_array(TRUE, $results);
  return $may_view_answers;
}