course.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. $reports_modules['course'] = array();
  3. function reports_modules_course_init()
  4. {
  5. }
  6. function reports_modules_course_init_forEachCourses($course_code, $course_id, $course_db)
  7. {
  8. global $reports_modules;
  9. // $reports_modules_course_toolid = reports_getToolId(TOOL_QUIZ);
  10. array_push($reports_modules['course'],
  11. array(
  12. 'keys_query' =>
  13. 'select '.$course_id.' as course_id, "'.$course_code.'" as course_code',
  14. 'values_query_function' => 'reports_modules_course_val'
  15. ));
  16. }
  17. function reports_modules_course_val($course, $key_id)
  18. {
  19. return array(
  20. 'type' => 'sql',
  21. 'sql' =>
  22. 'select '.$key_id.', user_id as uid, '.
  23. '-1 as session_id, -1 as attempt, null as score, '.
  24. 'NULL as progress, '.
  25. '(sum(logout_course_date) - sum(login_course_date)) as time, null as ts from '.
  26. Database::get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS).
  27. ' where c_id = '.$course['real_id'].
  28. ' group by user_id'
  29. );
  30. }