You are here

private function ScaleQuestion::saveAlternative in Quiz 6.6

Same name and namespace in other branches
  1. 8.6 question_types/quiz_scale/src/Plugin/quiz/QuizQuestion/ScaleQuestion.php \ScaleQuestion::saveAlternative()
  2. 8.5 question_types/quiz_scale/src/Plugin/quiz/QuizQuestion/ScaleQuestion.php \ScaleQuestion::saveAlternative()
  3. 6.4 question_types/scale/scale.classes.inc \ScaleQuestion::saveAlternative()
  4. 7.6 question_types/scale/scale.classes.inc \ScaleQuestion::saveAlternative()
  5. 7 question_types/scale/scale.classes.inc \ScaleQuestion::saveAlternative()
  6. 7.4 question_types/scale/scale.classes.inc \ScaleQuestion::saveAlternative()
  7. 7.5 question_types/scale/scale.classes.inc \ScaleQuestion::saveAlternative()

Saves one alternative to the database

Parameters

$alternative - the alternative(String) to be saved.:

$answer_collection_id - the id of the answer collection this alternative shall belong to.:

1 call to ScaleQuestion::saveAlternative()
ScaleQuestion::saveAnswerCollection in question_types/scale/scale.classes.inc
Stores the answer collection to the database, or reuses an excisting collection.

File

question_types/scale/scale.classes.inc, line 149
The main classes for the scale question type.

Class

ScaleQuestion
Implementation of QuizQuestion.

Code

private function saveAlternative($alternative, $answer_collection_id) {
  $sql = 'INSERT INTO {quiz_scale_answer}
    		(answer_collection_id, answer)
    		VALUES (%d, \'%s\')';
  db_query($sql, $answer_collection_id, $alternative);
}