public function ClozeResponse::__construct in Cloze 6
Same name and namespace in other branches
- 7 cloze.classes.inc \ClozeResponse::__construct()
Constructor
File
- ./
cloze.classes.inc, line 230 - The main classes for the short answer question type.
Class
- ClozeResponse
- 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 = db_fetch_object(db_query('SELECT answer_id, answer, score, question_vid, question_nid, result_id FROM {quiz_cloze_user_answers} WHERE question_nid = %d AND question_vid = %d AND result_id = %d', $question_node->nid, $question_node->vid, $result_id));
if (!empty($r)) {
$this->answer = unserialize($r->answer);
$this->score = $r->score;
$this->answer_id = $r->answer_id;
$this->answer_feedback = $r->answer_feedback;
}
}
else {
$this->answer = $answer;
}
}