lp_tracking.php 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <?php
  2. /*
  3. ==============================================================================
  4. Dokeos - elearning and course management software
  5. Copyright (c) 2008-2009 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. Display::display_header('');
  42. api_not_allowed();
  43. Display::display_footer();
  44. }
  45. $_course = CourseManager :: get_course_information($_GET['course']);
  46. $_course['dbNameGlu'] = $_configuration['table_prefix'] . $_course['db_name'] . $_configuration['db_glue'];
  47. $cidReq = Security::remove_XSS($_GET['course']);
  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=".Security::remove_XSS($_GET['course']), "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=".Security::remove_XSS($_GET['course']).'&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=".Security::remove_XSS($_GET['course'])."&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. {
  79. border-collapse: collapse;
  80. }
  81. .data_table th{
  82. padding-right: 0px;
  83. border: 1px solid gray;
  84. background-color: #eef;
  85. }
  86. .data_table tr.row_odd
  87. {
  88. background-color: #fafafa;
  89. }
  90. .data_table tr.row_odd:hover, .data_table tr.row_even:hover
  91. {
  92. background-color: #f0f0f0;
  93. }
  94. .data_table tr.row_even
  95. {
  96. background-color: #fff;
  97. }
  98. .data_table td
  99. {
  100. padding: 5px;
  101. vertical-align: top;
  102. border-bottom: 1px solid #b1b1b1;
  103. border-right: 1px dotted #e1e1e1;
  104. border-left: 1px dotted #e1e1e1;
  105. }
  106. .margin_table
  107. {
  108. margin-left : 3px;
  109. width: 80%;
  110. }
  111. .margin_table td.title
  112. {
  113. background-color: #ffff99;
  114. }
  115. .margin_table td.content
  116. {
  117. background-color: #ddddff;
  118. }
  119. </style>';
  120. Display :: display_header($nameTools);
  121. $lp_id = intval($_GET['lp_id']);
  122. $sql = 'SELECT name
  123. FROM '.Database::get_course_table(TABLE_LP_MAIN, $_course['db_name']).'
  124. WHERE id='.Database::escape_string($lp_id);
  125. $rs = api_sql_query($sql, __FILE__, __LINE__);
  126. $lp_title = Database::result($rs, 0, 0);
  127. echo '<div class ="actions"><div align="left" style="float:left;margin-top:2px;" ><strong>'.$_course['title'].' - '.$lp_title.' - '.$name.'</strong></div>
  128. <div align="right">
  129. <a href="#" onclick="window.print()"><img align="absbottom" src="../img/printmgr.gif">&nbsp;'.get_lang('Print').'</a>
  130. <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>
  131. </div></div>
  132. <div class="clear"></div>';
  133. $list = learnpath :: get_flat_ordered_items_list($lp_id);
  134. $origin = 'tracking';
  135. if($export_csv) {
  136. include_once('../newscorm/lp_stats.php');
  137. //Export :: export_table_csv($csv_content, 'reporting_student');
  138. } else {
  139. ob_start();
  140. include_once('../newscorm/lp_stats.php');
  141. $tracking_content = ob_get_contents();
  142. ob_end_clean();
  143. echo utf8_decode($tracking_content);
  144. }
  145. Display :: display_footer();
  146. ?>