You are here

public function DDLinesQuestion::saveNodeProperties in Quiz 8.4

Save question type specific node properties

Overrides QuizQuestion::saveNodeProperties

File

question_types/quiz_ddlines/lib/Drupal/quiz_ddlines/DDLinesQuestion.php, line 205
The main classes for the quiz_ddlines question type.

Class

DDLinesQuestion
Extension of QuizQuestion.

Namespace

Drupal\quiz_ddlines

Code

public function saveNodeProperties($is_new = FALSE) {
  if ($is_new || $this->node
    ->isNewRevision()) {
    $id = db_insert('quiz_ddlines_node')
      ->fields(array(
      'nid' => $this->node
        ->id(),
      'vid' => $this->node
        ->getRevisionId(),
      'feedback_enabled' => $this->node->feedback_enabled,
      'hotspot_radius' => $this->node->hotspot_radius,
      'ddlines_elements' => $this->node->ddlines_elements,
      'execution_mode' => $this->node->execution_mode,
    ))
      ->execute();
  }
  else {
    db_update('quiz_ddlines_node')
      ->fields(array(
      'ddlines_elements' => $this->node->ddlines_elements,
      'hotspot_radius' => $this->node->hotspot_radius,
      'feedback_enabled' => $this->node->feedback_enabled,
      'execution_mode' => $this->node->execution_mode,
    ))
      ->condition('nid', $this->node
      ->id())
      ->condition('vid', $this->node
      ->getRevisionId())
      ->execute();
  }
}