lp_tracking.php 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <?php
  2. /*
  3. ==============================================================================
  4. Dokeos - elearning and course management software
  5. Copyright (c) 2008 Dokeos SPRL
  6. For a full list of contributors, see "credits.txt".
  7. The full license can be read in "license.txt".
  8. This program is free software; you can redistribute it and/or
  9. modify it under the terms of the GNU General Public License
  10. as published by the Free Software Foundation; either version 2
  11. of the License, or (at your option) any later version.
  12. See the GNU General Public License for more details.
  13. Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
  14. Mail: info@dokeos.com
  15. ==============================================================================
  16. */
  17. /*
  18. * Created on 26 mars 07 by Eric Marguin
  19. * Script to display the tracking of the students in the learning paths.
  20. */
  21. $language_file = array ('registration', 'index', 'tracking', 'exercice', 'scorm', 'learnpath');
  22. $cidReset = true;
  23. include ('../inc/global.inc.php');
  24. include_once(api_get_path(LIBRARY_PATH).'tracking.lib.php');
  25. include_once(api_get_path(LIBRARY_PATH).'export.lib.inc.php');
  26. include_once(api_get_path(LIBRARY_PATH).'course.lib.php');
  27. include_once(api_get_path(LIBRARY_PATH).'usermanager.lib.php');
  28. include_once('../newscorm/learnpath.class.php');
  29. include_once('../newscorm/learnpathItem.class.php');
  30. require_once (api_get_path(LIBRARY_PATH).'export.lib.inc.php');
  31. $export_csv = isset($_GET['export']) && $_GET['export'] == 'csv' ? true : false;
  32. if($export_csv)
  33. {
  34. ob_start();
  35. }
  36. $csv_content = array();
  37. $user_id = intval($_GET['student_id']);
  38. $user_infos = UserManager :: get_user_info_by_id($user_id);
  39. $name = $user_infos['firstname'].' '.$user_infos['lastname'];
  40. if(!api_is_platform_admin(true) && !CourseManager :: is_course_teacher($_user['user_id'], $_GET['course']) && !Tracking :: is_allowed_to_coach_student($_user['user_id'],$_GET['student_id']) && $user_infos['hr_dept_id']!==$_user['user_id'])
  41. {
  42. Display::display_header('');
  43. api_not_allowed();
  44. Display::display_footer();
  45. }
  46. $_course = CourseManager :: get_course_information($_GET['course']);
  47. $_course['dbNameGlu'] = $_configuration['table_prefix'] . $_course['db_name'] . $_configuration['db_glue'];
  48. $cidReq = $_GET['course'];
  49. if(!empty($_GET['origin']) && $_GET['origin'] == 'user_course')
  50. {
  51. $interbreadcrumb[] = array ("url" => api_get_path(WEB_COURSE_PATH).$_course['directory'], 'name' => $_course['title']);
  52. $interbreadcrumb[] = array ("url" => "../user/user.php?cidReq=".$_GET['course'], "name" => get_lang("Users"));
  53. }
  54. else if(!empty($_GET['origin']) && $_GET['origin'] == 'tracking_course')
  55. {
  56. $interbreadcrumb[] = array ("url" => api_get_path(WEB_COURSE_PATH).$_course['directory'], 'name' => $_course['title']);
  57. $interbreadcrumb[] = array ("url" => "../tracking/courseLog.php?cidReq=".$_GET['course'].'&studentlist=true&id_session='.$_SESSION['id_session'], "name" => get_lang("Tracking"));
  58. }
  59. else
  60. {
  61. $interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('MySpace'));
  62. $interbreadcrumb[] = array ("url" => "student.php", "name" => get_lang("MyStudents"));
  63. $interbreadcrumb[] = array ("url" => "myStudents.php?student=".$_GET['student_id'], "name" => get_lang("StudentDetails"));
  64. $nameTools=get_lang("DetailsStudentInCourse");
  65. }
  66. $interbreadcrumb[] = array("url" => "myStudents.php?student=".$_GET['student_id']."&course=".$_GET['course']."&details=true&origin=".$_GET['origin'] , "name" => get_lang("DetailsStudentInCourse"));
  67. $nameTools = get_lang('LearningPathDetails');
  68. $htmlHeadXtra[] = '
  69. <style>
  70. div.title {
  71. font-weight : bold;
  72. text-align : left;
  73. }
  74. div.mystatusfirstrow {
  75. font-weight : bold;
  76. text-align : left;
  77. }
  78. div.description {
  79. font-family : Arial, Helvetica, sans-serif;
  80. font-size: 10px;
  81. color: Silver;
  82. }
  83. .data_table
  84. {
  85. border-collapse: collapse;
  86. }
  87. .data_table th{
  88. padding-right: 0px;
  89. border: 1px solid gray;
  90. background-color: #eef;
  91. }
  92. .data_table tr.row_odd
  93. {
  94. background-color: #fafafa;
  95. }
  96. .data_table tr.row_odd:hover, .data_table tr.row_even:hover
  97. {
  98. background-color: #f0f0f0;
  99. }
  100. .data_table tr.row_even
  101. {
  102. background-color: #fff;
  103. }
  104. .data_table td
  105. {
  106. padding: 5px;
  107. vertical-align: top;
  108. border-bottom: 1px solid #b1b1b1;
  109. border-right: 1px dotted #e1e1e1;
  110. border-left: 1px dotted #e1e1e1;
  111. }
  112. .margin_table
  113. {
  114. margin-left : 3px;
  115. width: 80%;
  116. }
  117. .margin_table td.title
  118. {
  119. background-color: #ffff99;
  120. }
  121. .margin_table td.content
  122. {
  123. background-color: #ddddff;
  124. }
  125. </style>';
  126. Display :: display_header($nameTools);
  127. $lp_id = intval($_GET['lp_id']);
  128. $sql = 'SELECT name
  129. FROM '.Database::get_course_table(TABLE_LP_MAIN, $_course['db_name']).'
  130. WHERE id='.$lp_id;
  131. $rs = api_sql_query($sql, __FILE__, __LINE__);
  132. $lp_title = Database::result($rs, 0, 0);
  133. echo '<div align="left" style="float:left"><h4>'.$_course['title'].' - '.$lp_title.' - '.$name.'</h4></div>
  134. <div align="right">
  135. <a href="#" onclick="window.print()"><img align="absbottom" src="../img/printmgr.gif">&nbsp;'.get_lang('Print').'</a>
  136. <a href="'.api_get_self().'?export=csv&'.$_SERVER['QUERY_STRING'].'"><img align="absbottom" src="../img/excel.gif">&nbsp;'.get_lang('ExportAsCSV').'</a>
  137. </div>
  138. <div class="clear"></div>';
  139. $list = learnpath :: get_flat_ordered_items_list($lp_id);
  140. $origin = 'tracking';
  141. if($export_csv)
  142. {
  143. include_once('../newscorm/lp_stats.php');
  144. ob_end_clean();
  145. Export :: export_table_csv($csv_content, 'reporting_student');
  146. }
  147. else
  148. {
  149. ob_start();
  150. include_once('../newscorm/lp_stats.php');
  151. $tracking_content = ob_get_contents();
  152. ob_end_clean();
  153. echo utf8_decode($tracking_content);
  154. }
  155. Display :: display_footer();
  156. ?>