lp_tracking.php 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <?php
  2. /* For licensing terms, see /dokeos_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. //$cidReset = true;
  9. require '../inc/global.inc.php';
  10. $from_myspace = false;
  11. $from_link = '';
  12. if (isset($_GET['from']) && $_GET['from'] == 'myspace') {
  13. $from_link = '&from=myspace';
  14. $this_section = "session_my_space";
  15. } else {
  16. $this_section = SECTION_COURSES;
  17. }
  18. include_once api_get_path(LIBRARY_PATH).'tracking.lib.php';
  19. include_once api_get_path(LIBRARY_PATH).'export.lib.inc.php';
  20. include_once api_get_path(LIBRARY_PATH).'course.lib.php';
  21. include_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
  22. include_once api_get_path(SYS_CODE_PATH).'newscorm/learnpath.class.php';
  23. include_once api_get_path(SYS_CODE_PATH).'newscorm/learnpathItem.class.php';
  24. require_once api_get_path(LIBRARY_PATH).'export.lib.inc.php';
  25. $export_csv = isset($_GET['export']) && $_GET['export'] == 'csv' ? true : false;
  26. if ($export_csv) {
  27. ob_start();
  28. }
  29. $csv_content = array();
  30. $user_id = intval($_GET['student_id']);
  31. if (isset($_GET['course'])) {
  32. $cidReq = Security::remove_XSS($_GET['course']);
  33. }
  34. $user_infos = UserManager :: get_user_info_by_id($user_id);
  35. $name = api_get_person_name($user_infos['firstname'], $user_infos['lastname']);
  36. 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']) && $user_infos['hr_dept_id']!==$_user['user_id']) {
  37. Display::display_header('');
  38. api_not_allowed();
  39. Display::display_footer();
  40. }
  41. $course_exits = CourseManager::course_exists($cidReq);
  42. if (!empty($course_exits)) {
  43. $_course = CourseManager :: get_course_information($cidReq);
  44. } else {
  45. api_not_allowed();
  46. }
  47. $_course['dbNameGlu'] = $_configuration['table_prefix'] . $_course['db_name'] . $_configuration['db_glue'];
  48. if (!empty($_GET['origin']) && $_GET['origin'] == 'user_course') {
  49. $interbreadcrumb[] = array ("url" => api_get_path(WEB_COURSE_PATH).$_course['directory'], 'name' => $_course['title']);
  50. $interbreadcrumb[] = array ("url" => "../user/user.php?cidReq=".$cidReq, "name" => get_lang("Users"));
  51. } else if(!empty($_GET['origin']) && $_GET['origin'] == 'tracking_course') {
  52. $interbreadcrumb[] = array ("url" => api_get_path(WEB_COURSE_PATH).$_course['directory'], 'name' => $_course['title']);
  53. $interbreadcrumb[] = array ("url" => "../tracking/courseLog.php?cidReq=".$cidReq.'&studentlist=true&id_session='.$_SESSION['id_session'], "name" => get_lang("Tracking"));
  54. } else {
  55. $interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('MySpace'));
  56. $interbreadcrumb[] = array ("url" => "student.php", "name" => get_lang("MyStudents"));
  57. $interbreadcrumb[] = array ("url" => "myStudents.php?student=".Security::remove_XSS($_GET['student_id']), "name" => get_lang("StudentDetails"));
  58. $nameTools=get_lang("DetailsStudentInCourse");
  59. }
  60. $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"));
  61. $nameTools = get_lang('LearningPathDetails');
  62. $htmlHeadXtra[] = '
  63. <style>
  64. div.title {
  65. font-weight : bold;
  66. text-align : left;
  67. }
  68. div.mystatusfirstrow {
  69. font-weight : bold;
  70. text-align : left;
  71. }
  72. div.description {
  73. font-family : Arial, Helvetica, sans-serif;
  74. font-size: 10px;
  75. color: Silver;
  76. }
  77. .data_table {
  78. border-collapse: collapse;
  79. }
  80. .data_table th {
  81. padding-right: 0px;
  82. border: 1px solid gray;
  83. background-color: #eef;
  84. }
  85. .data_table tr.row_odd {
  86. background-color: #fafafa;
  87. }
  88. .data_table tr.row_odd:hover, .data_table tr.row_even:hover {
  89. background-color: #f0f0f0;
  90. }
  91. .data_table tr.row_even {
  92. background-color: #fff;
  93. }
  94. .data_table td {
  95. padding: 5px;
  96. vertical-align: top;
  97. border-bottom: 1px solid #b1b1b1;
  98. border-right: 1px dotted #e1e1e1;
  99. border-left: 1px dotted #e1e1e1;
  100. }
  101. .margin_table {
  102. margin-left : 3px;
  103. width: 80%;
  104. }
  105. .margin_table td.title {
  106. background-color: #ffff99;
  107. }
  108. .margin_table td.content {
  109. background-color: #ddddff;
  110. }
  111. </style>';
  112. Display :: display_header($nameTools);
  113. $lp_id = intval($_GET['lp_id']);
  114. $sql = 'SELECT name
  115. FROM '.Database::get_course_table(TABLE_LP_MAIN, $_course['db_name']).'
  116. WHERE id='.Database::escape_string($lp_id);
  117. $rs = Database::query($sql, __FILE__, __LINE__);
  118. $lp_title = Database::result($rs, 0, 0);
  119. echo '<div class ="actions"><div align="left" style="float:left;margin-top:2px;" ><strong>'.$_course['title'].' - '.$lp_title.' - '.$name.'</strong></div>
  120. <div align="right">
  121. <a href="javascript: void(0);" onclick="javascript: window.print();"><img align="absbottom" src="../img/printmgr.gif">&nbsp;'.get_lang('Print').'</a>
  122. <a href="'.api_get_self().'?export=csv&'.Security::remove_XSS($_SERVER['QUERY_STRING']).'"><img align="absbottom" src="../img/excel.gif">&nbsp;'.get_lang('ExportAsCSV').'</a>
  123. </div></div>
  124. <div class="clear"></div>';
  125. $list = learnpath :: get_flat_ordered_items_list($lp_id);
  126. $origin = 'tracking';
  127. if ($export_csv) {
  128. include_once api_get_path(SYS_CODE_PATH).'newscorm/lp_stats.php';
  129. //Export :: export_table_csv($csv_content, 'reporting_student');
  130. } else {
  131. ob_start();
  132. include_once api_get_path(SYS_CODE_PATH).'newscorm/lp_stats.php';
  133. $tracking_content = ob_get_contents();
  134. ob_end_clean();
  135. echo api_utf8_decode($tracking_content, $charset);
  136. }
  137. Display :: display_footer();