public function MatchingQuestion::getCorrectAnswer in Quiz 7
Same name and namespace in other branches
- 6.6 question_types/matching/matching.classes.inc \MatchingQuestion::getCorrectAnswer()
- 6.3 question_types/matching/matching.classes.inc \MatchingQuestion::getCorrectAnswer()
- 6.4 question_types/matching/matching.classes.inc \MatchingQuestion::getCorrectAnswer()
- 6.5 question_types/matching/matching.classes.inc \MatchingQuestion::getCorrectAnswer()
- 7.6 question_types/matching/matching.classes.inc \MatchingQuestion::getCorrectAnswer()
- 7.4 question_types/matching/matching.classes.inc \MatchingQuestion::getCorrectAnswer()
- 7.5 question_types/matching/matching.classes.inc \MatchingQuestion::getCorrectAnswer()
Get the correct answers for this question
Return value
Array of correct answers
File
- question_types/
matching/ matching.classes.inc, line 345 - matching.classes
Class
- MatchingQuestion
- Extension of QuizQuestion.
Code
public function getCorrectAnswer() {
$correct_answers = array();
$query = db_query('SELECT match_id, question, answer, feedback FROM {quiz_matching_node} WHERE nid = :nid AND vid = :vid', array(
':nid' => $this->node->nid,
':vid' => $this->node->vid,
));
while ($result = $query
->fetch()) {
$correct_answers[$result->match_id] = array(
'match_id' => $result->match_id,
'question' => $result->question,
'answer' => $result->answer,
'feedback' => $result->feedback,
);
}
return $correct_answers;
}