You are here

private function ScaleQuestion::setPreset in Quiz 7.5

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.4 question_types/scale/scale.classes.inc \ScaleQuestion::setPreset()

Add a preset for the current user.

Parameters

int $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|Identifies the answer collection.
ScaleQuestion::saveNodeProperties in question_types/scale/scale.classes.inc
Implementation of saveNodeProperties().

File

question_types/scale/scale.classes.inc, line 75
Scale classes.

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();
}