lp_tracking.php 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. $language_file = array ('registration', 'index', 'tracking', 'exercice', 'scorm', 'learnpath');
  4. require_once '../inc/global.inc.php';
  5. // resetting the course id
  6. $cidReset = true;
  7. $from_myspace = false;
  8. $from_link = '';
  9. if (isset($_GET['from']) && $_GET['from'] == 'myspace') {
  10. $from_link = '&from=myspace';
  11. $this_section = SECTION_TRACKING;
  12. } else {
  13. $this_section = SECTION_COURSES;
  14. }
  15. require_once api_get_path(LIBRARY_PATH).'tracking.lib.php';
  16. require_once api_get_path(LIBRARY_PATH).'export.lib.inc.php';
  17. require_once api_get_path(SYS_CODE_PATH).'newscorm/learnpath.class.php';
  18. require_once api_get_path(SYS_CODE_PATH).'newscorm/learnpathItem.class.php';
  19. require_once api_get_path(LIBRARY_PATH).'export.lib.inc.php';
  20. $session_id = isset($_REQUEST['id_session']) && !empty($_REQUEST['id_session']) ? intval($_REQUEST['id_session']) : api_get_session_id();
  21. $export_csv = isset($_GET['export']) && $_GET['export'] == 'csv' ? true : false;
  22. if ($export_csv) {
  23. ob_start();
  24. }
  25. $csv_content = array();
  26. $user_id = intval($_GET['student_id']);
  27. if (isset($_GET['course'])) {
  28. $cidReq = Security::remove_XSS($_GET['course']);
  29. }
  30. $user_infos = UserManager :: get_user_info_by_id($user_id);
  31. $name = api_get_person_name($user_infos['firstname'], $user_infos['lastname']);
  32. if (!api_is_platform_admin(true) && !CourseManager :: is_course_teacher($_user['user_id'], $cidReq) && !Tracking :: is_allowed_to_coach_student($_user['user_id'],$_GET['student_id']) && !api_is_drh() && !api_is_course_tutor()) {
  33. Display::display_header('');
  34. api_not_allowed();
  35. Display::display_footer();
  36. }
  37. $course_exits = CourseManager::course_exists($cidReq);
  38. if (!empty($course_exits)) {
  39. $course_info = api_get_course_info($cidReq);
  40. } else {
  41. api_not_allowed();
  42. }
  43. if (!empty($_GET['origin']) && $_GET['origin'] == 'user_course') {
  44. $interbreadcrumb[] = array ("url" => api_get_path(WEB_COURSE_PATH).$course_info['directory'], 'name' => $course_info['name']);
  45. $interbreadcrumb[] = array ("url" => "../user/user.php?cidReq=".$cidReq, "name" => get_lang("Users"));
  46. } else if(!empty($_GET['origin']) && $_GET['origin'] == 'tracking_course') {
  47. // $interbreadcrumb[] = array ("url" => api_get_path(WEB_COURSE_PATH).$course_info['directory'], 'name' => $course_info['name']);
  48. $interbreadcrumb[] = array ("url" => "../tracking/courseLog.php?cidReq=".$cidReq.'&studentlist=true&id_session='.$session_id, "name" => get_lang("Tracking"));
  49. } else {
  50. $interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('MySpace'));
  51. $interbreadcrumb[] = array ("url" => "student.php", "name" => get_lang("MyStudents"));
  52. $interbreadcrumb[] = array ("url" => "myStudents.php?student=".Security::remove_XSS($_GET['student_id']), "name" => get_lang("StudentDetails"));
  53. $nameTools=get_lang("DetailsStudentInCourse");
  54. }
  55. $interbreadcrumb[] = array("url" => "myStudents.php?student=".Security::remove_XSS($_GET['student_id'])."&course=".$cidReq."&details=true&origin=".Security::remove_XSS($_GET['origin']) , "name" => get_lang("DetailsStudentInCourse"));
  56. $nameTools = get_lang('LearningPathDetails');
  57. $htmlHeadXtra[] = '
  58. <style>
  59. div.title {
  60. font-weight : bold;
  61. text-align : left;
  62. }
  63. div.mystatusfirstrow {
  64. font-weight : bold;
  65. text-align : left;
  66. }
  67. div.description {
  68. font-family : Arial, Helvetica, sans-serif;
  69. font-size: 10px;
  70. color: Silver;
  71. }
  72. </style>';
  73. Display :: display_header($nameTools);
  74. $lp_id = intval($_GET['lp_id']);
  75. $sql = 'SELECT name FROM '.Database::get_course_table(TABLE_LP_MAIN).' WHERE c_id = '.$course_info['real_id'].' AND id='.$lp_id;
  76. $rs = Database::query($sql);
  77. $lp_title = Database::result($rs, 0, 0);
  78. echo '<div class ="actions">';
  79. echo '<a href="javascript:window.back();">'.Display::return_icon('back.png',get_lang('Back'),'','32').'</a>';
  80. echo '<a href="javascript: void(0);" onclick="javascript: window.print();">
  81. '.Display::return_icon('printer.png',get_lang('Print'),'','32').'</a>';
  82. echo '<a href="'.api_get_self().'?export=csv&'.Security::remove_XSS($_SERVER['QUERY_STRING']).'">
  83. '.Display::return_icon('export_csv.png',get_lang('ExportAsCSV'),'','32').'</a>';
  84. echo '</div>';
  85. echo '<div class="clear"></div>';
  86. $session_name = api_get_session_name($session_id);
  87. $table_title = ($session_name? Display::return_icon('session.png', get_lang('Session'), array(), 22).' '.$session_name.' ':' ').
  88. Display::return_icon('course.png', get_lang('Course'), array(), 22).' '.$course_info['name'].' '.
  89. Display::return_icon('user.png', get_lang('User'), array(), 22).' '.$name;
  90. echo '<h2>'.$table_title.'</h2>';
  91. echo '<h3>'.Display::return_icon('learnpath.png', get_lang('ToolLearnpath'), array(), 22).' '.$lp_title.'</h3>';
  92. $list = learnpath :: get_flat_ordered_items_list($lp_id, 0, $course_info['real_id']);
  93. $origin = 'tracking';
  94. if ($export_csv) {
  95. require_once api_get_path(SYS_CODE_PATH).'newscorm/lp_stats.php';
  96. //Export :: export_table_csv($csv_content, 'reporting_student');
  97. } else {
  98. ob_start();
  99. require_once api_get_path(SYS_CODE_PATH).'newscorm/lp_stats.php';
  100. $tracking_content = ob_get_contents();
  101. ob_end_clean();
  102. echo api_utf8_decode($tracking_content, $charset);
  103. }
  104. Display :: display_footer();