lp_tracking.php 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * Learning paths reporting
  5. * @package chamilo.reporting
  6. */
  7. //require_once '../inc/global.inc.php';
  8. // resetting the course id
  9. $cidReset = true;
  10. $from_myspace = false;
  11. $from_link = '';
  12. if (isset($_GET['from']) && $_GET['from'] == 'myspace') {
  13. $from_link = '&from=myspace';
  14. $this_section = SECTION_TRACKING;
  15. } else {
  16. $this_section = SECTION_COURSES;
  17. }
  18. $session_id = isset($_REQUEST['id_session']) && !empty($_REQUEST['id_session']) ? intval($_REQUEST['id_session']) : api_get_session_id();
  19. $export_csv = isset($_GET['export']) && $_GET['export'] == 'csv' ? true : false;
  20. $user_id = isset($_GET['student_id']) ? intval($_GET['student_id']) : api_get_user_id();
  21. $courseCode = isset($_GET['course']) ? Security::remove_XSS($_GET['course']) : api_get_course_id();
  22. $origin = isset($_GET['origin']) ? Security::remove_XSS($_GET['origin']) : null;
  23. $lp_id = intval($_GET['lp_id']);
  24. $csv_content = array();
  25. $course_info = api_get_course_info($courseCode);
  26. if (empty($course_info) || empty($lp_id)) {
  27. api_not_allowed();
  28. }
  29. $userInfo = api_get_user_info($user_id);
  30. $name = $userInfo['complete_name'];
  31. if (!api_is_platform_admin(true) &&
  32. !CourseManager :: is_course_teacher(api_get_user_id(), $courseCode) &&
  33. !Tracking :: is_allowed_to_coach_student(api_get_user_id(), $user_id) && !api_is_drh() && !api_is_course_tutor()) {
  34. api_not_allowed();
  35. }
  36. if ($origin == 'user_course') {
  37. $interbreadcrumb[] = array ("url" => api_get_path(WEB_COURSE_PATH).$course_info['directory'], 'name' => $course_info['name']);
  38. $interbreadcrumb[] = array ("url" => "../user/user.php?cidReq=".$courseCode, "name" => get_lang("Users"));
  39. } else if($origin == 'tracking_course') {
  40. $interbreadcrumb[] = array ("url" => "../tracking/courseLog.php?cidReq=".$courseCode.'&id_session='.$session_id, "name" => get_lang("Tracking"));
  41. } else {
  42. $interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('MySpace'));
  43. $interbreadcrumb[] = array ("url" => "student.php", "name" => get_lang("MyStudents"));
  44. $interbreadcrumb[] = array ("url" => "myStudents.php?student=".$user_id, "name" => get_lang("StudentDetails"));
  45. $nameTools=get_lang("DetailsStudentInCourse");
  46. }
  47. $interbreadcrumb[] = array("url" => "myStudents.php?student=".$user_id."&course=".$courseCode."&details=true&origin=".$origin , "name" => get_lang("DetailsStudentInCourse"));
  48. $nameTools = get_lang('LearningPathDetails');
  49. $sql = 'SELECT name FROM '.Database::get_course_table(TABLE_LP_MAIN).' WHERE c_id = '.$course_info['real_id'].' AND id='.$lp_id;
  50. $rs = Database::query($sql);
  51. $lp_title = Database::result($rs, 0, 0);
  52. $origin = 'tracking';
  53. $output = require_once api_get_path(SYS_CODE_PATH).'newscorm/lp_stats.php';
  54. Display :: display_header($nameTools);
  55. echo '<div class ="actions">';
  56. echo '<a href="javascript:history.back();">'.Display::return_icon('back.png',get_lang('Back'),'',ICON_SIZE_MEDIUM).'</a>';
  57. echo '<a href="javascript: void(0);" onclick="javascript: window.print();">
  58. '.Display::return_icon('printer.png',get_lang('Print'),'',ICON_SIZE_MEDIUM).'</a>';
  59. echo '<a href="'.api_get_self().'?export=csv&'.Security::remove_XSS($_SERVER['QUERY_STRING']).'">
  60. '.Display::return_icon('export_csv.png',get_lang('ExportAsCSV'),'',ICON_SIZE_MEDIUM).'</a>';
  61. echo '</div>';
  62. echo '<div class="clear"></div>';
  63. $session_name = api_get_session_name($session_id);
  64. $table_title = ($session_name? Display::return_icon('session.png', get_lang('Session'), array(), ICON_SIZE_SMALL).' '.$session_name.' ':' ').
  65. Display::return_icon('course.png', get_lang('Course'), array(), ICON_SIZE_SMALL).' '.$course_info['name'].' '.
  66. Display::return_icon('user.png', get_lang('User'), array(), ICON_SIZE_SMALL).' '.$name;
  67. echo Display::page_header($table_title);
  68. echo Display::page_subheader('<h3>'.Display::return_icon('learnpath.png', get_lang('ToolLearnpath'), array(), ICON_SIZE_SMALL).' '.$lp_title.'</h3>');
  69. echo $output;
  70. Display :: display_footer();