work_list_others.php 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  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('StudentPublications');
  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[] = array(
  43. 'url' => api_get_path(WEB_CODE_PATH).'group/group.php?'.api_get_cidreq(),
  44. 'name' => get_lang('Groups'),
  45. );
  46. $interbreadcrumb[] = array(
  47. 'url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.api_get_cidreq(),
  48. 'name' => get_lang('GroupSpace').' '.$group_properties['name'],
  49. );
  50. }
  51. $interbreadcrumb[] = array(
  52. 'url' => api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq(),
  53. 'name' => get_lang('StudentPublications'),
  54. );
  55. $interbreadcrumb[] = array(
  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('BackToWorksList'), '', ICON_SIZE_MEDIUM).'</a>';
  63. echo '</div>';
  64. if (!empty($my_folder_data['description'])) {
  65. echo '<p><div><strong>'.get_lang('Description').':</strong><p>'.Security::remove_XSS($my_folder_data['description']).'</p></div></p>';
  66. }
  67. $check_qualification = intval($my_folder_data['qualification']);
  68. if (!empty($work_data['enable_qualification']) && !empty($check_qualification)) {
  69. $type = 'simple';
  70. $columns = array(
  71. get_lang('Type'),
  72. get_lang('FirstName'),
  73. get_lang('LastName'),
  74. get_lang('Title'),
  75. get_lang('Qualification'),
  76. get_lang('Date'),
  77. get_lang('Status'),
  78. get_lang('Actions')
  79. );
  80. $column_model = array(
  81. array(
  82. 'name' => 'type',
  83. 'index' => 'file',
  84. 'width' => '12',
  85. 'align' => 'left',
  86. 'search' => 'false',
  87. 'sortable' => 'false',
  88. ),
  89. array('name' => 'firstname', 'index' => 'firstname', 'width' => '35', 'align' => 'left', 'search' => 'true'),
  90. array('name' => 'lastname', 'index' => 'lastname', 'width' => '35', 'align' => 'left', 'search' => 'true'),
  91. array(
  92. 'name' => 'title',
  93. 'index' => 'title',
  94. 'width' => '40',
  95. 'align' => 'left',
  96. 'search' => 'false',
  97. 'wrap_cell' => 'true',
  98. ),
  99. array(
  100. 'name' => 'qualification',
  101. 'index' => 'qualification',
  102. 'width' => '20',
  103. 'align' => 'left',
  104. 'search' => 'true',
  105. ),
  106. array(
  107. 'name' => 'sent_date',
  108. 'index' => 'sent_date',
  109. 'width' => '50',
  110. 'align' => 'left',
  111. 'search' => 'true',
  112. 'wrap_cell' => 'true',
  113. ),
  114. array(
  115. 'name' => 'qualificator_id',
  116. 'index' => 'qualificator_id',
  117. 'width' => '30',
  118. 'align' => 'left',
  119. 'search' => 'true',
  120. ),
  121. array(
  122. 'name' => 'actions',
  123. 'index' => 'actions',
  124. 'width' => '40',
  125. 'align' => 'left',
  126. 'search' => 'false',
  127. 'sortable' => 'false',
  128. ),
  129. );
  130. } else {
  131. $type = 'complex';
  132. $columns = array(
  133. get_lang('Type'),
  134. get_lang('FirstName'),
  135. get_lang('LastName'),
  136. get_lang('Title'),
  137. get_lang('Date'),
  138. get_lang('Actions'),
  139. );
  140. $column_model = array(
  141. array(
  142. 'name' => 'type',
  143. 'index' => 'file',
  144. 'width' => '12',
  145. 'align' => 'left',
  146. 'search' => 'false',
  147. 'sortable' => 'false',
  148. ),
  149. array('name' => 'firstname', 'index' => 'firstname', 'width' => '35', 'align' => 'left', 'search' => 'true'),
  150. array('name' => 'lastname', 'index' => 'lastname', 'width' => '35', 'align' => 'left', 'search' => 'true'),
  151. array(
  152. 'name' => 'title',
  153. 'index' => 'title',
  154. 'width' => '40',
  155. 'align' => 'left',
  156. 'search' => 'false',
  157. 'wrap_cell' => "true",
  158. ),
  159. array(
  160. 'name' => 'sent_date',
  161. 'index' => 'sent_date',
  162. 'width' => '50',
  163. 'align' => 'left',
  164. 'search' => 'true',
  165. 'wrap_cell' => 'true',
  166. ),
  167. array(
  168. 'name' => 'actions',
  169. 'index' => 'actions',
  170. 'width' => '40',
  171. 'align' => 'left',
  172. 'search' => 'false',
  173. 'sortable' => 'false',
  174. ),
  175. );
  176. }
  177. $extra_params = array();
  178. $extra_params['autowidth'] = 'true';
  179. $extra_params['height'] = 'auto';
  180. $extra_params['sortname'] = 'firstname';
  181. $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_work_user_list_others&work_id='.$workId.'&type='.$type.'&'.api_get_cidreq();
  182. ?>
  183. <script>
  184. $(function() {
  185. <?php
  186. echo Display::grid_js('results', $url, $columns, $column_model, $extra_params);
  187. ?>
  188. });
  189. </script>
  190. <?php
  191. echo Display::grid_html('results');
  192. Display :: display_footer();