course_log_groups.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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. $course_id = api_get_course_int_id();
  7. $course_code = api_get_course_id();
  8. $sessionId = api_get_session_id();
  9. $this_section = SECTION_COURSES;
  10. if ($from == 'myspace') {
  11. $from_myspace = true;
  12. $this_section = "session_my_space";
  13. }
  14. // Access restrictions.
  15. $is_allowedToTrack = Tracking::isAllowToTrack($sessionId);
  16. if (!$is_allowedToTrack) {
  17. api_not_allowed(true);
  18. exit;
  19. }
  20. // jqgrid will use this URL to do the selects
  21. $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_group_reporting&course_id='.$course_id.'&session_id='.$sessionId;
  22. // The order is important you need to check the the $column variable in the model.ajax.php file
  23. $columns = [
  24. get_lang('Name'),
  25. get_lang('Time'),
  26. get_lang('Progress'),
  27. get_lang('Score'),
  28. get_lang('Works'),
  29. get_lang('Messages'),
  30. get_lang('Actions'),
  31. ];
  32. // Column config
  33. $column_model = [
  34. [
  35. 'name' => 'name',
  36. 'index' => 'name',
  37. 'width' => '200',
  38. 'align' => 'left',
  39. ],
  40. [
  41. 'name' => 'time',
  42. 'index' => 'time',
  43. 'width' => '50',
  44. 'align' => 'left',
  45. 'sortable' => 'false',
  46. ],
  47. [
  48. 'name' => 'progress',
  49. 'index' => 'progress',
  50. 'width' => '50',
  51. 'align' => 'left',
  52. 'sortable' => 'false',
  53. ],
  54. [
  55. 'name' => 'score',
  56. 'index' => 'score',
  57. 'width' => '50',
  58. 'align' => 'left',
  59. 'sortable' => 'false',
  60. ],
  61. [
  62. 'name' => 'works',
  63. 'index' => 'works',
  64. 'width' => '50',
  65. 'align' => 'left',
  66. 'sortable' => 'false',
  67. ],
  68. [
  69. 'name' => 'messages',
  70. 'index' => 'messages',
  71. 'width' => '50',
  72. 'align' => 'left',
  73. 'sortable' => 'false',
  74. ],
  75. [
  76. 'name' => 'actions',
  77. 'index' => 'actions',
  78. 'width' => '50',
  79. 'align' => 'left',
  80. 'formatter' => 'action_formatter',
  81. 'sortable' => 'false',
  82. ],
  83. ];
  84. // Autowidth
  85. $extra_params['autowidth'] = 'true';
  86. // height auto
  87. $extra_params['height'] = 'auto';
  88. $action_links = '
  89. function action_formatter(cellvalue, options, rowObject) {
  90. 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>'.
  91. '\';
  92. }';
  93. // Add the JS needed to use the jqgrid
  94. $htmlHeadXtra[] = api_get_jqgrid_js();
  95. $htmlHeadXtra[] = '
  96. <script>
  97. $(function() {
  98. '.Display::grid_js(
  99. 'group_users',
  100. $url,
  101. $columns,
  102. $column_model,
  103. $extra_params,
  104. [],
  105. $action_links,
  106. true
  107. ).'
  108. });
  109. </script>';
  110. Display::display_header();
  111. echo '<div class="actions">';
  112. echo TrackingCourseLog::actionsLeft('groups', $sessionId);
  113. echo '</div>';
  114. echo Display::grid_html('group_users');
  115. Display::display_footer();