work_list_others.php 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. require_once __DIR__.'/../inc/global.inc.php';
  4. $current_course_tool = TOOL_STUDENTPUBLICATION;
  5. api_protect_course_script(true);
  6. require_once 'work.lib.php';
  7. $this_section = SECTION_COURSES;
  8. $workId = isset($_GET['id']) ? intval($_GET['id']) : null;
  9. if (empty($workId)) {
  10. api_not_allowed(true);
  11. }
  12. $my_folder_data = get_work_data_by_id($workId);
  13. if (empty($my_folder_data)) {
  14. api_not_allowed(true);
  15. }
  16. $work_data = get_work_assignment_by_id($workId);
  17. $tool_name = get_lang('Assignments');
  18. $group_id = api_get_group_id();
  19. $courseInfo = api_get_course_info();
  20. // not all users
  21. if ($courseInfo['show_score'] == 1) {
  22. api_not_allowed(true);
  23. }
  24. protectWork($courseInfo, $workId);
  25. $htmlHeadXtra[] = api_get_jqgrid_js();
  26. if (!empty($group_id)) {
  27. $group_properties = GroupManager::get_group_properties($group_id);
  28. $show_work = false;
  29. if (api_is_allowed_to_edit(false, true)) {
  30. $show_work = true;
  31. } else {
  32. // you are not a teacher
  33. $show_work = GroupManager::user_has_access(
  34. $user_id,
  35. $group_properties['iid'],
  36. GroupManager::GROUP_TOOL_WORK
  37. );
  38. }
  39. if (!$show_work) {
  40. api_not_allowed();
  41. }
  42. $interbreadcrumb[] = [
  43. 'url' => api_get_path(WEB_CODE_PATH).'group/group.php?'.api_get_cidreq(),
  44. 'name' => get_lang('Groups'),
  45. ];
  46. $interbreadcrumb[] = [
  47. 'url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.api_get_cidreq(),
  48. 'name' => get_lang('Group area').' '.$group_properties['name'],
  49. ];
  50. }
  51. $interbreadcrumb[] = [
  52. 'url' => api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq(),
  53. 'name' => get_lang('Assignments'),
  54. ];
  55. $interbreadcrumb[] = [
  56. 'url' => api_get_path(WEB_CODE_PATH).'work/work_list_others.php?'.api_get_cidreq().'&id='.$workId,
  57. 'name' => $my_folder_data['title'],
  58. ];
  59. Display :: display_header(null);
  60. echo '<div class="actions">';
  61. echo '<a href="'.api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq().'>'.
  62. Display::return_icon('back.png', get_lang('Back to Assignments list'), '', ICON_SIZE_MEDIUM).'</a>';
  63. echo '</div>';
  64. if (!empty($my_folder_data['description'])) {
  65. echo '<p><div><strong>'.get_lang('Description').':</strong><p>'.
  66. Security::remove_XSS($my_folder_data['description']).'</p></div></p>';
  67. }
  68. $check_qualification = intval($my_folder_data['qualification']);
  69. if (!empty($work_data['enable_qualification']) && !empty($check_qualification)) {
  70. $type = 'simple';
  71. $columns = [
  72. get_lang('Type'),
  73. get_lang('First name'),
  74. get_lang('Last name'),
  75. get_lang('Title'),
  76. get_lang('Score'),
  77. get_lang('Date'),
  78. get_lang('Status'),
  79. get_lang('Detail'),
  80. ];
  81. $column_model = [
  82. [
  83. 'name' => 'type',
  84. 'index' => 'file',
  85. 'width' => '12',
  86. 'align' => 'left',
  87. 'search' => 'false',
  88. 'sortable' => 'false',
  89. ],
  90. ['name' => 'firstname', 'index' => 'firstname', 'width' => '35', 'align' => 'left', 'search' => 'true'],
  91. ['name' => 'lastname', 'index' => 'lastname', 'width' => '35', 'align' => 'left', 'search' => 'true'],
  92. [
  93. 'name' => 'title',
  94. 'index' => 'title',
  95. 'width' => '40',
  96. 'align' => 'left',
  97. 'search' => 'false',
  98. 'wrap_cell' => 'true',
  99. ],
  100. [
  101. 'name' => 'qualification',
  102. 'index' => 'qualification',
  103. 'width' => '20',
  104. 'align' => 'left',
  105. 'search' => 'true',
  106. ],
  107. [
  108. 'name' => 'sent_date',
  109. 'index' => 'sent_date',
  110. 'width' => '50',
  111. 'align' => 'left',
  112. 'search' => 'true',
  113. 'wrap_cell' => 'true',
  114. ],
  115. [
  116. 'name' => 'qualificator_id',
  117. 'index' => 'qualificator_id',
  118. 'width' => '30',
  119. 'align' => 'left',
  120. 'search' => 'true',
  121. ],
  122. [
  123. 'name' => 'actions',
  124. 'index' => 'actions',
  125. 'width' => '40',
  126. 'align' => 'left',
  127. 'search' => 'false',
  128. 'sortable' => 'false',
  129. ],
  130. ];
  131. } else {
  132. $type = 'complex';
  133. $columns = [
  134. get_lang('Type'),
  135. get_lang('First name'),
  136. get_lang('Last name'),
  137. get_lang('Title'),
  138. get_lang('Date'),
  139. get_lang('Detail'),
  140. ];
  141. $column_model = [
  142. [
  143. 'name' => 'type',
  144. 'index' => 'file',
  145. 'width' => '12',
  146. 'align' => 'left',
  147. 'search' => 'false',
  148. 'sortable' => 'false',
  149. ],
  150. ['name' => 'firstname', 'index' => 'firstname', 'width' => '35', 'align' => 'left', 'search' => 'true'],
  151. ['name' => 'lastname', 'index' => 'lastname', 'width' => '35', 'align' => 'left', 'search' => 'true'],
  152. [
  153. 'name' => 'title',
  154. 'index' => 'title',
  155. 'width' => '40',
  156. 'align' => 'left',
  157. 'search' => 'false',
  158. 'wrap_cell' => "true",
  159. ],
  160. [
  161. 'name' => 'sent_date',
  162. 'index' => 'sent_date',
  163. 'width' => '50',
  164. 'align' => 'left',
  165. 'search' => 'true',
  166. 'wrap_cell' => 'true',
  167. ],
  168. [
  169. 'name' => 'actions',
  170. 'index' => 'actions',
  171. 'width' => '40',
  172. 'align' => 'left',
  173. 'search' => 'false',
  174. 'sortable' => 'false',
  175. ],
  176. ];
  177. }
  178. $extra_params = [];
  179. $extra_params['autowidth'] = 'true';
  180. $extra_params['height'] = 'auto';
  181. $extra_params['sortname'] = 'firstname';
  182. $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_work_user_list_others&work_id='.$workId.'&type='.$type.'&'.api_get_cidreq();
  183. ?>
  184. <script>
  185. $(function() {
  186. <?php
  187. echo Display::grid_js('results', $url, $columns, $column_model, $extra_params);
  188. ?>
  189. });
  190. </script>
  191. <?php
  192. echo Display::grid_html('results');
  193. Display :: display_footer();