lp_stats.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. * @package chamilo.learnpath
  7. * @author Yannick Warnier <ywarnier@beeznest.org>
  8. */
  9. //require_once '../inc/global.inc.php';
  10. // When origin is not set that means that the lp_stats are viewed from the "man running" icon
  11. if (!isset($origin)) {
  12. $origin = 'learnpath';
  13. }
  14. $sessionId = isset($_GET['id_session']) ? intval($_GET['id_session']) : api_get_session_id();
  15. $courseCode = isset($_GET['course']) ? intval($_GET['course']) : api_get_course_id();
  16. $userId = isset($_GET['student_id']) ? intval($_GET['student_id']) : api_get_user_id();
  17. $lpId = isset($_GET['lp_id']) ? $_GET['lp_id'] : null;
  18. $lpItemId = isset($_GET['lp_item_id']) ? $_GET['lp_item_id'] : null;
  19. $extendId = isset($_GET['extend_id']) ? $_GET['extend_id'] : null;
  20. $extendAttemptId = isset($_GET['extend_attempt_id']) ? $_GET['extend_attempt_id'] : null;
  21. $extendedAttempt = isset($_GET['extend_attempt']) ? $_GET['extend_attempt'] : null;
  22. $extendedAll = isset($_GET['extend_all']) ? $_GET['extend_all'] : null;
  23. $export = isset($_GET['export']) && $_GET['export'] == 'csv' ? true : false;
  24. $allowExtend = isset($_GET['allow_extend']) ? $_GET['allow_extend'] : 1;
  25. $lpReportType = api_get_setting('lp_show_reduced_report');
  26. $type = 'classic';
  27. if ($lpReportType === 'true') {
  28. $type = 'simple';
  29. }
  30. $courseInfo = api_get_course_info($courseCode);
  31. $output = Tracking::getLpStats(
  32. $userId,
  33. $courseInfo,
  34. $sessionId,
  35. $origin,
  36. $export,
  37. $lpId,
  38. $lpItemId,
  39. $extendId,
  40. $extendAttemptId,
  41. $extendedAttempt,
  42. $extendedAll,
  43. $type,
  44. $allowExtend
  45. );
  46. // Origin = tracking means that teachers see that info in the Reporting tool
  47. if ($origin != 'tracking') {
  48. Display::display_reduced_header();
  49. $output .= "</body></html>";
  50. }
  51. return $output;