You are here

public function MatchingQuestion::getNodeProperties in Quiz 7

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

Implementation of getNodeProperties

Overrides QuizQuestion::getNodeProperties

See also

QuizQuestion#getNodeProperties()

File

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

Class

MatchingQuestion
Extension of QuizQuestion.

Code

public function getNodeProperties() {
  if (isset($this->nodeProperties)) {
    return $this->nodeProperties;
  }
  $props = parent::getNodeProperties();

  //$sql = "SELECT match_id, question, answer, feedback FROM {quiz_matching_node} WHERE nid = %d AND vid = %d";
  $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()) {
    $props['match'][] = array(
      'match_id' => $result->match_id,
      'question' => $result->question,
      'answer' => $result->answer,
      'feedback' => $result->feedback,
    );
  }
  $this->nodeProperties = $props;
  return $props;
}