You are here

function quiz_categorized_form_submit in Quiz 7

Same name and namespace in other branches
  1. 8.4 quiz.admin.inc \quiz_categorized_form_submit()
  2. 6.4 quiz.admin.inc \quiz_categorized_form_submit()
  3. 7.6 quiz.admin.inc \quiz_categorized_form_submit()
  4. 7.4 quiz.admin.inc \quiz_categorized_form_submit()
  5. 7.5 quiz.admin.inc \quiz_categorized_form_submit()

Submit the categorized form

File

./quiz.admin.inc, line 661
Administrator interface for Quiz module.

Code

function quiz_categorized_form_submit($form, $form_state) {
  $quiz = node_load($form_state['values']['nid'], $form_state['values']['vid']);
  $quiz->number_of_random_questions = 0;

  // Update the refresh latest quizzes table so that we know what the users latest quizzes are
  if (variable_get('quiz_auto_revisioning', 1)) {
    $is_new_revision = quiz_has_been_answered($quiz);
  }
  else {
    $is_new_revision = (bool) $form_state['values']['new_revision'];
  }
  if (!empty($form_state['values']['tid'])) {
    $quiz->number_of_random_questions += _quiz_categorized_add_term($form, $form_state);
  }
  $quiz->number_of_random_questions += _quiz_categorized_update_terms($form, $form_state);
  if ($is_new_revision) {
    $quiz->revision = 1;
  }

  // We save the node to update its timestamp and let other modules react to the update.
  // We also do this in case a new revision is required...
  node_save($quiz);
}