31 protected \ILIAS\Exercise\Submission\SubmissionManager
$subm;
46 $this->
toolbar = $DIC->toolbar();
47 $this->
help = $DIC[
"ilHelp"];
48 $this->
user = $DIC->user();
49 $this->
ui = $DIC->ui();
50 $this->log = $DIC->logger()->exc();
51 $this->subm = $DIC->exercise()->internal()->domain()->submission(
60 if (!$this->submission->canView()) {
64 $class = $ilCtrl->getNextClass($this);
65 $cmd = $ilCtrl->getCmd(
"submissionScreen");
68 case strtolower(ilRepoStandardUploadHandlerGUI::class):
69 if ($this->request->getZip()) {
74 $gui = $form->getRepoStandardUploadHandlerGUI(
"deliver");
79 $this->{$cmd .
"Object"}();
90 $lng = $DIC->language();
91 $ilCtrl = $DIC->ctrl();
92 $gui = $DIC->exercise()->internal()->gui();
93 $subm = $DIC->exercise()->internal()->domain()->submission(
98 foreach ($subm->getSubmissionsOfUser($a_submission->
getUserId()) as $sub) {
99 $titles[] = htmlentities($sub->getTitle());
101 $files_str = implode(
"<br>", $titles);
102 if ($files_str ==
"") {
103 $files_str =
$lng->
txt(
"message_no_delivered_files");
109 $title = (count($titles) == 0
111 :
$lng->
txt(
"exc_edit_submission"));
113 $button =
$gui->link(
115 $ilCtrl->getLinkTargetByClass(array(ilAssignmentPresentationGUI::class,
"ilExSubmissionGUI",
"ilExSubmissionFileGUI"),
"submissionScreen")
117 $files_str .=
"<br><br>" . $button->render();
119 if (count($titles) > 0) {
121 $lng->
txt(
"already_delivered_files"),
122 $ilCtrl->getLinkTargetByClass(array(ilAssignmentPresentationGUI::class,
"ilExSubmissionGUI",
"ilExSubmissionFileGUI"),
"submissionScreen")
124 $files_str .=
"<br><br>" . $link->render();
143 $ilHelp->setScreenIdComponent(
"exc");
144 $ilHelp->setScreenId(
"submissions");
146 if (!$this->submission->canSubmit()) {
147 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"exercise_time_over"));
149 $max_files = $this->submission->getAssignment()->getMaxFile();
151 if ($this->submission->canAddFile()) {
153 $deadline = $this->assignment->getPersonalDeadline($ilUser->getId());
155 time() > $deadline) {
157 $dl = sprintf($this->
lng->txt(
"exc_late_submission_warning"), $dl);
158 $dl =
'<span class="warning">' . $dl .
'</span>';
159 $ilToolbar->addText($dl);
162 $b = $this->
ui->factory()->button()->standard(
163 $this->
lng->txt(
"file_add"),
164 $this->
ctrl->getLinkTarget($this,
"uploadForm")
166 $ilToolbar->addStickyItem(
$b);
170 $ilToolbar->addButton(
171 $this->
lng->txt(
"header_zip"),
172 $this->
ctrl->getLinkTarget($this,
"uploadZipForm")
178 $this->tpl->setOnScreenMessage(
'info', sprintf($this->
lng->txt(
"exc_max_file_reached"), $max_files));
183 $this->tpl->setContent($tab->getHTML());
190 if (!$this->submission->canSubmit()) {
191 $this->
ctrl->redirect($this,
"submissionScreen");
194 $this->tabs_gui->clearTargets();
195 $this->tabs_gui->setBackTarget(
196 $this->
lng->txt(
"back"),
197 $this->
ctrl->getLinkTarget($this,
"submissionScreen")
202 $ilHelp->setScreenId(
"upload_submission");
206 $this->tpl->setContent($a_form->render());
209 $this->tpl->setContent($a_form->getHTML());
213 ?\
ILIAS\Repository\Form\FormAdapterGUI $a_form =
null 215 if (!$this->submission->canSubmit()) {
216 $this->
ctrl->redirect($this,
"submissionScreen");
219 $this->tabs_gui->clearTargets();
220 $this->tabs_gui->setBackTarget(
221 $this->
lng->txt(
"back"),
222 $this->
ctrl->getLinkTarget($this,
"submissionScreen")
228 $this->tpl->setContent($a_form->render());
244 $fi->setRequired(
true);
247 $form->addCommandButton(
"uploadFile",
$lng->
txt(
"upload"));
248 $form->addCommandButton(
"submissionScreen",
$lng->
txt(
"cancel"));
250 $form->setTitle(
$lng->
txt(
"file_add"));
251 $form->setFormAction($ilCtrl->getFormAction($this,
"uploadFile"));
258 $max_file = $this->submission->getAssignment()->getMaxFile();
259 $cnt_sub = $this->subm->countSubmissionsOfUser($this->submission->getUserId());
261 $max_file = $this->submission->getAssignment()->getMaxFile() - $cnt_sub;
266 $form_adapter = $this->gui
267 ->form(self::class,
'addUpload')
268 ->section(
"props", $this->
lng->txt(
'file_add'))
271 $this->
lng->txt(
"files"),
277 return $form_adapter;
281 \
ILIAS\FileUpload\FileUpload $upload,
282 \
ILIAS\FileUpload\DTO\UploadResult $result
284 $title = $result->getName();
287 $subm = $this->domain->submission($this->assignment->getId());
289 $this->
user->getid(),
294 return new \ILIAS\FileUpload\Handler\BasicHandlerResult(
305 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"file_added"),
true);
308 $ilCtrl->redirect($this,
"submissionScreen");
346 $this->
ctrl->setParameterByClass(self::class,
"zip",
"1");
347 $form_adapter = $this->gui
348 ->form(self::class,
'addUpload')
349 ->section(
"props", $this->
lng->txt(
'file_add'))
352 $this->
lng->txt(
"files"),
353 \Closure::fromCallable([$this,
'handleZipUploadResult']),
359 return $form_adapter;
365 \
ILIAS\FileUpload\FileUpload $upload,
366 \
ILIAS\FileUpload\DTO\UploadResult $result
368 $title = $result->getName();
370 $subm = $this->domain->submission($this->assignment->getId());
372 if ($this->submission->canSubmit()) {
374 $subm->addZipUploads(
375 $this->
user->getid(),
378 return new \ILIAS\FileUpload\Handler\BasicHandlerResult(
385 $mess = $this->
lng->txt(
"exc_too_many_files");
388 $mess = $this->
lng->txt(
"exc_cannot_submit_any_files");
390 return new \ILIAS\FileUpload\Handler\BasicHandlerResult(
407 $file_ids = $this->request->getSubmittedFileIds();
408 if (!$this->submission->canSubmit()) {
409 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"exercise_time_over"),
true);
410 $ilCtrl->redirect($this,
"submissionScreen");
413 if (count($file_ids) == 0) {
414 $this->tpl->setOnScreenMessage(
'failure',
$lng->
txt(
"no_checkbox"),
true);
415 $ilCtrl->redirect($this,
"submissionScreen");
417 $this->tabs_gui->clearTargets();
418 $this->tabs_gui->setBackTarget(
419 $this->
lng->txt(
"back"),
420 $this->
ctrl->getLinkTarget($this,
"submissionScreen")
424 $cgui->setFormAction($ilCtrl->getFormAction($this));
425 $cgui->setHeaderText(
$lng->
txt(
"info_delete_sure"));
426 $cgui->setCancel(
$lng->
txt(
"cancel"),
"submissionScreen");
427 $cgui->setConfirm(
$lng->
txt(
"delete"),
"deleteDelivered");
429 $subs = $this->subm->getSubmissionsOfUser(
430 $this->submission->getUserId(),
434 foreach ($subs as $sub) {
435 $cgui->addItem(
"delivered[]", $sub->getId(), $sub->getTitle());
449 $file_ids = $this->request->getSubmittedFileIds();
451 if (!$this->submission->canSubmit()) {
452 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"exercise_time_over"),
true);
453 } elseif (count($file_ids) == 0) {
454 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"please_select_a_delivered_file_to_delete"),
true);
456 $this->subm->deleteSubmissions(
457 $this->submission->getUserId(),
462 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"exc_submitted_files_deleted"),
true);
464 $ilCtrl->redirect($this,
"submissionScreen");
474 if ($this->submission->canView()) {
475 $peer_review_mask_filename = $this->submission->hasPeerReviewAccess();
481 $this->submission->downloadFiles(
null, $a_only_new, $peer_review_mask_filename);
484 $this->tpl->setOnScreenMessage(
'info',
$lng->
txt(
"exc_all_new_files_offered_already"),
true);
504 $delivered_id = $this->request->getSubmittedFileId();
506 if (!$this->submission->canView()) {
510 if (!is_array($delivered_id) && $delivered_id > 0) {
511 $delivered_id = [$delivered_id];
513 if (is_array($delivered_id) && $delivered_id !== []) {
514 $this->submission->downloadFiles($delivered_id);
517 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"please_select_a_delivered_file_to_download"),
true);
518 $ilCtrl->redirect($this,
"submissionScreen");
handleNewUpload(bool $a_no_notifications=false)
ILIAS Exercise InternalGUIService $gui
uploadZipFormObject(?\ILIAS\Repository\Form\FormAdapterGUI $a_form=null)
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...
Interface Observer Contains several chained tasks and infos about them.
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
static getOverviewContent(ilInfoScreenGUI $a_info, ilExSubmission $a_submission)
__construct(ilObjExercise $a_exercise, ilExSubmission $a_submission)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setContent(string $a_html)
Sets content for standard template.
ilGlobalTemplateInterface $tpl
uploadFormObject(?ilPropertyFormGUI $a_form=null)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
Provides fluid interface to RBAC services.
downloadObject()
User downloads (own) submitted files.
handleUploadResult(\ILIAS\FileUpload\FileUpload $upload, \ILIAS\FileUpload\DTO\UploadResult $result)
setScreenIdComponent(string $a_comp)
initUploadForm()
Init upload form form.
ILIAS Exercise Submission SubmissionManager $subm
confirmDeleteDeliveredObject()
Confirm deletion of delivered files.
__construct(Container $dic, ilPlugin $plugin)
downloadReturnedObject(bool $a_only_new=false)
Download submitted files of user.
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
getZipUploadForm()
Init upload form form.
handleZipUploadResult(\ILIAS\FileUpload\FileUpload $upload, \ILIAS\FileUpload\DTO\UploadResult $result)
Exercise submission //TODO: This class has many static methods related to delivered "files"...
exit
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
deleteDeliveredObject()
Delete file(s) submitted by user.