public function ScaleResponse::__construct in Quiz 6.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()
- 7.6 question_types/scale/scale.classes.inc \ScaleResponse::__construct()
- 7 question_types/scale/scale.classes.inc \ScaleResponse::__construct()
- 7.4 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 518 - 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 {
$sql = 'SELECT answer_id
FROM {quiz_scale_user_answers}
WHERE result_id = %d AND question_nid = %d AND question_vid = %d';
$res = db_query($sql, $result_id, $this->question->nid, $this->question->vid);
$this->answer_id = db_result($res);
}
$sql = 'SELECT answer
FROM {quiz_scale_answer}
WHERE id = %d';
$res = db_query($sql, $this->answer_id);
$this->answer = check_plain(db_result($res));
}