work_list_others.php 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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('url' => api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq(), 'name' => get_lang('StudentPublications'));
  52. $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'work/work_list_others.php?'.api_get_cidreq().'&id='.$workId, 'name' => $my_folder_data['title']);
  53. Display :: display_header(null);
  54. echo '<div class="actions">';
  55. echo '<a href="'.api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq().'>'.
  56. Display::return_icon('back.png', get_lang('BackToWorksList'),'',ICON_SIZE_MEDIUM).'</a>';
  57. echo '</div>';
  58. if (!empty($my_folder_data['description'])) {
  59. echo '<p><div><strong>'.get_lang('Description').':</strong><p>'.Security::remove_XSS($my_folder_data['description']).'</p></div></p>';
  60. }
  61. $check_qualification = intval($my_folder_data['qualification']);
  62. if (!empty($work_data['enable_qualification']) && !empty($check_qualification)) {
  63. $type = 'simple';
  64. $columns = array(
  65. get_lang('Type'),
  66. get_lang('FirstName'),
  67. get_lang('LastName'),
  68. get_lang('Title'),
  69. get_lang('Qualification'),
  70. get_lang('Date'),
  71. get_lang('Status'),
  72. get_lang('Actions')
  73. );
  74. $column_model = array(
  75. array('name'=>'type', 'index'=>'file', 'width'=>'12', 'align'=>'left', 'search' => 'false', 'sortable' => 'false'),
  76. array('name'=>'firstname', 'index'=>'firstname', 'width'=>'35', 'align'=>'left', 'search' => 'true'),
  77. array('name'=>'lastname', 'index'=>'lastname', 'width'=>'35', 'align'=>'left', 'search' => 'true'),
  78. array('name'=>'title', 'index'=>'title', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'wrap_cell' => 'true'),
  79. array('name'=>'qualification', 'index'=>'qualification', 'width'=>'20', 'align'=>'left', 'search' => 'true'),
  80. array('name'=>'sent_date', 'index'=>'sent_date', 'width'=>'50', 'align'=>'left', 'search' => 'true', 'wrap_cell' => 'true'),
  81. array('name'=>'qualificator_id','index'=>'qualificator_id', 'width'=>'30', 'align'=>'left', 'search' => 'true'),
  82. array('name'=>'actions', 'index'=>'actions', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'sortable'=>'false')
  83. );
  84. } else {
  85. $type = 'complex';
  86. $columns = array(
  87. get_lang('Type'), get_lang('FirstName'), get_lang('LastName'), get_lang('Title'), get_lang('Date'), get_lang('Actions')
  88. );
  89. $column_model = array(
  90. array('name'=>'type', 'index'=>'file', 'width'=>'12', 'align'=>'left', 'search' => 'false', 'sortable' => 'false'),
  91. array('name'=>'firstname', 'index'=>'firstname', 'width'=>'35', 'align'=>'left', 'search' => 'true'),
  92. array('name'=>'lastname', 'index'=>'lastname', 'width'=>'35', 'align'=>'left', 'search' => 'true'),
  93. array('name'=>'title', 'index'=>'title', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'wrap_cell' => "true"),
  94. array('name'=>'sent_date', 'index'=>'sent_date', 'width'=>'50', 'align'=>'left', 'search' => 'true', 'wrap_cell' => 'true'),
  95. array('name'=>'actions', 'index'=>'actions', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'sortable'=>'false')
  96. );
  97. }
  98. $extra_params = array();
  99. $extra_params['autowidth'] = 'true';
  100. $extra_params['height'] = 'auto';
  101. $extra_params['sortname'] = 'firstname';
  102. $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_work_user_list_others&work_id='.$workId.'&type='.$type.'&'.api_get_cidreq();
  103. ?>
  104. <script>
  105. $(function() {
  106. <?php
  107. echo Display::grid_js('results', $url, $columns, $column_model, $extra_params);
  108. ?>
  109. });
  110. </script>
  111. <?php
  112. echo Display::grid_html('results');
  113. Display :: display_footer();