You are here

private function MultichoiceQuestion::updateAlternative in Quiz 7

Same name and namespace in other branches
  1. 6.4 question_types/multichoice/multichoice.classes.inc \MultichoiceQuestion::updateAlternative()
  2. 7.6 question_types/multichoice/multichoice.classes.inc \MultichoiceQuestion::updateAlternative()
  3. 7.4 question_types/multichoice/multichoice.classes.inc \MultichoiceQuestion::updateAlternative()
  4. 7.5 question_types/multichoice/multichoice.classes.inc \MultichoiceQuestion::updateAlternative()

Helper function. Updates existing alternatives

Parameters

$i: The alternative index

1 call to MultichoiceQuestion::updateAlternative()
MultichoiceQuestion::saveNodeProperties in question_types/multichoice/multichoice.classes.inc
Implementation of save

File

question_types/multichoice/multichoice.classes.inc, line 230
The main classes for the multichoice question type.

Class

MultichoiceQuestion
Extension of QuizQuestion.

Code

private function updateAlternative($i) {
  $short = $this->node->alternatives[$i];
  db_update('quiz_multichoice_answers')
    ->fields(array(
    'answer' => $short['answer']['value'],
    'answer_format' => $short['answer']['format'],
    'feedback_if_chosen' => $short['feedback_if_chosen']['value'],
    'feedback_if_chosen_format' => $short['feedback_if_chosen']['format'],
    'feedback_if_not_chosen' => $short['feedback_if_not_chosen']['value'],
    'feedback_if_not_chosen_format' => $short['feedback_if_not_chosen']['format'],
    'score_if_chosen' => $short['score_if_chosen'],
    'score_if_not_chosen' => $short['score_if_not_chosen'],
  ))
    ->condition('id', $short['id'])
    ->condition('question_nid', $this->node->nid)
    ->condition('question_vid', $this->node->vid)
    ->execute();
}