You are here

public function QuizQuestion::viewCanRevealCorrect in Quiz 7.6

Same name and namespace in other branches
  1. 6.4 question_types/quiz_question/quiz_question.core.inc \QuizQuestion::viewCanRevealCorrect()
  2. 7 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

@todo grabbing the node context here probably isn't a great idea

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 400
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;
  $quiz_node = node_load(arg(1));
  $reveal_correct[] = user_access('view any quiz question correct response');
  $reveal_correct[] = $user->uid == $this->node->uid;
  if (array_filter($reveal_correct)) {
    return TRUE;
  }
}