work_list_others.php 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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(
  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('name'=>'type', 'index'=>'file', 'width'=>'12', 'align'=>'left', 'search' => 'false', 'sortable' => 'false'),
  82. array('name'=>'firstname', 'index'=>'firstname', 'width'=>'35', 'align'=>'left', 'search' => 'true'),
  83. array('name'=>'lastname', 'index'=>'lastname', 'width'=>'35', 'align'=>'left', 'search' => 'true'),
  84. array('name'=>'title', 'index'=>'title', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'wrap_cell' => 'true'),
  85. array('name'=>'qualification', 'index'=>'qualification', 'width'=>'20', 'align'=>'left', 'search' => 'true'),
  86. array('name'=>'sent_date', 'index'=>'sent_date', 'width'=>'50', 'align'=>'left', 'search' => 'true', 'wrap_cell' => 'true'),
  87. array('name'=>'qualificator_id','index'=>'qualificator_id', 'width'=>'30', 'align'=>'left', 'search' => 'true'),
  88. array('name'=>'actions', 'index'=>'actions', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'sortable'=>'false')
  89. );
  90. } else {
  91. $type = 'complex';
  92. $columns = array(
  93. get_lang('Type'), get_lang('FirstName'), get_lang('LastName'), get_lang('Title'), get_lang('Date'), get_lang('Actions')
  94. );
  95. $column_model = array(
  96. array('name'=>'type', 'index'=>'file', 'width'=>'12', 'align'=>'left', 'search' => 'false', 'sortable' => 'false'),
  97. array('name'=>'firstname', 'index'=>'firstname', 'width'=>'35', 'align'=>'left', 'search' => 'true'),
  98. array('name'=>'lastname', 'index'=>'lastname', 'width'=>'35', 'align'=>'left', 'search' => 'true'),
  99. array('name'=>'title', 'index'=>'title', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'wrap_cell' => "true"),
  100. array('name'=>'sent_date', 'index'=>'sent_date', 'width'=>'50', 'align'=>'left', 'search' => 'true', 'wrap_cell' => 'true'),
  101. array('name'=>'actions', 'index'=>'actions', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'sortable'=>'false')
  102. );
  103. }
  104. $extra_params = array();
  105. $extra_params['autowidth'] = 'true';
  106. $extra_params['height'] = 'auto';
  107. $extra_params['sortname'] = 'firstname';
  108. $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_work_user_list_others&work_id='.$workId.'&type='.$type;
  109. ?>
  110. <script>
  111. $(function() {
  112. <?php
  113. echo Display::grid_js('results', $url, $columns, $column_model, $extra_params);
  114. ?>
  115. });
  116. </script>
  117. <?php
  118. echo Display::grid_html('results');
  119. Display :: display_footer();