public function QuizQuestionResponse::__construct in Quiz 6.4
Same name and namespace in other branches
- 6.6 question_types/quiz_question/quiz_question.core.inc \QuizQuestionResponse::__construct()
- 6.3 question_types/quiz_question/quiz_question.core.inc \QuizQuestionResponse::__construct()
- 6.5 question_types/quiz_question/quiz_question.core.inc \QuizQuestionResponse::__construct()
- 7.6 question_types/quiz_question/quiz_question.core.inc \QuizQuestionResponse::__construct()
- 7 question_types/quiz_question/quiz_question.core.inc \QuizQuestionResponse::__construct()
- 7.4 question_types/quiz_question/quiz_question.core.inc \QuizQuestionResponse::__construct()
- 7.5 question_types/quiz_question/quiz_question.core.inc \QuizQuestionResponse::__construct()
Create a new user response.
Parameters
$result_id: The result ID for the user's result set. There is one result ID per time the user takes a quiz.
$question_node: The question node.
$answer: The answer (dependent on question type).
6 calls to QuizQuestionResponse::__construct()
- LongAnswerResponse::__construct in question_types/
long_answer/ long_answer.classes.inc - Constructor
- MatchingResponse::__construct in question_types/
matching/ matching.classes.inc - Constructor
- MultichoiceResponse::__construct in question_types/
multichoice/ multichoice.classes.inc - Constructor
- ScaleResponse::__construct in question_types/
scale/ scale.classes.inc - Constructor
- ShortAnswerResponse::__construct in question_types/
short_answer/ short_answer.classes.inc - Constructor
6 methods override QuizQuestionResponse::__construct()
- LongAnswerResponse::__construct in question_types/
long_answer/ long_answer.classes.inc - Constructor
- MatchingResponse::__construct in question_types/
matching/ matching.classes.inc - Constructor
- MultichoiceResponse::__construct in question_types/
multichoice/ multichoice.classes.inc - Constructor
- ScaleResponse::__construct in question_types/
scale/ scale.classes.inc - Constructor
- ShortAnswerResponse::__construct in question_types/
short_answer/ short_answer.classes.inc - Constructor
File
- question_types/
quiz_question/ quiz_question.core.inc, line 661 - Classes used in the Quiz Question module.
Class
- QuizQuestionResponse
- Each question type must store its own response data and be able to calculate a score for that data.
Code
public function __construct($result_id, stdClass $question_node, $answer = NULL) {
$this->rid = $result_id;
$this->question = $question_node;
$this->answer = $answer;
$sql = 'SELECT is_skipped
FROM {quiz_node_results_answers}
WHERE result_id = %d AND question_nid = %d AND question_vid = %d';
$res = db_query($sql, $result_id, $question_node->nid, $question_node->vid);
$this->is_skipped = db_result($res);
}