public function QuizQuestionResponse::__construct in Quiz 7.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.4 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.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).
7 calls to QuizQuestionResponse::__construct()
- DDLinesResponse::__construct in question_types/
quiz_ddlines/ quiz_ddlines.classes.inc - Constructor
- 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
7 methods override QuizQuestionResponse::__construct()
- DDLinesResponse::__construct in question_types/
quiz_ddlines/ quiz_ddlines.classes.inc - Constructor
- 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
File
- question_types/
quiz_question/ quiz_question.core.inc, line 684 - 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;
$result = db_query('SELECT is_skipped, is_doubtful FROM {quiz_node_results_answers}
WHERE result_id = :result_id AND question_nid = :question_nid AND question_vid = :question_vid', array(
':result_id' => $result_id,
':question_nid' => $question_node->nid,
':question_vid' => $question_node->vid,
))
->fetch();
if (is_object($result)) {
$this->is_doubtful = $result->is_doubtful;
$this->is_skipped = $result->is_skipped;
}
}