quiz.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. $reports_modules['quiz'] = array();
  3. function reports_modules_quiz_init()
  4. {
  5. }
  6. function reports_modules_quiz_init_forEachCourses($course_code, $course_id, $course_db)
  7. {
  8. global $reports_modules;
  9. $reports_modules_quiz_toolid = reports_getToolId(TOOL_QUIZ);
  10. array_push($reports_modules['quiz'],
  11. array(
  12. 'keys_query' =>
  13. 'select '.$course_id.' as course_id, '.
  14. $reports_modules_quiz_toolid.' as tool_id, '.
  15. 'q.id as child_id, q.title as child_name, '.
  16. "'".$course_code."'".' as course_code from '.Database::get_course_table(TABLE_QUIZ_TEST).' q ',
  17. 'values_query_function' => 'reports_modules_quiz_quizVal'
  18. ));
  19. }
  20. function reports_modules_quiz_quizVal($quiz, $key_id)
  21. {
  22. $courseId = api_get_course_int_id($quiz['course_code']);
  23. return array(
  24. 'type' => 'sql',
  25. 'sql' =>
  26. 'select '.$key_id.', exe_user_id as uid, '.
  27. 'session_id, -1 as attempt, exe_result as score, '.
  28. REPORTS_PROGRESS_COMPLETED.' as progress, '.
  29. 'exe_duration as time, exe_date as ts from '.
  30. Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES).
  31. ' where c_id = '.$courseId.
  32. ' and exe_exo_id='.$quiz['child_id']
  33. );
  34. }