You are here

public function ScaleQuestion::saveNodeProperties in Quiz 6.4

Same name and namespace in other branches
  1. 8.6 question_types/quiz_scale/src/Plugin/quiz/QuizQuestion/ScaleQuestion.php \ScaleQuestion::saveNodeProperties()
  2. 8.5 question_types/quiz_scale/src/Plugin/quiz/QuizQuestion/ScaleQuestion.php \ScaleQuestion::saveNodeProperties()
  3. 7.6 question_types/scale/scale.classes.inc \ScaleQuestion::saveNodeProperties()
  4. 7 question_types/scale/scale.classes.inc \ScaleQuestion::saveNodeProperties()
  5. 7.4 question_types/scale/scale.classes.inc \ScaleQuestion::saveNodeProperties()
  6. 7.5 question_types/scale/scale.classes.inc \ScaleQuestion::saveNodeProperties()

Implementation of saveNodeProperties

Overrides QuizQuestion::saveNodeProperties

See also

QuizQuestion#saveNodeProperties()

File

question_types/scale/scale.classes.inc, line 47
The main classes for the scale question type.

Class

ScaleQuestion
Extension of QuizQuestion.

Code

public function saveNodeProperties($is_new = FALSE) {
  $is_new_node = $is_new || $this->node->revision == 1;
  $answer_collection_id = $this
    ->saveAnswerCollection($is_new_node);

  // Save the answer collection as a preset if the save preset option is checked
  if ($this->node->save == 1) {
    $this
      ->setPreset($answer_collection_id);
  }
  if ($is_new_node) {
    $sql = 'INSERT INTO {quiz_scale_node_properties}
        (nid, vid, answer_collection_id)
        VALUES (%d, %d, %d)';
    db_query($sql, $this->node->nid, $this->node->vid, $answer_collection_id);
  }
  else {
    $sql = 'UPDATE {quiz_scale_node_properties}
        SET answer_collection_id = %d
        WHERE nid = %d AND vid = %d';
    db_query($sql, $answer_collection_id, $this->node->nid, $this->node->vid);
  }
}