You are here

function quiz_result_form_submit in Quiz 7.5

Same name and namespace in other branches
  1. 7.6 quiz.module \quiz_result_form_submit()

Quiz result submit handler.

File

./quiz.module, line 3975
quiz.module Main file for the Quiz module.

Code

function quiz_result_form_submit($form, &$form_state) {
  $quiz_result = $form_state['quiz_result'];
  field_attach_submit('quiz_result', $quiz_result, $form, $form_state);

  // What is a better way to do this? Maybe a serialized data column with the
  // 'merge' option enabled? We don't really need to store this selection, but
  // maybe others do for different types of Quiz initiations.
  if (!empty($form_state['values']['build_on_last'])) {
    $quiz_result->build_on_last = $form_state['values']['build_on_last'];
  }
  entity_save('quiz_result', $quiz_result);
  $_SESSION['quiz'][$quiz_result->nid]['result_id'] = $quiz_result->result_id;
  $_SESSION['quiz'][$quiz_result->nid]['current'] = 1;

  // Call the grading handler.
  module_load_include('inc', 'quiz', 'quiz.pages');
  quiz_report_form_submit($form, $form_state);
}