function short_answer_score_form_submit in Quiz 7.4
Same name and namespace in other branches
- 8.4 question_types/short_answer/short_answer.admin.inc \short_answer_score_form_submit()
- 6.6 question_types/short_answer/short_answer.admin.inc \short_answer_score_form_submit()
- 6.3 question_types/short_answer/short_answer.admin.inc \short_answer_score_form_submit()
- 6.4 question_types/short_answer/short_answer.admin.inc \short_answer_score_form_submit()
- 6.5 question_types/short_answer/short_answer.admin.inc \short_answer_score_form_submit()
- 7.6 question_types/short_answer/short_answer.admin.inc \short_answer_score_form_submit()
- 7 question_types/short_answer/short_answer.admin.inc \short_answer_score_form_submit()
Submit the score form
File
- question_types/
short_answer/ short_answer.admin.inc, line 156 - short_answer.admin
Code
function short_answer_score_form_submit($form, &$form_state) {
$result = db_query('SELECT nid, vid FROM {quiz_node_results} WHERE result_id = :result_id', array(
':result_id' => $form_state['values']['result_id'],
))
->fetchobject();
$result = short_answer_score_an_answer(array(
'quiz' => node_load($result->nid, $result->vid),
'nid' => $form_state['values']['question_nid'],
'vid' => $form_state['values']['question_vid'],
'rid' => $form_state['values']['result_id'],
'score' => $form_state['values']['score'],
'max_score' => $form_state['values']['rel_max_score'],
'answer_feedback' => $form_state['values']['answer_feedback'],
));
if ($result == 1) {
drupal_set_message("The score has been saved.");
$form_state['redirect'] = 'admin/quiz/reports/score-short-answer';
}
else {
drupal_set_message(t('Error saving the score. The selected answer was not scored.'), 'error');
}
}