You are here

private function ScaleQuestion::setPreset in Quiz 7.4

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

Add a preset for the current user.

Parameters

$col_id - answer collection id of the collection this user wants to have as a preset:

2 calls to ScaleQuestion::setPreset()
ScaleQuestion::saveAnswerCollection in question_types/scale/scale.classes.inc
Stores the answer collection to the database, or identifies an existing collection.
ScaleQuestion::saveNodeProperties in question_types/scale/scale.classes.inc
Implementation of saveNodeProperties

File

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

Class

ScaleQuestion
Extension of QuizQuestion.

Code

private function setPreset($col_id) {
  db_merge('quiz_scale_user')
    ->key(array(
    'uid' => $GLOBALS['user']->uid,
    'answer_collection_id' => $col_id,
  ))
    ->fields(array(
    'uid' => $GLOBALS['user']->uid,
    'answer_collection_id' => $col_id,
  ))
    ->execute();
}