course_log_groups.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. require_once __DIR__.'/../inc/global.inc.php';
  4. $from_myspace = false;
  5. $from = isset($_GET['from']) ? $_GET['from'] : null;
  6. if ($from == 'myspace') {
  7. $from_myspace = true;
  8. $this_section = "session_my_space";
  9. } else {
  10. $this_section = SECTION_COURSES;
  11. }
  12. // Access restrictions.
  13. $is_allowedToTrack = api_is_platform_admin() || api_is_allowed_to_create_course() || api_is_session_admin() || api_is_drh() || api_is_course_tutor();
  14. if (!$is_allowedToTrack) {
  15. api_not_allowed(true);
  16. exit;
  17. }
  18. $course_id = api_get_course_int_id();
  19. $course_code = api_get_course_id();
  20. $sessionId = api_get_session_id();
  21. // jqgrid will use this URL to do the selects
  22. $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_group_reporting&course_id='.$course_id.'&session_id='.$sessionId;
  23. // The order is important you need to check the the $column variable in the model.ajax.php file
  24. $columns = array(
  25. get_lang('Name'),
  26. get_lang('Time'),
  27. get_lang('Progress'),
  28. get_lang('Score'),
  29. get_lang('Works'),
  30. get_lang('Messages'),
  31. get_lang('Actions'),
  32. );
  33. // Column config
  34. $column_model = array(
  35. array(
  36. 'name' => 'name',
  37. 'index' => 'name',
  38. 'width' => '200',
  39. 'align' => 'left',
  40. ),
  41. array(
  42. 'name' => 'time',
  43. 'index' => 'time',
  44. 'width' => '50',
  45. 'align' => 'left',
  46. 'sortable' => 'false',
  47. ),
  48. array(
  49. 'name' => 'progress',
  50. 'index' => 'progress',
  51. 'width' => '50',
  52. 'align' => 'left',
  53. 'sortable' => 'false',
  54. ),
  55. array(
  56. 'name' => 'score',
  57. 'index' => 'score',
  58. 'width' => '50',
  59. 'align' => 'left',
  60. 'sortable' => 'false',
  61. ),
  62. array(
  63. 'name' => 'works',
  64. 'index' => 'works',
  65. 'width' => '50',
  66. 'align' => 'left',
  67. 'sortable' => 'false',
  68. ),
  69. array(
  70. 'name' => 'messages',
  71. 'index' => 'messages',
  72. 'width' => '50',
  73. 'align' => 'left',
  74. 'sortable' => 'false',
  75. ),
  76. array(
  77. 'name' => 'actions',
  78. 'index' => 'actions',
  79. 'width' => '50',
  80. 'align' => 'left',
  81. 'formatter' => 'action_formatter',
  82. 'sortable' => 'false',
  83. ),
  84. );
  85. // Autowidth
  86. $extra_params['autowidth'] = 'true';
  87. // height auto
  88. $extra_params['height'] = 'auto';
  89. $action_links = '
  90. function action_formatter(cellvalue, options, rowObject) {
  91. return \'<a href="course_log_tools.php?id_session=0&cidReq='.$course_code.'&gidReq=\'+options.rowId+\'">'.Display::return_icon('2rightarrow.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>'.
  92. '\';
  93. }';
  94. // Add the JS needed to use the jqgrid
  95. $htmlHeadXtra[] = api_get_jqgrid_js();
  96. $htmlHeadXtra[] = '
  97. <script>
  98. $(function() {
  99. '.Display::grid_js('group_users', $url, $columns, $column_model, $extra_params, array(), $action_links, true).'
  100. });
  101. </script>';
  102. Display::display_header();
  103. echo '<div class="actions">';
  104. echo Display::url(Display::return_icon('user.png', get_lang('StudentsTracking'), array(), ICON_SIZE_MEDIUM), 'courseLog.php?'.api_get_cidreq(true, false));
  105. echo Display::url(Display::return_icon('group_na.png', get_lang('GroupReporting'), array(), ICON_SIZE_MEDIUM), '#');
  106. echo Display::url(Display::return_icon('course.png', get_lang('CourseTracking'), array(), ICON_SIZE_MEDIUM), 'course_log_tools.php?'.api_get_cidreq(true, false));
  107. echo Display::url(Display::return_icon('tools.png', get_lang('ResourcesTracking'), array(), ICON_SIZE_MEDIUM), 'course_log_resources.php?'.api_get_cidreq(true, false));
  108. echo '</div>';
  109. echo Display::grid_html('group_users');
  110. Display::display_footer();