course_log_groups.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. require_once '../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. // 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;
  22. // The order is important you need to check the the $column variable in the model.ajax.php file
  23. $columns = array(
  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 = array(
  34. array(
  35. 'name' => 'name',
  36. 'index' => 'name',
  37. 'width' => '200',
  38. 'align' => 'left',
  39. ),
  40. array(
  41. 'name' => 'time',
  42. 'index' => 'time',
  43. 'width' => '50',
  44. 'align' => 'left',
  45. 'sortable' => 'false',
  46. ),
  47. array(
  48. 'name' => 'progress',
  49. 'index' => 'progress',
  50. 'width' => '50',
  51. 'align' => 'left',
  52. 'sortable' => 'false',
  53. ),
  54. array(
  55. 'name' => 'score',
  56. 'index' => 'score',
  57. 'width' => '50',
  58. 'align' => 'left',
  59. 'sortable' => 'false',
  60. ),
  61. array(
  62. 'name' => 'works',
  63. 'index' => 'works',
  64. 'width' => '50',
  65. 'align' => 'left',
  66. 'sortable' => 'false',
  67. ),
  68. array(
  69. 'name' => 'messages',
  70. 'index' => 'messages',
  71. 'width' => '50',
  72. 'align' => 'left',
  73. 'sortable' => 'false',
  74. ),
  75. array(
  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.gif',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('group_users',$url, $columns, $column_model, $extra_params, array(), $action_links, true).'
  99. });
  100. </script>';
  101. Display::display_header();
  102. echo '<div class="actions">';
  103. echo Display::url(Display::return_icon('user.png', get_lang('StudentsTracking'), array(), ICON_SIZE_MEDIUM), 'courseLog.php?'.api_get_cidreq(true, false));
  104. echo Display::url(Display::return_icon('group_na.png', get_lang('GroupReporting'), array(), ICON_SIZE_MEDIUM), '#');
  105. echo Display::url(Display::return_icon('course.png', get_lang('CourseTracking'), array(), ICON_SIZE_MEDIUM), 'course_log_tools.php?'.api_get_cidreq(true, false));
  106. echo Display::url(Display::return_icon('tools.png', get_lang('ResourcesTracking'), array(), ICON_SIZE_MEDIUM), 'course_log_resources.php?'.api_get_cidreq(true, false));
  107. echo '</div>';
  108. echo Display::grid_html('group_users');
  109. Display::display_footer();