You are here

private function MultichoiceQuestion::insertAlternative in Quiz 6.4

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

Helper function. Saves new alternatives

Parameters

$i: The alternative index

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

File

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

Class

MultichoiceQuestion
Extension of QuizQuestion.

Code

private function insertAlternative($i) {
  $sql = 'INSERT INTO {quiz_multichoice_answers}
            (answer, answer_format, feedback_if_chosen, feedback_if_chosen_format,
            feedback_if_not_chosen, feedback_if_not_chosen_format, score_if_chosen,
            score_if_not_chosen, question_nid, question_vid)
            VALUES(\'%s\', %d, \'%s\', %d, \'%s\', %d, %d, %d, %d, %d)';
  $short = $this->node->alternatives[$i];
  db_query($sql, $short['answer'], $short['answer_format'], $short['feedback_if_chosen'], $short['feedback_if_chosen_format'], $short['feedback_if_not_chosen'], $short['feedback_if_not_chosen_format'], $short['score_if_chosen'], $short['score_if_not_chosen'], $this->node->nid, $this->node->vid);
}