function course_quiz_quiz_finished in Course 7.2
Same name and namespace in other branches
- 6 modules/course_quiz/course_quiz.module \course_quiz_quiz_finished()
- 7 modules/course_quiz/course_quiz.module \course_quiz_quiz_finished()
Implements hook_quiz_finished().
Update the fulfillment record when a user finishes a quiz.
1 call to course_quiz_quiz_finished()
- course_quiz_quiz_scored in modules/
course_quiz/ course_quiz.module - Implements hook_quiz_scored().
File
- modules/
course_quiz/ course_quiz.module, line 24
Code
function course_quiz_quiz_finished($quiz, $score, $session_data) {
$uid = db_query('SELECT uid FROM {quiz_node_results} WHERE result_id = :result_id', array(
':result_id' => $session_data['result_id'],
))
->fetchField();
if ($uid) {
$account = user_load($uid);
if ($courseObject = course_get_course_object('course_quiz', 'quiz', $quiz->nid)) {
/* @var $courseObject CourseObjectQuiz */
$courseObject
->getFulfillment($account)
->grade($session_data['result_id']);
}
}
}