work_list_others.php 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. require_once '../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_id,
  36. GroupManager::GROUP_TOOL_WORK
  37. );
  38. }
  39. if (!$show_work) {
  40. api_not_allowed();
  41. }
  42. $interbreadcrumb[] = array ('url' => api_get_path(WEB_CODE_PATH).'group/group.php', 'name' => get_lang('Groups'));
  43. $interbreadcrumb[] = array ('url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?gidReq='.$group_id, 'name' => get_lang('GroupSpace').' '.$group_properties['name']);
  44. }
  45. $interbreadcrumb[] = array ('url' => api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq(), 'name' => get_lang('StudentPublications'));
  46. $interbreadcrumb[] = array ('url' => api_get_path(WEB_CODE_PATH).'work/work_list_others.php?'.api_get_cidreq().'&id='.$workId, 'name' => $my_folder_data['title']);
  47. Display :: display_header(null);
  48. echo '<div class="actions">';
  49. echo '<a href="'.api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq().'>'.
  50. Display::return_icon('back.png', get_lang('BackToWorksList'),'',ICON_SIZE_MEDIUM).'</a>';
  51. echo '</div>';
  52. if (!empty($my_folder_data['description'])) {
  53. echo '<p><div><strong>'.get_lang('Description').':</strong><p>'.Security::remove_XSS($my_folder_data['description']).'</p></div></p>';
  54. }
  55. $check_qualification = intval($my_folder_data['qualification']);
  56. if (!empty($work_data['enable_qualification']) && !empty($check_qualification)) {
  57. $type = 'simple';
  58. $columns = array(
  59. get_lang('Type'),
  60. get_lang('FirstName'),
  61. get_lang('LastName'),
  62. get_lang('Title'),
  63. get_lang('Qualification'),
  64. get_lang('Date'),
  65. get_lang('Status'),
  66. get_lang('Actions')
  67. );
  68. $column_model = array(
  69. array('name'=>'type', 'index'=>'file', 'width'=>'12', 'align'=>'left', 'search' => 'false', 'sortable' => 'false'),
  70. array('name'=>'firstname', 'index'=>'firstname', 'width'=>'35', 'align'=>'left', 'search' => 'true'),
  71. array('name'=>'lastname', 'index'=>'lastname', 'width'=>'35', 'align'=>'left', 'search' => 'true'),
  72. array('name'=>'title', 'index'=>'title', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'wrap_cell' => 'true'),
  73. array('name'=>'qualification', 'index'=>'qualification', 'width'=>'20', 'align'=>'left', 'search' => 'true'),
  74. array('name'=>'sent_date', 'index'=>'sent_date', 'width'=>'50', 'align'=>'left', 'search' => 'true', 'wrap_cell' => 'true'),
  75. array('name'=>'qualificator_id','index'=>'qualificator_id', 'width'=>'30', 'align'=>'left', 'search' => 'true'),
  76. array('name'=>'actions', 'index'=>'actions', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'sortable'=>'false')
  77. );
  78. } else {
  79. $type = 'complex';
  80. $columns = array(
  81. get_lang('Type'), get_lang('FirstName'), get_lang('LastName'), get_lang('Title'), get_lang('Date'), get_lang('Actions')
  82. );
  83. $column_model = array(
  84. array('name'=>'type', 'index'=>'file', 'width'=>'12', 'align'=>'left', 'search' => 'false', 'sortable' => 'false'),
  85. array('name'=>'firstname', 'index'=>'firstname', 'width'=>'35', 'align'=>'left', 'search' => 'true'),
  86. array('name'=>'lastname', 'index'=>'lastname', 'width'=>'35', 'align'=>'left', 'search' => 'true'),
  87. array('name'=>'title', 'index'=>'title', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'wrap_cell' => "true"),
  88. array('name'=>'sent_date', 'index'=>'sent_date', 'width'=>'50', 'align'=>'left', 'search' => 'true', 'wrap_cell' => 'true'),
  89. array('name'=>'actions', 'index'=>'actions', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'sortable'=>'false')
  90. );
  91. }
  92. $extra_params = array();
  93. $extra_params['autowidth'] = 'true';
  94. $extra_params['height'] = 'auto';
  95. $extra_params['sortname'] = 'firstname';
  96. $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_work_user_list_others&work_id='.$workId.'&type='.$type;
  97. ?>
  98. <script>
  99. $(function() {
  100. <?php
  101. echo Display::grid_js('results', $url, $columns, $column_model, $extra_params);
  102. ?>
  103. });
  104. </script>
  105. <?php
  106. echo Display::grid_html('results');
  107. Display :: display_footer();