You are here

function _quiz_common_presave_actions in Quiz 7

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

Common actions that need to be done before a quiz is inserted or updated

Parameters

$node: Quiz node

2 calls to _quiz_common_presave_actions()
quiz_insert in ./quiz.module
Implements hook_insert().
quiz_update in ./quiz.module
Implements hook_update().

File

./quiz.module, line 774
Quiz Module

Code

function _quiz_common_presave_actions(&$node) {
  quiz_translate_form_date($node, 'quiz_open');
  quiz_translate_form_date($node, 'quiz_close');
  if (empty($node->pass_rate)) {
    $node->pass_rate = 0;
  }
  if ($node->randomization < 2) {
    $node->number_of_random_questions = 0;
  }
}