public function TrueFalseResponse::__construct in Quiz 7
Same name and namespace in other branches
- 6.6 question_types/truefalse/truefalse.classes.inc \TrueFalseResponse::__construct()
- 6.3 question_types/quiz_question/quiz_question.truefalse.inc \TrueFalseResponse::__construct()
- 6.4 question_types/truefalse/truefalse.classes.inc \TrueFalseResponse::__construct()
- 6.5 question_types/quiz_question/quiz_question.truefalse.inc \TrueFalseResponse::__construct()
- 7.6 question_types/truefalse/truefalse.classes.inc \TrueFalseResponse::__construct()
- 7.4 question_types/truefalse/truefalse.classes.inc \TrueFalseResponse::__construct()
- 7.5 question_types/truefalse/truefalse.classes.inc \TrueFalseResponse::__construct()
Constructor
Overrides QuizQuestionResponse::__construct
File
- question_types/
truefalse/ truefalse.classes.inc, line 221 - 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;
}
}