course_log_groups.php 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * @package chamilo.tracking
  5. */
  6. // Language files that need to be included.
  7. $language_file = array('admin', 'tracking', 'scorm', 'exercice');
  8. // Including the global initialization file
  9. //require_once '../inc/global.inc.php';
  10. $from_myspace = false;
  11. $from = isset($_GET['from']) ? $_GET['from'] : null;
  12. if ($from == 'myspace') {
  13. $from_myspace = true;
  14. $this_section = "session_my_space";
  15. } else {
  16. $this_section = SECTION_COURSES;
  17. }
  18. // Access restrictions.
  19. $is_allowedToTrack = api_is_platform_admin() || api_is_allowed_to_create_course() || api_is_session_admin() || api_is_drh() || api_is_course_tutor();
  20. if (!$is_allowedToTrack) {
  21. api_not_allowed();
  22. exit;
  23. }
  24. $course_id = api_get_course_int_id();
  25. $course_code = api_get_course_id();
  26. //jqgrid will use this URL to do the selects
  27. $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_group_reporting&course_id='.$course_id;
  28. //The order is important you need to check the the $column variable in the model.ajax.php file
  29. $columns = array(
  30. get_lang('Name'), get_lang('Time'), get_lang('Progress'), get_lang('Score'), get_lang('Works'), get_lang('Messages'), get_lang('Actions')
  31. );
  32. //Column config
  33. $column_model = array(
  34. array('name' => 'name', 'index' => 'name', 'width' => '200', 'align' => 'left'),
  35. array('name' => 'time', 'index' => 'time', 'width' => '50', 'align' => 'left', 'sortable' => 'false'),
  36. array('name' => 'progress', 'index' => 'progress', 'width' => '50', 'align' => 'left', 'sortable' => 'false'),
  37. array('name' => 'score', 'index' => 'score', 'width' => '50', 'align' => 'left', 'sortable' => 'false'),
  38. array('name' => 'works', 'index' => 'works', 'width' => '50', 'align' => 'left', 'sortable' => 'false'),
  39. array('name' => 'messages', 'index' => 'messages', 'width' => '50', 'align' => 'left', 'sortable' => 'false'),
  40. array('name' => 'actions', 'index' => 'actions', 'width' => '50', 'align' => 'left', 'formatter' => 'action_formatter', 'sortable' => 'false')
  41. );
  42. //Autowidth
  43. $extra_params['autowidth'] = 'true';
  44. //height auto
  45. $extra_params['height'] = 'auto';
  46. $action_links = '
  47. function action_formatter(cellvalue, options, rowObject) {
  48. return \'<a href="course_log_tools.php?id_session=0&cidReq='.$course_code.'&gidReq=\'+options.rowId+\'">'.Display::return_icon('2rightarrow.gif',get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>'.
  49. '\';
  50. }';
  51. //Add the JS needed to use the jqgrid
  52. $htmlHeadXtra[] = api_get_jqgrid_js();
  53. $htmlHeadXtra[] = '
  54. <script>
  55. $(function() {
  56. '.Display::grid_js('group_users',$url, $columns, $column_model, $extra_params, array(), $action_links, true).'
  57. });
  58. </script>';
  59. Display::display_header();
  60. echo '<div class="actions">';
  61. echo Display::url(Display::return_icon('user.png', get_lang('StudentsTracking'), array(), 32), 'courseLog.php?'.api_get_cidreq(true, false));
  62. echo Display::url(Display::return_icon('group_na.png', get_lang('GroupReporting'), array(), 32), '#');
  63. echo Display::url(Display::return_icon('course.png', get_lang('CourseTracking'), array(), 32), 'course_log_tools.php?'.api_get_cidreq(true, false));
  64. echo Display::url(Display::return_icon('tools.png', get_lang('ResourcesTracking'), array(), 32), 'course_log_resources.php?'.api_get_cidreq(true, false));
  65. echo '</div>';
  66. echo Display::grid_html('group_users');
  67. Display::display_footer();