private function MultichoiceQuestion::updateAlternative in Quiz 7.6
Same name and namespace in other branches
- 6.4 question_types/multichoice/multichoice.classes.inc \MultichoiceQuestion::updateAlternative()
- 7 question_types/multichoice/multichoice.classes.inc \MultichoiceQuestion::updateAlternative()
- 7.4 question_types/multichoice/multichoice.classes.inc \MultichoiceQuestion::updateAlternative()
- 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 253 - The main classes for the multichoice question type.
Class
- MultichoiceQuestion
- Extension of QuizQuestion.
Code
private function updateAlternative($i) {
$alternatives = $this
->_normalizeAlternative($this->node->alternatives[$i]);
db_update('quiz_multichoice_answers')
->fields(array(
'answer' => $alternatives['answer'],
'answer_format' => $alternatives['answer_format'],
'feedback_if_chosen' => $alternatives['feedback_if_chosen'],
'feedback_if_chosen_format' => $alternatives['feedback_if_chosen_format'],
'feedback_if_not_chosen' => $alternatives['feedback_if_not_chosen'],
'feedback_if_not_chosen_format' => $alternatives['feedback_if_not_chosen_format'],
'score_if_chosen' => $alternatives['score_if_chosen'],
'score_if_not_chosen' => $alternatives['score_if_not_chosen'],
'weight' => isset($alternatives['weight']) ? $alternatives['weight'] : $i,
))
->condition('id', $alternatives['id'])
->condition('question_nid', $this->node->nid)
->condition('question_vid', $this->node->vid)
->execute();
}