function _quiz_check_num_random in Quiz 7.5
Same name and namespace in other branches
- 8.4 quiz.module \_quiz_check_num_random()
- 6.4 quiz.module \_quiz_check_num_random()
- 7.6 quiz.module \_quiz_check_num_random()
- 7 quiz.module \_quiz_check_num_random()
- 7.4 quiz.module \_quiz_check_num_random()
Convert all question statuses back to "always" when the Quiz is no longer set to random.
Parameters
$node: Quiz node.
2 calls to _quiz_check_num_random()
- quiz_insert in ./
quiz.module - Implements hook_insert().
- quiz_update in ./
quiz.module - Implements hook_update().
File
- ./
quiz.module, line 3033 - quiz.module Main file for the Quiz module.
Code
function _quiz_check_num_random($node) {
if ($node->randomization != 2) {
$efq = new EntityFieldQuery();
$results = $efq
->entityCondition('entity_type', 'quiz_question_relationship')
->propertyCondition('question_status', QUIZ_QUESTION_RANDOM)
->propertyCondition('parent_vid', $node->vid)
->execute();
if (isset($results['quiz_question_relationship'])) {
$questions = entity_load('quiz_question_relationship', array_keys($results['quiz_question_relationship']));
foreach ($questions as $question) {
$question->question_status = QUIZ_QUESTION_ALWAYS;
$question
->save();
}
}
}
}