function opigno_quiz_app_quiz_finished in Opigno Quiz App 7
Implements hook_quiz_finished().
1 call to opigno_quiz_app_quiz_finished()
- opigno_quiz_app_quiz_scored in ./
opigno_quiz_app.module - Implements hook_quiz_scored().
File
- ./
opigno_quiz_app.module, line 645 - Module file. Defines module hooks.
Code
function opigno_quiz_app_quiz_finished($quiz, $score, $rid, $taker = NULL) {
if (module_exists('rules')) {
global $user;
$taker = isset($taker) ? $taker : clone $user;
$author = user_load($quiz->uid);
$quiz = node_load($quiz->nid);
rules_invoke_event('opigno_quiz_app_rules_quiz_taken', $taker, $author, $quiz);
if ($score['passing'] == true && $score['percentage_score'] >= $quiz->pass_rate) {
rules_invoke_event('opigno_quiz_app_rules_quiz_passed', $taker, $author, $quiz);
drupal_set_message(t("You successfully completed this lesson."));
}
else {
rules_invoke_event('opigno_quiz_app_rules_quiz_failed', $taker, $author, $quiz);
}
}
// Make sure we're NOT in fullscreen anymore.
setcookie('opigno_quiz_app_fs', 'false');
}