course_log_events.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * @package chamilo.tracking
  5. */
  6. require_once __DIR__.'/../inc/global.inc.php';
  7. $this_section = SECTION_COURSES;
  8. $course_id = api_get_course_int_id();
  9. $course_code = api_get_course_id();
  10. $sessionId = api_get_session_id();
  11. // Access restrictions.
  12. $is_allowedToTrack = Tracking::isAllowToTrack($sessionId);
  13. if (!$is_allowedToTrack) {
  14. api_not_allowed(true);
  15. }
  16. // Starting the output buffering when we are exporting the information.
  17. $export_csv = isset($_GET['export']) && $_GET['export'] == 'csv' ? true : false;
  18. $exportXls = isset($_GET['export']) && $_GET['export'] == 'xls' ? true : false;
  19. $keyword = isset($_GET['keyword']) ? Security::remove_XSS($_GET['keyword']) : '';
  20. // jqgrid will use this URL to do the selects
  21. $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=course_log_events&'.api_get_cidreq().'&keyword='.$keyword;
  22. // The order is important you need to check the the $column variable in the model.ajax.php file
  23. $columns = [
  24. get_lang('Event type'),
  25. get_lang('Data type'),
  26. get_lang('Value'),
  27. get_lang('Course'),
  28. get_lang('Session'),
  29. get_lang('Username'),
  30. get_lang('IP address'),
  31. get_lang('Date'),
  32. ];
  33. // Column config
  34. $column_model = [
  35. [
  36. 'name' => 'col0',
  37. 'index' => 'col0',
  38. 'width' => '70',
  39. 'align' => 'left',
  40. 'sortable' => 'false',
  41. ],
  42. [
  43. 'name' => 'col1',
  44. 'index' => 'col1',
  45. 'width' => '50',
  46. 'align' => 'left',
  47. 'sortable' => 'false',
  48. ],
  49. [
  50. 'name' => 'col2',
  51. 'index' => 'col2',
  52. 'width' => '200',
  53. 'align' => 'left',
  54. 'sortable' => 'false',
  55. ],
  56. [
  57. 'name' => 'col3',
  58. 'index' => 'col3',
  59. 'width' => '50',
  60. 'align' => 'left',
  61. 'sortable' => 'false',
  62. 'hidden' => 'true',
  63. ],
  64. [
  65. 'name' => 'col4',
  66. 'index' => 'col4',
  67. 'width' => '50',
  68. 'align' => 'left',
  69. 'sortable' => 'false',
  70. 'hidden' => 'true',
  71. ],
  72. [
  73. 'name' => 'col5',
  74. 'index' => 'col5',
  75. 'width' => '50',
  76. 'align' => 'left',
  77. 'sortable' => 'false',
  78. ],
  79. [
  80. 'name' => 'col6',
  81. 'index' => '6',
  82. 'width' => '50',
  83. 'align' => 'left',
  84. 'sortable' => 'false',
  85. ],
  86. [
  87. 'name' => 'col7',
  88. 'index' => '7',
  89. 'width' => '50',
  90. 'align' => 'left',
  91. ],
  92. ];
  93. // Autowidth
  94. $extra_params['autowidth'] = 'true';
  95. // height auto
  96. $extra_params['height'] = 'auto';
  97. // Order by date
  98. $extra_params['sortorder'] = 'desc';
  99. $extra_params['sortname'] = 'col7';
  100. $actionLinks = '';
  101. // Add the JS needed to use the jqgrid
  102. $htmlHeadXtra[] = api_get_jqgrid_js();
  103. $htmlHeadXtra[] = '
  104. <script>
  105. $(function() {
  106. '.Display::grid_js(
  107. 'course_log_events',
  108. $url,
  109. $columns,
  110. $column_model,
  111. $extra_params,
  112. [],
  113. $actionLinks,
  114. true
  115. ).'
  116. });
  117. </script>';
  118. Display::display_header();
  119. echo '<div class="actions">';
  120. echo TrackingCourseLog::actionsLeft('logs', api_get_session_id());
  121. echo '</div>';
  122. $form = new FormValidator(
  123. 'search_simple',
  124. 'get',
  125. api_get_self().'?'.api_get_cidreq(),
  126. '',
  127. [],
  128. FormValidator::LAYOUT_INLINE
  129. );
  130. $form->addHidden('report', 'activities');
  131. $form->addHidden('activities_direction', 'DESC');
  132. $form->addElement('text', 'keyword', get_lang('Keyword'));
  133. $form->addButtonSearch(get_lang('Search'), 'submit');
  134. echo '<div class="actions">';
  135. $form->display();
  136. echo '</div>';
  137. echo Display::grid_html('course_log_events');
  138. Display::display_footer();