lp_tracking.php 5.1 KB

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