public function MatchingQuestion::getNodeProperties in Quiz 7.5
Same name and namespace in other branches
- 6.4 question_types/matching/matching.classes.inc \MatchingQuestion::getNodeProperties()
- 7.6 question_types/matching/matching.classes.inc \MatchingQuestion::getNodeProperties()
- 7 question_types/matching/matching.classes.inc \MatchingQuestion::getNodeProperties()
- 7.4 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 132 - Matching classes.
Class
- MatchingQuestion
- Extension of QuizQuestion.
Code
public function getNodeProperties() {
if (isset($this->nodeProperties)) {
return $this->nodeProperties;
}
$props = parent::getNodeProperties();
$res_a = db_query('SELECT choice_penalty FROM {quiz_matching_properties}
WHERE nid = :nid AND vid = :vid', array(
':nid' => $this->node->nid,
':vid' => $this->node->vid,
))
->fetchAssoc();
if (is_array($res_a)) {
$props = array_merge($props, $res_a);
}
//$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;
}