public function ShortAnswerResponse::save in Quiz 7.4
Same name and namespace in other branches
- 6.6 question_types/short_answer/short_answer.classes.inc \ShortAnswerResponse::save()
- 6.3 question_types/short_answer/short_answer.classes.inc \ShortAnswerResponse::save()
- 6.4 question_types/short_answer/short_answer.classes.inc \ShortAnswerResponse::save()
- 6.5 question_types/short_answer/short_answer.classes.inc \ShortAnswerResponse::save()
- 7.6 question_types/short_answer/short_answer.classes.inc \ShortAnswerResponse::save()
- 7 question_types/short_answer/short_answer.classes.inc \ShortAnswerResponse::save()
- 7.5 question_types/short_answer/short_answer.classes.inc \ShortAnswerResponse::save()
Implementation of save
Overrides QuizQuestionResponse::save
See also
QuizQuestionResponse#save()
File
- question_types/
short_answer/ short_answer.classes.inc, line 381 - The main classes for the short answer question type.
Class
- ShortAnswerResponse
- Extension of QuizQuestionResponse
Code
public function save() {
// We need to set is_evaluated depending on whether the type requires evaluation.
$this->is_evaluated = (int) ($this->question->correct_answer_evaluation != ShortAnswerQuestion::ANSWER_MANUAL);
$this->answer_id = db_insert('quiz_short_answer_user_answers')
->fields(array(
'answer' => $this->answer,
'question_nid' => $this->question->nid,
'question_vid' => $this->question->vid,
'result_id' => $this->rid,
'score' => $this
->getScore(FALSE),
'is_evaluated' => $this->is_evaluated,
))
->execute();
}