$_POST['file'] = $_FILES["file"]; } addWorkComment(api_get_course_info(), api_get_user_id(), $my_folder_data, $work, $_POST); Display::addFlash(Display::return_message(get_lang('CommentCreated'))); header('Location: ' . $url); exit; break; case 'delete_attachment': deleteCommentFile($_REQUEST['comment_id'], api_get_course_info()); Display::addFlash(Display::return_message(get_lang('DocDeleted'))); header('Location: ' . $url); exit; break; } $comments = getWorkComments($work); $commentForm = getWorkCommentForm($work); $tpl = new Template(); $tpl->assign('work', $work); $tpl->assign('comments', $comments); $actions = ''; if (isset($work['contains_file'])) { if (isset($work['download_url'])) { $actions .= Display::url(Display::return_icon('save.png', get_lang('Download'), null, ICON_SIZE_MEDIUM), $work['download_url']); if (isset($work['url_correction'])) { $actions .= Display::url(Display::return_icon('check.png', get_lang('Correction'), null, ICON_SIZE_MEDIUM), $work['download_url'] . '&correction=1'); } } } $tpl->assign('actions', $actions); if (api_is_allowed_to_session_edit()) { $tpl->assign('form', $commentForm);
$script = 'work_list_all.php'; } header('Location: ' . api_get_path(WEB_CODE_PATH) . 'work/' . $script . '?' . api_get_cidreq() . '&id=' . $work_id); exit; } $htmlHeadXtra[] = to_javascript_work(); $tpl = \Chamilo\CoreBundle\Framework\Container::getTwig(); $content = null; if (!empty($work_id)) { if ($is_allowed_to_edit) { if (api_resource_is_locked_by_gradebook($work_id, LINK_STUDENTPUBLICATION)) { echo Display::display_warning_message(get_lang('ResourceLockedByGradebook')); } else { $comments = getWorkComments($work_item); $tpl->addGlobal('comments', $comments); $commentForm = getWorkCommentForm($work_item, 'edit'); $tpl->addGlobal('form', ''); if (api_is_allowed_to_session_edit()) { $tpl->addGlobal('form', $commentForm); } $commentContent = $tpl->render('@template_style/work/comments.html.twig'); $content .= $form->returnForm(); $content .= $commentContent; } } elseif ($is_author) { if (empty($work_item['qualificator_id']) || $work_item['qualificator_id'] == 0) { $content .= $form->returnForm(); } else { $content .= Display::return_message(get_lang('ActionNotAllowed'), 'error'); } } elseif ($student_can_edit_in_session && $has_ended == false) {