You are here

public function ShortAnswerQuestion::saveNodeProperties in Quiz 6.4

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

Implementation of saveNodeProperties

Overrides QuizQuestion::saveNodeProperties

See also

QuizQuestion#saveNodeProperties($is_new)

File

question_types/short_answer/short_answer.classes.inc, line 35
The main classes for the short answer question type.

Class

ShortAnswerQuestion
Extension of QuizQuestion.

Code

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