You are here

public function MatchingQuestion::getCorrectAnswer in Quiz 6.3

Same name and namespace in other branches
  1. 6.6 question_types/matching/matching.classes.inc \MatchingQuestion::getCorrectAnswer()
  2. 6.4 question_types/matching/matching.classes.inc \MatchingQuestion::getCorrectAnswer()
  3. 6.5 question_types/matching/matching.classes.inc \MatchingQuestion::getCorrectAnswer()
  4. 7.6 question_types/matching/matching.classes.inc \MatchingQuestion::getCorrectAnswer()
  5. 7 question_types/matching/matching.classes.inc \MatchingQuestion::getCorrectAnswer()
  6. 7.4 question_types/matching/matching.classes.inc \MatchingQuestion::getCorrectAnswer()
  7. 7.5 question_types/matching/matching.classes.inc \MatchingQuestion::getCorrectAnswer()

File

question_types/matching/matching.classes.inc, line 193
quiz_directions.classes

Class

MatchingQuestion
Implementation of Matching.

Code

public function getCorrectAnswer() {
  $correct_answers = array();

  //match_id  nid   vid   question  answer  feedback # {quiz_matching_node} fields
  $results = db_query("SELECT match_id, question, answer FROM {quiz_matching_node} WHERE nid = %d AND vid = %d", $this->node->nid, $this->node->vid);
  while ($result = db_fetch_object($results)) {
    $correct_answers[$result->match_id] = array(
      'match_id' => $result->match_id,
      'question' => $result->question,
      'answer' => $result->answer,
    );
  }
  return $correct_answers;
}