You are here

public function LongAnswerQuestion::saveNodeProperties in Quiz 8.4

Implementation of saveNodeProperties

Overrides QuizQuestion::saveNodeProperties

See also

QuizQuestion#saveNodeProperties($is_new)

File

question_types/long_answer/lib/Drupal/long_answer/LongAnswerQuestion.php, line 23
Long answer classes.

Class

LongAnswerQuestion
Extension of QuizQuestion.

Namespace

Drupal\long_answer

Code

public function saveNodeProperties($is_new = FALSE) {
  if (!isset($this->node->feedback)) {
    $this->node->feedback = '';
  }
  if ($is_new || $this->node
    ->isNewRevision() == 1) {
    $id = db_insert('quiz_long_answer_node_properties')
      ->fields(array(
      'nid' => $this->node
        ->id(),
      'vid' => $this->node
        ->getRevisionId(),
      'rubric' => $this->node->rubric,
    ))
      ->execute();
  }
  else {
    db_update('quiz_long_answer_node_properties')
      ->fields(array(
      'rubric' => $this->node->rubric,
    ))
      ->condition('nid', $this->node
      ->id())
      ->condition('vid', $this->node
      ->getRevisionId())
      ->execute();
  }
}