course_log_resources.php 4.7 KB

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