public function QuizQuestion::hasBeenAnswered in Quiz 7
Same name and namespace in other branches
- 6.4 question_types/quiz_question/quiz_question.core.inc \QuizQuestion::hasBeenAnswered()
- 7.6 question_types/quiz_question/quiz_question.core.inc \QuizQuestion::hasBeenAnswered()
- 7.4 question_types/quiz_question/quiz_question.core.inc \QuizQuestion::hasBeenAnswered()
- 7.5 question_types/quiz_question/quiz_question.core.inc \QuizQuestion::hasBeenAnswered()
Finds out if a question has been answered or not
This function also returns TRUE if a quiz that this question belongs to have been answered. Even if the question itself haven't been answered. This is because the question might have been rendered and a user is about to answer it...
Return value
true if question has been answered or is about to be answered...
1 call to QuizQuestion::hasBeenAnswered()
- QuizQuestion::getNodeForm in question_types/
quiz_question/ quiz_question.core.inc - Returns a node form to quiz_question_form
File
- question_types/
quiz_question/ quiz_question.core.inc, line 588 - Classes used in the Quiz Question module.
Class
- QuizQuestion
- A base implementation of a quiz_question, adding a layer of abstraction between the node API, quiz API and the question types.
Code
public function hasBeenAnswered() {
if (!isset($this->node->vid)) {
return FALSE;
}
$answered = db_query('SELECT * FROM {quiz_node_results} qnres
JOIN {quiz_node_relationship} qnrel ON (qnres.vid = qnrel.parent_vid)
WHERE qnrel.child_vid = :child_vid', array(
':child_vid' => $this->node->vid,
))
->fetch();
return $answered ? TRUE : FALSE;
}