course_log_resources.php 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * @package chamilo.tracking
  5. */
  6. /* INIT SECTION */
  7. $pathopen = isset($_REQUEST['pathopen']) ? $_REQUEST['pathopen'] : null;
  8. // Language files that need to be included.
  9. $language_file = array('admin', 'tracking', 'scorm', 'exercice');
  10. // Including the global initialization file
  11. require_once '../inc/global.inc.php';
  12. $current_course_tool = TOOL_TRACKING;
  13. $course_info = api_get_course_info(api_get_course_id());
  14. if (!empty($course_info)) {
  15. //api_protect_course_script();
  16. }
  17. $from_myspace = false;
  18. $from = isset($_GET['from']) ? $_GET['from'] : null;
  19. if ($from == 'myspace') {
  20. $from_myspace = true;
  21. $this_section = "session_my_space";
  22. } else {
  23. $this_section = SECTION_COURSES;
  24. }
  25. // Access restrictions.
  26. $is_allowedToTrack = api_is_platform_admin() || api_is_allowed_to_create_course() || api_is_session_admin() || api_is_drh() || api_is_course_tutor();
  27. if (!$is_allowedToTrack) {
  28. api_not_allowed();
  29. exit;
  30. }
  31. // Including additional libraries.
  32. require_once api_get_path(SYS_CODE_PATH).'newscorm/learnpath.class.php';
  33. require_once api_get_path(SYS_CODE_PATH).'newscorm/learnpathItem.class.php';
  34. require_once api_get_path(SYS_CODE_PATH).'newscorm/scorm.class.php';
  35. require_once api_get_path(SYS_CODE_PATH).'newscorm/scormItem.class.php';
  36. require_once api_get_path(LIBRARY_PATH).'statsUtils.lib.inc.php';
  37. require_once api_get_path(SYS_CODE_PATH).'resourcelinker/resourcelinker.inc.php';
  38. require_once api_get_path(SYS_CODE_PATH).'survey/survey.lib.php';
  39. // Starting the output buffering when we are exporting the information.
  40. $export_csv = isset($_GET['export']) && $_GET['export'] == 'csv' ? true : false;
  41. $session_id = intval($_REQUEST['id_session']);
  42. if ($export_csv) {
  43. if (!empty($session_id)) {
  44. $_SESSION['id_session'] = $session_id;
  45. }
  46. ob_start();
  47. }
  48. // Breadcrumbs.
  49. if (isset($_GET['origin']) && $_GET['origin'] == 'resume_session') {
  50. $interbreadcrumb[] = array('url' => '../session/index.php','name' => get_lang('PlatformAdmin'));
  51. $interbreadcrumb[] = array('url' => '../session/session_list.php','name' => get_lang('SessionList'));
  52. $interbreadcrumb[] = array('url' => '../session/resume_session.php?id_session='.api_get_session_id(), 'name' => get_lang('SessionOverview'));
  53. }
  54. $nameTools = get_lang('Tracking');
  55. // Display the header.
  56. Display::display_header($nameTools, 'Tracking');
  57. /* MAIN CODE */
  58. echo '<div class="actions">';
  59. echo Display::url(Display::return_icon('user.png', get_lang('StudentsTracking'), array(), 32), 'courseLog.php?'.api_get_cidreq());
  60. echo Display::url(Display::return_icon('group.png', get_lang('GroupReporting'), array(), 32), 'course_log_groups.php?'.api_get_cidreq(true, false));
  61. echo Display::url(Display::return_icon('course.png', get_lang('CourseTracking'), array(), 32), 'course_log_tools.php?'.api_get_cidreq());
  62. echo Display::return_icon('tools_na.png', get_lang('ResourcesTracking'), array(), 32);
  63. echo '<span style="float:right; padding-top:0px;">';
  64. echo '<a href="javascript: void(0);" onclick="javascript: window.print();">'.Display::return_icon('printer.png', get_lang('Print'),'',ICON_SIZE_MEDIUM).'</a>';
  65. $addional_param = '';
  66. if (isset($_GET['additional_profile_field'])) {
  67. $addional_param ='additional_profile_field='.intval($_GET['additional_profile_field']);
  68. }
  69. $users_tracking_per_page = '';
  70. if (isset($_GET['users_tracking_per_page'])) {
  71. $users_tracking_per_page= '&users_tracking_per_page='.intval($_GET['users_tracking_per_page']);
  72. }
  73. echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&export=csv&'.$addional_param.$users_tracking_per_page.'">
  74. '.Display::return_icon('export_csv.png', get_lang('ExportAsCSV'),'',ICON_SIZE_MEDIUM).'</a>';
  75. echo '</span>';
  76. echo '</div>';
  77. // Create a search-box.
  78. $form = new FormValidator('search_simple', 'GET', api_get_path(WEB_CODE_PATH).'tracking/course_log_resources.php?'.api_get_cidreq(), '', array('class' => 'form-search'), false);
  79. $renderer = $form->defaultRenderer();
  80. $renderer->setElementTemplate('<span>{element}</span>');
  81. $form->addElement('text', 'keyword', get_lang('keyword'));
  82. $form->addElement('style_submit_button', 'submit', get_lang('SearchUsers'), 'class="search"');
  83. echo '<div class="actions">';
  84. $form->display();
  85. echo '</div>';
  86. $table = new SortableTable('resources', array('TrackingCourseLog', 'count_item_resources'), array('TrackingCourseLog', 'get_item_resources_data'), 5, 20, 'DESC');
  87. $parameters = array();
  88. if (isset($_GET['keyword'])) {
  89. $parameters['keyword'] = Security::remove_XSS($_GET['keyword']);
  90. }
  91. $table->set_additional_parameters($parameters);
  92. $table->set_header(0, get_lang('Tool'));
  93. $table->set_header(1, get_lang('EventType'));
  94. $table->set_header(2, get_lang('Session'), false);
  95. $table->set_header(3, get_lang('UserName'), true, 'width=65px');
  96. $table->set_header(4, get_lang('IPAddress'), true, 'width=100px');
  97. $table->set_header(5, get_lang('Document'), false);
  98. $table->set_header(6, get_lang('Date'), true, 'width=190px');
  99. $table->display();
  100. Display::display_footer();