public function ScaleResponse::__construct in Quiz 7.4
Same name and namespace in other branches
- 8.6 question_types/quiz_scale/src/Plugin/quiz/QuizQuestion/ScaleResponse.php \ScaleResponse::__construct()
- 8.5 question_types/quiz_scale/src/Plugin/quiz/QuizQuestion/ScaleResponse.php \ScaleResponse::__construct()
- 6.6 question_types/scale/scale.classes.inc \ScaleResponse::__construct()
- 6.4 question_types/scale/scale.classes.inc \ScaleResponse::__construct()
- 7.6 question_types/scale/scale.classes.inc \ScaleResponse::__construct()
- 7 question_types/scale/scale.classes.inc \ScaleResponse::__construct()
- 7.5 question_types/scale/scale.classes.inc \ScaleResponse::__construct()
Constructor
Overrides QuizQuestionResponse::__construct
File
- question_types/
scale/ scale.classes.inc, line 553 - The main classes for the scale question type.
Class
- ScaleResponse
- Extension of QuizQuestionResponse
Code
public function __construct($result_id, stdClass $question_node, $answer = NULL) {
parent::__construct($result_id, $question_node, $answer);
if (isset($answer)) {
$this->answer_id = intval($answer);
}
else {
$this->answer_id = db_query('SELECT answer_id FROM {quiz_scale_user_answers} WHERE result_id = :rid AND question_nid = :qnid AND question_vid = :qvid', array(
':rid' => $result_id,
':qnid' => $this->question->nid,
':qvid' => $this->question->vid,
))
->fetchField();
}
$answer = db_query('SELECT answer FROM {quiz_scale_answer} WHERE id = :id', array(
':id' => $this->answer_id,
))
->fetchField();
$this->answer = check_plain($answer);
}