course_log_resources.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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 __DIR__.'/../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. // Starting the output buffering when we are exporting the information.
  26. $export_csv = isset($_GET['export']) && $_GET['export'] == 'csv' ? true : false;
  27. $session_id = intval($_REQUEST['id_session']);
  28. if ($export_csv) {
  29. ob_start();
  30. }
  31. if (empty($session_id)) {
  32. $session_id = api_get_session_id();
  33. }
  34. // Breadcrumbs.
  35. if (isset($_GET['origin']) && $_GET['origin'] == 'resume_session') {
  36. $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'admin/index.php', 'name' => get_lang('PlatformAdmin'));
  37. $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'session/session_list.php', 'name' => get_lang('SessionList'));
  38. $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'session/resume_session.php?id_session='.api_get_session_id(), 'name' => get_lang('SessionOverview'));
  39. }
  40. $nameTools = get_lang('Tracking');
  41. // Display the header.
  42. Display::display_header($nameTools, 'Tracking');
  43. /* MAIN CODE */
  44. echo '<div class="actions">';
  45. echo Display::url(
  46. Display::return_icon('user.png', get_lang('StudentsTracking'), array(), ICON_SIZE_MEDIUM),
  47. api_get_path(WEB_CODE_PATH).'tracking/courseLog.php?'.api_get_cidreq()
  48. );
  49. echo Display::url(
  50. Display::return_icon('group.png', get_lang('GroupReporting'), array(), ICON_SIZE_MEDIUM),
  51. 'course_log_groups.php?'.api_get_cidreq(true, false)
  52. );
  53. echo Display::url(
  54. Display::return_icon('course.png', get_lang('CourseTracking'), array(), ICON_SIZE_MEDIUM),
  55. api_get_path(WEB_CODE_PATH).'tracking/course_log_tools.php?'.api_get_cidreq()
  56. );
  57. echo Display::return_icon('tools_na.png', get_lang('ResourcesTracking'), array(), ICON_SIZE_MEDIUM);
  58. echo '<span style="float:right; padding-top:0px;">';
  59. echo '<a href="javascript: void(0);" onclick="javascript: window.print();">'.
  60. Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_MEDIUM).
  61. '</a>';
  62. $addional_param = '';
  63. if (isset($_GET['additional_profile_field'])) {
  64. $addional_param = 'additional_profile_field='.intval($_GET['additional_profile_field']);
  65. }
  66. $users_tracking_per_page = '';
  67. if (isset($_GET['users_tracking_per_page'])) {
  68. $users_tracking_per_page = '&users_tracking_per_page='.intval($_GET['users_tracking_per_page']);
  69. }
  70. echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&export=csv&'.$addional_param.$users_tracking_per_page.'">
  71. '.Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), '', ICON_SIZE_MEDIUM).'</a>';
  72. echo '</span>';
  73. echo '</div>';
  74. // Create a search-box.
  75. $form = new FormValidator(
  76. 'search_simple',
  77. 'GET',
  78. api_get_path(WEB_CODE_PATH).'tracking/course_log_resources.php?'.api_get_cidreq().'&id_session'.$session_id,
  79. '',
  80. array('class' => 'form-search'),
  81. false
  82. );
  83. $renderer = $form->defaultRenderer();
  84. $renderer->setCustomElementTemplate('<span>{element}</span>');
  85. $form->addElement('text', 'keyword', get_lang('Keyword'));
  86. $form->addElement('hidden', 'cidReq', api_get_course_id());
  87. $form->addElement('hidden', 'id_session', $session_id);
  88. $form->addButtonSearch(get_lang('SearchUsers'), 'submit');
  89. echo '<div class="actions">';
  90. $form->display();
  91. echo '</div>';
  92. $table = new SortableTable(
  93. 'resources',
  94. array('TrackingCourseLog', 'count_item_resources'),
  95. array('TrackingCourseLog', 'get_item_resources_data'),
  96. 5,
  97. 20,
  98. 'DESC'
  99. );
  100. $parameters = array(
  101. //'keyword' => Security::remove_XSS($_GET['keyword']),
  102. 'id_session' => $session_id,
  103. 'cidReq' => api_get_course_id()
  104. );
  105. $table->set_additional_parameters($parameters);
  106. $table->set_header(0, get_lang('Tool'));
  107. $table->set_header(1, get_lang('EventType'));
  108. $table->set_header(2, get_lang('Session'), false);
  109. $table->set_header(3, get_lang('UserName'), true, 'width=65px');
  110. $table->set_header(4, get_lang('IPAddress'), true, 'width=100px');
  111. $table->set_header(5, get_lang('Document'), false);
  112. $table->set_header(6, get_lang('Date'), true, 'width=190px');
  113. $table->display();
  114. Display::display_footer();