public function ScaleQuestion::save in Quiz 6.6
Implementation of save
Stores the question in the database.
Parameters
is_new if - if the node is a new node...: (non-PHPdoc)
Overrides QuizQuestion::save
See also
sites/all/modules/quiz-HEAD/question_types/quiz_question/QuizQuestion#save()
File
- question_types/
scale/ scale.classes.inc, line 65 - The main classes for the scale question type.
Class
- ScaleQuestion
- Implementation of QuizQuestion.
Code
public function save($is_new = FALSE) {
global $user;
$is_new_node = $is_new || $this->node->revision == 1;
$answer_collection_id = $this
->saveAnswerCollection($is_new_node);
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);
}
}