function quiz_quiz_finished in Quiz 6.3
Same name and namespace in other branches
- 6.6 quiz.module \quiz_quiz_finished()
- 6.4 quiz.module \quiz_quiz_finished()
- 6.5 quiz.module \quiz_quiz_finished()
- 7.6 quiz.module \quiz_quiz_finished()
- 7 quiz.module \quiz_quiz_finished()
- 7.4 quiz.module \quiz_quiz_finished()
File
- ./
quiz.module, line 1350 - Quiz Module
Code
function quiz_quiz_finished($quiz, $score, $rid) {
global $user;
// function to export results to grade book will be added later
// function to export result in pdf, XML, CVS format
// function to display results visually
//function to send results over email
if ($user->uid && variable_get('quiz_email_results', 1) && variable_get('quiz_use_passfail', 1)) {
// email can be sent only for registered users
drupal_mail('quiz', 'notice', $user->mail, NULL, array(
$quiz,
$score,
$rid,
));
drupal_set_message(t('Your results have been sent to your e-mail address.'));
}
//calls userpoints functions to credit user point based on number of correct answers
//print_r($quiz);exit;
if ($quiz->has_userpoints) {
$variables = array(
'@title' => $quiz->title,
'@quiz' => variable_get('quiz_name', QUIZ_NAME),
'@time' => date('l jS \\of F Y h:i:s A'),
);
$params = array(
'points' => $score['numeric_score'],
'description' => t('Attended @title @quiz on @time', $variables),
);
userpoints_userpointsapi($params);
}
}