You are here

function AbstractQuizQuestionResponse::isCorrect in Quiz 6.3

Same name and namespace in other branches
  1. 6.6 question_types/quiz_question/quiz_question.core.inc \AbstractQuizQuestionResponse::isCorrect()
  2. 6.5 question_types/quiz_question/quiz_question.core.inc \AbstractQuizQuestionResponse::isCorrect()

Check to see if the answer is marked as correct.

This default version returns TRUE iff the score is equal to the maximum possible score.

Overrides QuizQuestionResponse::isCorrect

2 calls to AbstractQuizQuestionResponse::isCorrect()
AbstractQuizQuestionResponse::getReport in question_types/quiz_question/quiz_question.core.inc
Get data suitable for reporting a user's score on the question. This expects an object with the following attributes:
AbstractQuizQuestionResponse::toBareObject in question_types/quiz_question/quiz_question.core.inc
Repesent the response as a stdClass object.
3 methods override AbstractQuizQuestionResponse::isCorrect()
LongAnswerResponse::isCorrect in question_types/long_answer/long_answer.classes.inc
Check to see if the answer is marked as correct.
QuizDirectionsResponse::isCorrect in question_types/quiz_directions/quiz_directions.classes.inc
Check to see if the answer is marked as correct.
ShortAnswerResponse::isCorrect in question_types/short_answer/short_answer.classes.inc
Check to see if the answer is marked as correct.

File

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

Class

AbstractQuizQuestionResponse
A base implementation of QuizQuestionResponse.

Code

function isCorrect() {
  $possible = _quiz_question_get_instance($this->question)
    ->getMaximumScore();
  $actual = $this->score;
  return $possible == $actual;
}