course_log_resources.php 5.1 KB

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