quiz.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. /**
  17. * @todo fix the exe_cours_id field
  18. * @param $quiz
  19. * @param $key_id
  20. * @return array
  21. */
  22. function reports_modules_quiz_quizVal($quiz, $key_id) {
  23. return array('type'=> 'sql', 'sql' =>
  24. 'select '.$key_id.', exe_user_id as uid, '.
  25. 'session_id, -1 as attempt, exe_result as score, '.
  26. REPORTS_PROGRESS_COMPLETED.' as progress, '.
  27. 'exe_duration as time, exe_date as ts from '.
  28. Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES).
  29. ' where exe_cours_id = '."'".$quiz['course_code']."'".
  30. ' and exe_exo_id='.$quiz['child_id']);
  31. }