course_log_resources.php 4.7 KB

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