work_list_others.php 5.2 KB

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