You are here

public function TrueFalseQuestion::saveNodeProperties in Quiz 7.4

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

Implementation of saveNodeProperties

Overrides QuizQuestion::saveNodeProperties

See also

QuizQuestion#saveNodeProperties($is_new)

File

question_types/truefalse/truefalse.classes.inc, line 20
Defines the classes necessary for a True/False quiz.

Class

TrueFalseQuestion
Extension of QuizQuestion.

Code

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