You are here

public function TrueFalseQuestion::saveNodeProperties in Quiz 6.4

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

Implementation of saveNodeProperties

Overrides QuizQuestion::saveNodeProperties

See also

QuizQuestion#saveNodeProperties($is_new)

File

question_types/truefalse/truefalse.classes.inc, line 20
Defines the classes necessary for a True/False quiz.

Class

TrueFalseQuestion
Extension of QuizQuestion.

Code

public function saveNodeProperties($is_new = FALSE) {
  if (!isset($this->node->feedback)) {
    $this->node->feedback = '';
  }
  if ($is_new || $this->node->revision == 1) {
    $sql = "INSERT INTO {quiz_truefalse_node} (nid, vid, correct_answer, feedback) VALUES (%d, %d, %d, '%s')";
    db_query($sql, $this->node->nid, $this->node->vid, (int) $this->node->correct_answer, $this->node->feedback);
  }
  else {
    $sql = "UPDATE {quiz_truefalse_node} SET correct_answer = %d, feedback = '%s' WHERE nid = %d AND vid = %d";
    db_query($sql, (int) $this->node->correct_answer, $this->node->feedback, $this->node->nid, $this->node->vid);
  }
}