You are here

function _quiz_check_num_always in Quiz 7.5

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

Remove all questions when the Quiz contains categorized random questions.

Parameters

$node: Quiz node.

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

File

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

Code

function _quiz_check_num_always($node) {
  if ($node->randomization == 3) {
    $efq = new EntityFieldQuery();
    $results = $efq
      ->entityCondition('entity_type', 'quiz_question_relationship')
      ->propertyCondition('parent_vid', $node->vid)
      ->execute();
    if (isset($results['quiz_question_relationship'])) {
      entity_delete_multiple('quiz_question_relationship', array_keys($results['quiz_question_relationship']));
    }
  }
}