You are here

public function TrueFalseResponse::__construct in Quiz 7.4

Same name and namespace in other branches
  1. 6.6 question_types/truefalse/truefalse.classes.inc \TrueFalseResponse::__construct()
  2. 6.3 question_types/quiz_question/quiz_question.truefalse.inc \TrueFalseResponse::__construct()
  3. 6.4 question_types/truefalse/truefalse.classes.inc \TrueFalseResponse::__construct()
  4. 6.5 question_types/quiz_question/quiz_question.truefalse.inc \TrueFalseResponse::__construct()
  5. 7.6 question_types/truefalse/truefalse.classes.inc \TrueFalseResponse::__construct()
  6. 7 question_types/truefalse/truefalse.classes.inc \TrueFalseResponse::__construct()
  7. 7.5 question_types/truefalse/truefalse.classes.inc \TrueFalseResponse::__construct()

Constructor

Overrides QuizQuestionResponse::__construct

File

question_types/truefalse/truefalse.classes.inc, line 222
Defines the classes necessary for a True/False quiz.

Class

TrueFalseResponse
Extension of QuizQuestionResponse

Code

public function __construct($result_id, stdClass $question_node, $answer = NULL) {
  parent::__construct($result_id, $question_node, $answer);
  if (!isset($answer)) {
    $r = $this
      ->getCorrectAnswer();
    if (!empty($r)) {
      $this->answer = $r->answer;
      $this->score = $r->score;
    }
  }
  else {
    $this->answer = $answer;
  }
}