44 $this->
toolbar = $DIC->toolbar();
45 $this->
help = $DIC[
"ilHelp"];
46 $this->
user = $DIC->user();
47 $this->
ui = $DIC->ui();
54 if (!$this->submission->canView()) {
58 $class = $ilCtrl->getNextClass($this);
59 $cmd = $ilCtrl->getCmd(
"submissionScreen");
62 case strtolower(ilRepoStandardUploadHandlerGUI::class):
64 $gui = $form->getRepoStandardUploadHandlerGUI(
"deliver");
69 $this->{$cmd .
"Object"}();
80 $lng = $DIC->language();
81 $ilCtrl = $DIC->ctrl();
82 $gui = $DIC->exercise()->internal()->gui();
85 foreach ($a_submission->
getFiles() as $file) {
86 $titles[] = htmlentities($file[
"filetitle"]);
88 $files_str = implode(
"<br>", $titles);
89 if ($files_str ==
"") {
90 $files_str =
$lng->
txt(
"message_no_delivered_files");
96 $title = (count($titles) == 0
98 :
$lng->
txt(
"exc_edit_submission"));
100 $button =
$gui->link(
102 $ilCtrl->getLinkTargetByClass(array(ilAssignmentPresentationGUI::class,
"ilExSubmissionGUI",
"ilExSubmissionFileGUI"),
"submissionScreen")
104 $files_str .=
"<br><br>" . $button->render();
106 if (count($titles) > 0) {
108 $lng->
txt(
"already_delivered_files"),
109 $ilCtrl->getLinkTargetByClass(array(ilAssignmentPresentationGUI::class,
"ilExSubmissionGUI",
"ilExSubmissionFileGUI"),
"submissionScreen")
111 $files_str .=
"<br><br>" . $link->render();
130 $ilHelp->setScreenIdComponent(
"exc");
131 $ilHelp->setScreenId(
"submissions");
133 if (!$this->submission->canSubmit()) {
134 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"exercise_time_over"));
136 $max_files = $this->submission->getAssignment()->getMaxFile();
138 if ($this->submission->canAddFile()) {
140 $deadline = $this->assignment->getPersonalDeadline($ilUser->getId());
142 time() > $deadline) {
144 $dl = sprintf($this->
lng->txt(
"exc_late_submission_warning"), $dl);
145 $dl =
'<span class="warning">' . $dl .
'</span>';
146 $ilToolbar->addText($dl);
149 $b = $this->
ui->factory()->button()->standard(
150 $this->
lng->txt(
"file_add"),
151 $this->
ctrl->getLinkTarget($this,
"uploadForm")
153 $ilToolbar->addStickyItem(
$b);
157 $ilToolbar->addButton(
158 $this->
lng->txt(
"header_zip"),
159 $this->
ctrl->getLinkTarget($this,
"uploadZipForm")
165 $this->tpl->setOnScreenMessage(
'info', sprintf($this->
lng->txt(
"exc_max_file_reached"), $max_files));
170 $this->tpl->setContent($tab->getHTML());
177 if (!$this->submission->canSubmit()) {
178 $this->
ctrl->redirect($this,
"submissionScreen");
181 $this->tabs_gui->clearTargets();
182 $this->tabs_gui->setBackTarget(
183 $this->
lng->txt(
"back"),
184 $this->
ctrl->getLinkTarget($this,
"submissionScreen")
189 $ilHelp->setScreenId(
"upload_submission");
194 $this->tpl->setContent($a_form->render());
197 $this->tpl->setContent($a_form->getHTML());
203 if (!$this->submission->canSubmit()) {
204 $this->
ctrl->redirect($this,
"submissionScreen");
207 $this->tabs_gui->clearTargets();
208 $this->tabs_gui->setBackTarget(
209 $this->
lng->txt(
"back"),
210 $this->
ctrl->getLinkTarget($this,
"submissionScreen")
216 $this->tpl->setContent($a_form->getHTML());
232 $fi->setRequired(
true);
235 $form->addCommandButton(
"uploadFile",
$lng->
txt(
"upload"));
236 $form->addCommandButton(
"submissionScreen",
$lng->
txt(
"cancel"));
238 $form->setTitle(
$lng->
txt(
"file_add"));
239 $form->setFormAction($ilCtrl->getFormAction($this,
"uploadFile"));
246 $max_file = $this->submission->getAssignment()->getMaxFile();
248 $max_file = $this->submission->getAssignment()->getMaxFile() - count($this->submission->getFiles());
253 $form_adapter = $this->gui
254 ->form(self::class,
'addUpload')
255 ->section(
"props", $this->
lng->txt(
'file_add'))
258 $this->
lng->txt(
"files"),
259 \Closure::fromCallable([$this,
'handleUploadResult']),
264 return $form_adapter;
268 \
ILIAS\FileUpload\FileUpload $upload,
269 \
ILIAS\FileUpload\DTO\UploadResult $result
270 ): \
ILIAS\FileUpload\Handler\BasicHandlerResult {
271 $title = $result->getName();
273 $this->submission->addFileUpload($result);
275 if ($result->isOK()) {
276 return new \ILIAS\FileUpload\Handler\BasicHandlerResult(
278 \
ILIAS\FileUpload\Handler\HandlerResult::STATUS_OK,
283 return new \ILIAS\FileUpload\Handler\BasicHandlerResult(
285 \
ILIAS\FileUpload\Handler\HandlerResult::STATUS_FAILED,
287 $result->getStatus()->getMessage()
295 if ($form->isValid()) {
296 $data = (string) $form->getData(
"deliver");
298 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"file_added"),
true);
301 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"msg_no_file"),
true);
306 $ilCtrl->
redirect($this,
"submissionScreen");
322 $fi->setRequired(
true);
325 $form->addCommandButton(
"uploadZip",
$lng->
txt(
"upload"));
326 $form->addCommandButton(
"submissionScreen",
$lng->
txt(
"cancel"));
328 $form->setTitle(
$lng->
txt(
"header_zip"));
329 $form->setFormAction($ilCtrl->getFormAction($this,
"uploadZip"));
342 if (!$this->submission->canSubmit()) {
343 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"exercise_time_over"),
true);
346 if (!$form->checkInput()) {
352 foreach ($_FILES[
"deliver"][
"name"] as $k => $v) {
354 "name" => $_FILES[
"deliver"][
"name"][$k],
355 "type" => $_FILES[
"deliver"][
"type"][$k],
356 "tmp_name" => $_FILES[
"deliver"][
"tmp_name"][$k],
357 "error" => $_FILES[
"deliver"][
"error"][$k],
358 "size" => $_FILES[
"deliver"][
"size"][$k],
360 if (!$this->submission->uploadFile($file)) {
361 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"exc_upload_error") .
" [Single File]",
true);
368 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"file_added"),
true);
373 $ilCtrl->redirect($this,
"submissionScreen");
384 if (!$this->submission->canSubmit()) {
385 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"exercise_time_over"),
true);
388 if (!$form->checkInput()) {
393 if (preg_match(
"/zip/", $_FILES[
"deliver"][
"type"]) == 1) {
395 if ($this->submission->processUploadedZipFile($_FILES[
"deliver"][
"tmp_name"])) {
396 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"file_added"),
true);
400 $this->tpl->setOnScreenMessage(
'failure', $e->getMessage(),
true);
401 $ilCtrl->redirect($this,
"submissionScreen");
406 $ilCtrl->redirect($this,
"submissionScreen");
418 $file_ids = $this->request->getSubmittedFileIds();
419 if (!$this->submission->canSubmit()) {
420 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"exercise_time_over"),
true);
421 $ilCtrl->redirect($this,
"submissionScreen");
424 if (count($file_ids) == 0) {
425 $this->tpl->setOnScreenMessage(
'failure',
$lng->
txt(
"no_checkbox"),
true);
426 $ilCtrl->redirect($this,
"submissionScreen");
428 $this->tabs_gui->clearTargets();
429 $this->tabs_gui->setBackTarget(
430 $this->
lng->txt(
"back"),
431 $this->
ctrl->getLinkTarget($this,
"submissionScreen")
435 $cgui->setFormAction($ilCtrl->getFormAction($this));
436 $cgui->setHeaderText(
$lng->
txt(
"info_delete_sure"));
437 $cgui->setCancel(
$lng->
txt(
"cancel"),
"submissionScreen");
438 $cgui->setConfirm(
$lng->
txt(
"delete"),
"deleteDelivered");
440 $files = $this->submission->getFiles();
442 foreach ($file_ids as $i) {
445 foreach ($files as
$f) {
446 if ($f[
"returned_id"] == $i) {
447 $title = $f[
"filetitle"];
450 $cgui->addItem(
"delivered[]", $i, $title);
464 $file_ids = $this->request->getSubmittedFileIds();
466 if (!$this->submission->canSubmit()) {
467 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"exercise_time_over"),
true);
468 } elseif (count($file_ids) == 0) {
469 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"please_select_a_delivered_file_to_delete"),
true);
471 $this->submission->deleteSelectedFiles($file_ids);
474 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"exc_submitted_files_deleted"),
true);
476 $ilCtrl->redirect($this,
"submissionScreen");
486 if ($this->submission->canView()) {
487 $peer_review_mask_filename = $this->submission->hasPeerReviewAccess();
493 $this->submission->downloadFiles(null, $a_only_new, $peer_review_mask_filename);
496 $this->tpl->setOnScreenMessage(
'info',
$lng->
txt(
"exc_all_new_files_offered_already"),
true);
516 $delivered_id = $this->request->getSubmittedFileId();
518 if (!$this->submission->canView()) {
522 if (!is_array($delivered_id) && $delivered_id > 0) {
523 $delivered_id = [$delivered_id];
525 if (is_array($delivered_id) && $delivered_id !== []) {
526 $this->submission->downloadFiles($delivered_id);
529 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"please_select_a_delivered_file_to_download"),
true);
530 $ilCtrl->redirect($this,
"submissionScreen");
handleNewUpload(bool $a_no_notifications=false)
getFiles(array $a_file_ids=null, bool $a_only_valid=false, string $a_min_timestamp=null, bool $print_versions=false)
Get submission items (not only files)
ILIAS Exercise InternalGUIService $gui
uploadZipObject()
Upload zip file.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
redirect(object $a_gui_obj, string $a_cmd=null, string $a_anchor=null, bool $is_async=false)
Class ChatMainBarProvider .
downloadNewReturnedObject()
Download newly submitted files of user.
Exercise submission base gui.
addProperty(string $a_name, string $a_value, string $a_link="")
add a property to current section
uploadFormObject(ilPropertyFormGUI $a_form=null)
static getOverviewContent(ilInfoScreenGUI $a_info, ilExSubmission $a_submission)
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
__construct(ilObjExercise $a_exercise, ilExSubmission $a_submission)
ilGlobalTemplateInterface $tpl
Provides fluid interface to RBAC services.
downloadObject()
User downloads (own) submitted files.
setContent(string $a_html)
Sets content for standard template.
handleUploadResult(\ILIAS\FileUpload\FileUpload $upload, \ILIAS\FileUpload\DTO\UploadResult $result)
setScreenIdComponent(string $a_comp)
initUploadForm()
Init upload form form.
uploadFileObject()
Upload files.
confirmDeleteDeliveredObject()
Confirm deletion of delivered files.
downloadReturnedObject(bool $a_only_new=false)
Download submitted files of user.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
uploadZipFormObject(ilPropertyFormGUI $a_form=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
initZipUploadForm()
Init upload form form.
deleteDeliveredObject()
Delete file(s) submitted by user.