lp_tracking.php 4.8 KB

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