lp_stats.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * This script displays statistics on the current learning path (scorm)
  5. * This script must be included by lp_controller.php to get basic initialisation.
  6. *
  7. * @package chamilo.learnpath
  8. *
  9. * @author Yannick Warnier <ywarnier@beeznest.org>
  10. */
  11. require_once __DIR__.'/../inc/global.inc.php';
  12. // When origin is not set that means that the lp_stats are viewed from the "man running" icon
  13. if (!isset($origin)) {
  14. $origin = 'learnpath';
  15. }
  16. $sessionId = isset($_GET['id_session']) ? (int) $_GET['id_session'] : api_get_session_id();
  17. $courseCode = isset($_GET['course']) ? $_GET['course'] : api_get_course_id();
  18. $userId = isset($_GET['student_id']) ? (int) $_GET['student_id'] : api_get_user_id();
  19. $lpId = isset($_GET['lp_id']) ? $_GET['lp_id'] : null;
  20. $lpItemId = isset($_GET['lp_item_id']) ? $_GET['lp_item_id'] : null;
  21. $extendId = isset($_GET['extend_id']) ? $_GET['extend_id'] : null;
  22. $extendAttemptId = isset($_GET['extend_attempt_id']) ? $_GET['extend_attempt_id'] : null;
  23. $extendedAttempt = isset($_GET['extend_attempt']) ? $_GET['extend_attempt'] : null;
  24. $extendedAll = isset($_GET['extend_all']) ? $_GET['extend_all'] : null;
  25. $export = isset($_GET['export']) && $_GET['export'] === 'csv';
  26. $allowExtend = isset($_GET['allow_extend']) ? $_GET['allow_extend'] : 1;
  27. $lpReportType = api_get_setting('lp_show_reduced_report');
  28. $type = 'classic';
  29. if ($lpReportType === 'true') {
  30. $type = 'simple';
  31. }
  32. $courseInfo = api_get_course_info($courseCode);
  33. $output = Tracking::getLpStats(
  34. $userId,
  35. $courseInfo,
  36. $sessionId,
  37. $origin,
  38. $export,
  39. $lpId,
  40. $lpItemId,
  41. $extendId,
  42. $extendAttemptId,
  43. $extendedAttempt,
  44. $extendedAll,
  45. $type,
  46. $allowExtend
  47. );
  48. // Origin = tracking means that teachers see that info in the Reporting tool
  49. if ($origin != 'tracking') {
  50. Display::display_reduced_header();
  51. $output .= '</body></html>';
  52. }
  53. return $output;