You are here

function quiz_node_presave in Quiz 7

Same name and namespace in other branches
  1. 8.6 quiz.module \quiz_node_presave()
  2. 8.4 quiz.module \quiz_node_presave()
  3. 8.5 quiz.module \quiz_node_presave()
  4. 7.6 quiz.module \quiz_node_presave()
  5. 7.4 quiz.module \quiz_node_presave()
  6. 7.5 quiz.module \quiz_node_presave()

Implementation of hook_node_presave().

File

./quiz.module, line 1443
Quiz Module

Code

function quiz_node_presave($node) {
  if ($node->type == 'quiz') {

    // Convert the action id to the actual id from the MD5 hash.
    // Why the actions module does this I do not know? Maybe to prevent
    // invalid values put into the options value="" field.
    if ($aid = actions_function_lookup($node->aid)) {
      $node->aid = $aid;
    }
    if (variable_get('quiz_auto_revisioning', 1)) {
      $node->revision = quiz_has_been_answered($node) ? 1 : 0;
    }
  }
  if (isset($node->is_quiz_question) && variable_get('quiz_auto_revisioning', 1)) {
    $node->revision = quiz_question_has_been_answered($node) ? 1 : 0;
  }
}