work_list_others.php 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. $language_file = array('exercice', 'work', 'document', 'admin', 'gradebook');
  4. require_once '../inc/global.inc.php';
  5. $current_course_tool = TOOL_STUDENTPUBLICATION;
  6. api_protect_course_script(true);
  7. require_once 'work.lib.php';
  8. $this_section = SECTION_COURSES;
  9. $workId = isset($_GET['id']) ? intval($_GET['id']) : null;
  10. if (empty($workId)) {
  11. api_not_allowed(true);
  12. }
  13. $my_folder_data = get_work_data_by_id($workId);
  14. if (empty($my_folder_data)) {
  15. api_not_allowed(true);
  16. }
  17. $work_data = get_work_assignment_by_id($workId);
  18. $tool_name = get_lang('StudentPublications');
  19. $group_id = api_get_group_id();
  20. $courseInfo = api_get_course_info();
  21. // not all users
  22. if ($courseInfo['show_score'] == 1) {
  23. api_not_allowed(true);
  24. }
  25. allowOnlySubscribedUser(api_get_user_id(), $workId, $courseInfo['real_id']);
  26. $htmlHeadXtra[] = api_get_jqgrid_js();
  27. if (!empty($group_id)) {
  28. $group_properties = GroupManager :: get_group_properties($group_id);
  29. $show_work = false;
  30. if (api_is_allowed_to_edit(false, true)) {
  31. $show_work = true;
  32. } else {
  33. // you are not a teacher
  34. $show_work = GroupManager::user_has_access(
  35. $user_id,
  36. $group_id,
  37. GroupManager::GROUP_TOOL_WORK
  38. );
  39. }
  40. if (!$show_work) {
  41. api_not_allowed();
  42. }
  43. $interbreadcrumb[] = array ('url' => api_get_path(WEB_CODE_PATH).'group/group.php', 'name' => get_lang('Groups'));
  44. $interbreadcrumb[] = array ('url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?gidReq='.$group_id, 'name' => get_lang('GroupSpace').' '.$group_properties['name']);
  45. }
  46. $interbreadcrumb[] = array ('url' => api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq(), 'name' => get_lang('StudentPublications'));
  47. $interbreadcrumb[] = array ('url' => api_get_path(WEB_CODE_PATH).'work/work_list_others.php?'.api_get_cidreq().'&id='.$workId, 'name' => $my_folder_data['title']);
  48. Display :: display_header(null);
  49. echo '<div class="actions">';
  50. echo '<a href="'.api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq().'>'.
  51. Display::return_icon('back.png', get_lang('BackToWorksList'),'',ICON_SIZE_MEDIUM).'</a>';
  52. echo '</div>';
  53. if (!empty($my_folder_data['description'])) {
  54. echo '<p><div><strong>'.get_lang('Description').':</strong><p>'.Security::remove_XSS($my_folder_data['description']).'</p></div></p>';
  55. }
  56. $check_qualification = intval($my_folder_data['qualification']);
  57. if (!empty($work_data['enable_qualification']) && !empty($check_qualification)) {
  58. $type = 'simple';
  59. $columns = array(
  60. get_lang('Type'),
  61. get_lang('FirstName'),
  62. get_lang('LastName'),
  63. get_lang('Title'),
  64. get_lang('Qualification'),
  65. get_lang('Date'),
  66. get_lang('Status'),
  67. get_lang('Actions')
  68. );
  69. $column_model = array(
  70. array('name'=>'type', 'index'=>'file', 'width'=>'12', 'align'=>'left', 'search' => 'false', 'sortable' => 'false'),
  71. array('name'=>'firstname', 'index'=>'firstname', 'width'=>'35', 'align'=>'left', 'search' => 'true'),
  72. array('name'=>'lastname', 'index'=>'lastname', 'width'=>'35', 'align'=>'left', 'search' => 'true'),
  73. array('name'=>'title', 'index'=>'title', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'wrap_cell' => 'true'),
  74. array('name'=>'qualification', 'index'=>'qualification', 'width'=>'20', 'align'=>'left', 'search' => 'true'),
  75. array('name'=>'sent_date', 'index'=>'sent_date', 'width'=>'50', 'align'=>'left', 'search' => 'true', 'wrap_cell' => 'true'),
  76. array('name'=>'qualificator_id','index'=>'qualificator_id', 'width'=>'30', 'align'=>'left', 'search' => 'true'),
  77. array('name'=>'actions', 'index'=>'actions', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'sortable'=>'false')
  78. );
  79. } else {
  80. $type = 'complex';
  81. $columns = array(
  82. get_lang('Type'), get_lang('FirstName'), get_lang('LastName'), get_lang('Title'), get_lang('Date'), get_lang('Actions')
  83. );
  84. $column_model = array(
  85. array('name'=>'type', 'index'=>'file', 'width'=>'12', 'align'=>'left', 'search' => 'false', 'sortable' => 'false'),
  86. array('name'=>'firstname', 'index'=>'firstname', 'width'=>'35', 'align'=>'left', 'search' => 'true'),
  87. array('name'=>'lastname', 'index'=>'lastname', 'width'=>'35', 'align'=>'left', 'search' => 'true'),
  88. array('name'=>'title', 'index'=>'title', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'wrap_cell' => "true"),
  89. array('name'=>'sent_date', 'index'=>'sent_date', 'width'=>'50', 'align'=>'left', 'search' => 'true', 'wrap_cell' => 'true'),
  90. array('name'=>'actions', 'index'=>'actions', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'sortable'=>'false')
  91. );
  92. }
  93. $extra_params = array();
  94. $extra_params['autowidth'] = 'true';
  95. $extra_params['height'] = 'auto';
  96. $extra_params['sortname'] = 'firstname';
  97. $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_work_user_list_others&work_id='.$workId.'&type='.$type;
  98. ?>
  99. <script>
  100. $(function() {
  101. <?php
  102. echo Display::grid_js('results', $url, $columns, $column_model, $extra_params);
  103. ?>
  104. });
  105. </script>
  106. <?php
  107. echo Display::grid_html('results');
  108. Display :: display_footer();