quiz.php 1.1 KB

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