function short_answer_score_form_submit in Quiz 6.6
Same name and namespace in other branches
- 8.4 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()
- 7.4 question_types/short_answer/short_answer.admin.inc \short_answer_score_form_submit()
File
- question_types/
short_answer/ short_answer.admin.inc, line 136 - short_answer.admin
Code
function short_answer_score_form_submit($form, &$form_state) {
$sql = 'SELECT nid, vid FROM {quiz_node_results} WHERE result_id = %d';
$result = db_fetch_object(db_query($sql, $form_state['values']['result_id']));
$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'];
$result = short_answer_score_an_answer($quiz, $nid, $vid, $rid, $score);
if ($result == 1) {
drupal_set_message("The score has been saved.");
$form_state['redirect'] = 'admin/quiz/score-short-answer';
}
else {
drupal_set_message('Error saving the score. The selected answer was not scored.', 'error');
}
}