work_list_all.php 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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. // Including necessary files
  9. require_once 'work.lib.php';
  10. $this_section = SECTION_COURSES;
  11. $workId = isset($_GET['id']) ? intval($_GET['id']) : null;
  12. if (empty($workId)) {
  13. api_not_allowed(true);
  14. }
  15. $my_folder_data = get_work_data_by_id($workId);
  16. if (empty($my_folder_data)) {
  17. api_not_allowed(true);
  18. }
  19. $work_data = get_work_assignment_by_id($workId);
  20. if (!api_is_allowed_to_edit()) {
  21. api_not_allowed(true);
  22. }
  23. $tool_name = get_lang('StudentPublications');
  24. $group_id = api_get_group_id();
  25. $courseInfo = api_get_course_info();
  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($user_id, $group_id, GroupManager::GROUP_TOOL_WORK);
  35. }
  36. if (!$show_work) {
  37. api_not_allowed();
  38. }
  39. $interbreadcrumb[] = array ('url' => '../group/group.php', 'name' => get_lang('Groups'));
  40. $interbreadcrumb[] = array ('url' => '../group/group_space.php?gidReq='.$group_id, 'name' => get_lang('GroupSpace').' '.$group_properties['name']);
  41. }
  42. $interbreadcrumb[] = array ('url' => api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq(), 'name' => get_lang('StudentPublications'));
  43. $interbreadcrumb[] = array ('url' => api_get_path(WEB_CODE_PATH).'work/work_list_all.php?'.api_get_cidreq().'&id='.$workId, 'name' => $my_folder_data['title']);
  44. $error_message = null;
  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.'">'.Display::return_icon('back.png', get_lang('BackToWorksList'),'',ICON_SIZE_MEDIUM).'</a>';
  48. if (api_is_allowed_to_session_edit(false, true) && !empty($workId)) {
  49. echo '<a href="'.api_get_path(WEB_CODE_PATH).'work/upload.php?'.api_get_cidreq().'&id='.$workId.'&origin='.$origin.'&gradebook='.$gradebook.'">';
  50. echo Display::return_icon('upload_file.png', get_lang('UploadADocument'), '', ICON_SIZE_MEDIUM).'</a>';
  51. if (ADD_DOCUMENT_TO_WORK) {
  52. echo '<a href="'.api_get_path(WEB_CODE_PATH).'work/add_document.php?'.api_get_cidreq().'&id='.$workId.'">';
  53. echo Display::return_icon('new_document.png', get_lang('AddDocument'), '', ICON_SIZE_MEDIUM).'</a>';
  54. echo '<a href="'.api_get_path(WEB_CODE_PATH).'work/add_user.php?'.api_get_cidreq().'&id='.$workId.'">';
  55. echo Display::return_icon('user.png', get_lang('AddUsers'), '', ICON_SIZE_MEDIUM).'</a>';
  56. }
  57. $display_output .= '<a href="'.api_get_path(WEB_CODE_PATH).'work/work_missing.php?'.api_get_cidreq().'&amp;id='.$workId.'&amp;curdirpath='.$cur_dir_path.'&amp;origin='.$origin.'&amp;gradebook='.$gradebook.'&amp;list=without">'.
  58. Display::return_icon('exercice_uncheck.png', get_lang('ViewUsersWithoutTask'), '', ICON_SIZE_MEDIUM)."</a>";
  59. $count = get_count_work($workId);
  60. if ($count > 0) {
  61. $display_output .= '<a href="downloadfolder.inc.php?id='.$workId.'">'.Display::return_icon('save_pack.png', get_lang('Save'), array('style' => 'float:right;'), ICON_SIZE_MEDIUM).'</a>';
  62. }
  63. echo $display_output;
  64. }
  65. echo '</div>';
  66. if (empty($error_message)) {
  67. $error_message = isset($_GET['error_message']) ? Security::remove_XSS($_GET['error_message']) : null;
  68. }
  69. if (!empty($error_message)) {
  70. echo $error_message;
  71. }
  72. if (!empty($my_folder_data['description'])) {
  73. echo '<p><div><strong>'.get_lang('Description').':</strong><p>'.Security::remove_XSS($my_folder_data['description']).'</p></div></p>';
  74. }
  75. $check_qualification = intval($my_folder_data['qualification']);
  76. if (!empty($work_data['enable_qualification']) && !empty($check_qualification)) {
  77. $type = 'simple';
  78. //$columns = array(get_lang('Type'), get_lang('FirstName'), get_lang('LastName'), get_lang('LoginName'), get_lang('Title'), get_lang('Qualification'), get_lang('Date'), get_lang('Status'), get_lang('Actions'));
  79. $columns = array(get_lang('Type'), get_lang('FirstName'), get_lang('LastName'), get_lang('Title'), get_lang('Qualification'), get_lang('Date'), get_lang('Status'), get_lang('Actions'));
  80. $column_model = array (
  81. array('name'=>'type', 'index'=>'file', 'width'=>'10', 'align'=>'left', 'search' => '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'=>'username', 'index'=>'username', 'width'=>'30', 'align'=>'left', 'search' => 'true'),
  85. array('name'=>'title', 'index'=>'title', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'wrap_cell' => 'true'),
  86. // array('name'=>'file', 'index'=>'file', 'width'=>'20', 'align'=>'left', 'search' => 'false'),
  87. array('name'=>'qualification', 'index'=>'qualification', 'width'=>'20', 'align'=>'left', 'search' => 'true'),
  88. array('name'=>'sent_date', 'index'=>'sent_date', 'width'=>'40', 'align'=>'left', 'search' => 'true', 'wrap_cell' => 'true'),
  89. array('name'=>'qualificator_id','index'=>'qualificator_id', 'width'=>'30', 'align'=>'left', 'search' => 'true'),
  90. array('name'=>'actions', 'index'=>'actions', 'width'=>'50', 'align'=>'left', 'search' => 'false', 'sortable'=>'false', )
  91. );
  92. } else {
  93. $type = 'complex';
  94. //$columns = array(get_lang('Type'), get_lang('FirstName'), get_lang('LastName'), get_lang('LoginName'), get_lang('Title'), get_lang('Date'), get_lang('Actions'));
  95. $columns = array(get_lang('Type'), get_lang('FirstName'), get_lang('LastName'), get_lang('Title'), get_lang('Date'), get_lang('Actions'));
  96. $column_model = array (
  97. array('name'=>'type', 'index'=>'file', 'width'=>'10', 'align'=>'left', 'search' => 'false'),
  98. array('name'=>'firstname', 'index'=>'firstname', 'width'=>'35', 'align'=>'left', 'search' => 'true'),
  99. array('name'=>'lastname', 'index'=>'lastname', 'width'=>'35', 'align'=>'left', 'search' => 'true'),
  100. //array('name'=>'username', 'index'=>'username', 'width'=>'30', 'align'=>'left', 'search' => 'true'),
  101. array('name'=>'title', 'index'=>'title', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'wrap_cell' => "true"),
  102. // array('name'=>'file', 'index'=>'file', 'width'=>'20', 'align'=>'left', 'search' => 'false'),
  103. //array('name'=>'qualification', 'index'=>'qualification', 'width'=>'20', 'align'=>'left', 'search' => 'true'),
  104. array('name'=>'sent_date', 'index'=>'sent_date', 'width'=>'45', 'align'=>'left', 'search' => 'true', 'wrap_cell' => 'true'),
  105. //array('name'=>'qualificator_id','index'=>'qualificator_id', 'width'=>'30', 'align'=>'left', 'search' => 'true'),
  106. array('name'=>'actions', 'index'=>'actions', 'width'=>'50', 'align'=>'left', 'search' => 'false', 'sortable'=>'false', 'wrap_cell' => 'true')
  107. );
  108. }
  109. $extra_params = array();
  110. //Auto-width
  111. $extra_params['autowidth'] = 'true';
  112. //height auto
  113. $extra_params['height'] = 'auto';
  114. $extra_params['sortname'] = 'firstname';
  115. $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_work_user_list_all&work_id='.$workId.'&type='.$type;
  116. ?>
  117. <script>
  118. $(function() {
  119. <?php
  120. echo Display::grid_js('results', $url, $columns, $column_model, $extra_params);
  121. ?>
  122. });
  123. </script>
  124. <?php
  125. echo getAllDocumentsFromWorkToString($workId, $courseInfo);
  126. echo Display::grid_html('results');
  127. Display :: display_footer();