public function ShortAnswerResponse::save in Quiz 6.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.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.4 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 358 - 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);
$sql = "INSERT INTO {quiz_short_answer_user_answers}\n (answer, question_nid, question_vid, result_id, score, is_evaluated)\n VALUES ('%s', %d, %d, %d, %d, %d)";
db_query($sql, $this->answer, $this->question->nid, $this->question->vid, $this->rid, $this
->getScore(FALSE), $this->is_evaluated);
$this->answer_id = db_last_insert_id('quiz_long_answer_user_answers', 'answer_id');
}