You are here

public function ScaleQuestion::saveNodeProperties in Quiz 8.6

Same name and namespace in other branches
  1. 8.5 question_types/quiz_scale/src/Plugin/quiz/QuizQuestion/ScaleQuestion.php \ScaleQuestion::saveNodeProperties()
  2. 6.4 question_types/scale/scale.classes.inc \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().

See also

QuizQuestion::saveNodeProperties()

File

question_types/quiz_scale/src/Plugin/quiz/QuizQuestion/ScaleQuestion.php, line 40
Scale classes.

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 (!empty($this->node->save)) {
    $this
      ->setPreset($answer_collection_id);
  }
  if ($is_new_node) {
    $id = db_insert('quiz_scale_node_properties')
      ->fields(array(
      'nid' => $this->node->nid,
      'vid' => $this->node->vid,
      'answer_collection_id' => $answer_collection_id,
    ))
      ->execute();
  }
  else {
    db_update('quiz_scale_node_properties')
      ->fields(array(
      'answer_collection_id' => $answer_collection_id,
    ))
      ->condition('nid', $this->node->nid)
      ->condition('vid', $this->node->vid)
      ->execute();
  }
}