public function QuizQuestion::hasBeenAnswered in Quiz 6.4
Same name and namespace in other branches
- 7.6 question_types/quiz_question/quiz_question.core.inc \QuizQuestion::hasBeenAnswered()
- 7 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 600 - 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;
}
$sql = 'SELECT *
FROM {quiz_node_results}
WHERE vid IN (
SELECT parent_vid
FROM {quiz_node_relationship}
WHERE child_vid = %d
)
LIMIT 1';
$res = db_query($sql, $this->node->vid);
return db_fetch_object($res) ? TRUE : FALSE;
}