You are here

private function MatchingQuestion::getSubquestions in Quiz 6.4

Same name and namespace in other branches
  1. 7.6 question_types/matching/matching.classes.inc \MatchingQuestion::getSubquestions()
  2. 7 question_types/matching/matching.classes.inc \MatchingQuestion::getSubquestions()
  3. 7.4 question_types/matching/matching.classes.inc \MatchingQuestion::getSubquestions()
  4. 7.5 question_types/matching/matching.classes.inc \MatchingQuestion::getSubquestions()

Helper function to fetch subquestions

Return value

Array with two arrays, matches and selected options

2 calls to MatchingQuestion::getSubquestions()
MatchingQuestion::getAnsweringForm in question_types/matching/matching.classes.inc
Implementation of getAnsweringForm
MatchingQuestion::getNodeView in question_types/matching/matching.classes.inc
Implementation of getNodeView

File

question_types/matching/matching.classes.inc, line 229
matching.classes

Class

MatchingQuestion
Extension of QuizQuestion.

Code

private function getSubquestions() {
  $matches = $select_option = array();
  $sql = "SELECT match_id, question, answer, feedback FROM {quiz_matching_node} WHERE nid = %d AND vid = %d";
  $results = db_query($sql, $this->node->nid, $this->node->vid);
  while ($result = db_fetch_object($results)) {
    $matches[] = array(
      'match_id' => $result->match_id,
      'question' => $result->question,
      'answer' => $result->answer,
      'feedback' => $result->feedback,
    );
    $select_option[$result->match_id] = $result->answer;
  }
  return array(
    $matches,
    $select_option,
  );
}