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");
63 $this->{$cmd .
"Object"}();
75 $ilCtrl =
$DIC->ctrl();
78 foreach ($a_submission->
getFiles() as $file) {
79 $titles[] = htmlentities($file[
"filetitle"]);
81 $files_str = implode(
"<br>", $titles);
82 if ($files_str ==
"") {
83 $files_str =
$lng->
txt(
"message_no_delivered_files");
89 $title = (count($titles) == 0
91 :
$lng->
txt(
"exc_edit_submission"));
94 $button->setPrimary(
true);
95 $button->setCaption($title,
false);
96 $button->setUrl($ilCtrl->getLinkTargetByClass(array(
"ilExSubmissionGUI",
"ilExSubmissionFileGUI"),
"submissionScreen"));
97 $files_str .=
"<br><br>" . $button->render();
99 if (count($titles) > 0) {
101 $button->setCaption(
"already_delivered_files");
102 $button->setUrl($ilCtrl->getLinkTargetByClass(array(
"ilExSubmissionGUI",
"ilExSubmissionFileGUI"),
"submissionScreen"));
103 $files_str .=
"<br><br>" . $button->render();
114 $ilToolbar = $this->toolbar;
115 $ilHelp = $this->help;
118 $this->triggerAssignmentTool();
122 $ilHelp->setScreenIdComponent(
"exc");
123 $ilHelp->setScreenId(
"submissions");
125 if (!$this->submission->canSubmit()) {
126 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"exercise_time_over"));
128 $max_files = $this->submission->getAssignment()->getMaxFile();
130 if ($this->submission->canAddFile()) {
132 $deadline = $this->assignment->getPersonalDeadline(
$ilUser->getId());
134 time() > $deadline) {
136 $dl = sprintf($this->
lng->txt(
"exc_late_submission_warning"), $dl);
137 $dl =
'<span class="warning">' . $dl .
'</span>';
138 $ilToolbar->addText($dl);
141 $b = $this->
ui->factory()->button()->standard(
142 $this->
lng->txt(
"file_add"),
143 $this->ctrl->getLinkTarget($this,
"uploadForm")
145 $ilToolbar->addStickyItem(
$b);
149 $ilToolbar->addButton(
150 $this->
lng->txt(
"header_zip"),
151 $this->ctrl->getLinkTarget($this,
"uploadZipForm")
157 $this->tpl->setOnScreenMessage(
'info', sprintf($this->
lng->txt(
"exc_max_file_reached"), $max_files));
162 $this->tpl->setContent($tab->getHTML());
169 if (!$this->submission->canSubmit()) {
170 $this->
ctrl->redirect($this,
"submissionScreen");
173 $this->tabs_gui->clearTargets();
174 $this->tabs_gui->setBackTarget(
175 $this->
lng->txt(
"back"),
176 $this->ctrl->getLinkTarget($this,
"submissionScreen")
179 $ilHelp = $this->help;
180 $ilHelp->setScreenIdComponent(
"exc");
181 $ilHelp->setScreenId(
"upload_submission");
184 $a_form = $this->initUploadForm();
186 $this->tpl->setContent($a_form->getHTML());
192 if (!$this->submission->canSubmit()) {
193 $this->
ctrl->redirect($this,
"submissionScreen");
196 $this->tabs_gui->clearTargets();
197 $this->tabs_gui->setBackTarget(
198 $this->
lng->txt(
"back"),
199 $this->ctrl->getLinkTarget($this,
"submissionScreen")
203 $a_form = $this->initZipUploadForm();
205 $this->tpl->setContent($a_form->getHTML());
214 $ilCtrl = $this->ctrl;
220 $fi->setFilenames(array(0 =>
''));
221 $fi->setRequired(
true);
224 $form->addCommandButton(
"uploadFile",
$lng->txt(
"upload"));
225 $form->addCommandButton(
"submissionScreen",
$lng->txt(
"cancel"));
227 $form->setTitle(
$lng->txt(
"file_add"));
228 $form->setFormAction($ilCtrl->getFormAction($this,
"uploadFile"));
239 $ilCtrl = $this->ctrl;
244 $fi->setSuffixes(array(
"zip"));
245 $fi->setRequired(
true);
248 $form->addCommandButton(
"uploadZip",
$lng->txt(
"upload"));
249 $form->addCommandButton(
"submissionScreen",
$lng->txt(
"cancel"));
251 $form->setTitle(
$lng->txt(
"header_zip"));
252 $form->setFormAction($ilCtrl->getFormAction($this,
"uploadZip"));
262 $ilCtrl = $this->ctrl;
265 if (!$this->submission->canSubmit()) {
266 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"exercise_time_over"),
true);
268 $form = $this->initUploadForm();
269 if (!$form->checkInput()) {
270 $this->uploadFormObject($form);
275 foreach ($_FILES[
"deliver"][
"name"] as $k => $v) {
277 "name" => $_FILES[
"deliver"][
"name"][$k],
278 "type" => $_FILES[
"deliver"][
"type"][$k],
279 "tmp_name" => $_FILES[
"deliver"][
"tmp_name"][$k],
280 "error" => $_FILES[
"deliver"][
"error"][$k],
281 "size" => $_FILES[
"deliver"][
"size"][$k],
283 if (!$this->submission->uploadFile($file)) {
284 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"exc_upload_error") .
" [Single File]",
true);
291 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"file_added"),
true);
292 $this->handleNewUpload();
296 $ilCtrl->redirect($this,
"submissionScreen");
304 $ilCtrl = $this->ctrl;
307 if (!$this->submission->canSubmit()) {
308 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"exercise_time_over"),
true);
310 $form = $this->initZipUploadForm();
311 if (!$form->checkInput()) {
312 $this->uploadZipFormObject($form);
316 if (preg_match(
"/zip/", $_FILES[
"deliver"][
"type"]) == 1) {
317 if ($this->submission->processUploadedZipFile($_FILES[
"deliver"][
"tmp_name"])) {
318 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"file_added"),
true);
319 $this->handleNewUpload();
324 $ilCtrl->redirect($this,
"submissionScreen");
332 $ilCtrl = $this->ctrl;
336 $file_ids = $this->request->getSubmittedFileIds();
337 if (!$this->submission->canSubmit()) {
338 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"exercise_time_over"),
true);
339 $ilCtrl->redirect($this,
"submissionScreen");
342 if (count($file_ids) == 0) {
343 $this->tpl->setOnScreenMessage(
'failure',
$lng->txt(
"no_checkbox"),
true);
344 $ilCtrl->redirect($this,
"submissionScreen");
346 $this->tabs_gui->clearTargets();
347 $this->tabs_gui->setBackTarget(
348 $this->
lng->txt(
"back"),
349 $this->ctrl->getLinkTarget($this,
"submissionScreen")
353 $cgui->setFormAction($ilCtrl->getFormAction($this));
354 $cgui->setHeaderText(
$lng->txt(
"info_delete_sure"));
355 $cgui->setCancel(
$lng->txt(
"cancel"),
"submissionScreen");
356 $cgui->setConfirm(
$lng->txt(
"delete"),
"deleteDelivered");
358 $files = $this->submission->getFiles();
360 foreach ($file_ids as
$i) {
363 foreach ($files as
$f) {
364 if (
$f[
"returned_id"] ==
$i) {
365 $title =
$f[
"filetitle"];
368 $cgui->addItem(
"delivered[]",
$i, $title);
371 $tpl->setContent($cgui->getHTML());
380 $ilCtrl = $this->ctrl;
382 $file_ids = $this->request->getSubmittedFileIds();
384 if (!$this->submission->canSubmit()) {
385 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"exercise_time_over"),
true);
386 } elseif (count($file_ids) == 0) {
387 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"please_select_a_delivered_file_to_delete"),
true);
389 $this->submission->deleteSelectedFiles($file_ids);
390 $this->handleRemovedUpload();
392 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"exc_submitted_files_deleted"),
true);
394 $ilCtrl->redirect($this,
"submissionScreen");
404 if ($this->submission->canView()) {
405 $peer_review_mask_filename = $this->submission->hasPeerReviewAccess();
411 $this->submission->downloadFiles(
null, $a_only_new, $peer_review_mask_filename);
414 $this->tpl->setOnScreenMessage(
'info',
$lng->txt(
"exc_all_new_files_offered_already"),
true);
416 $this->returnToParentObject();
424 $this->downloadReturnedObject(
true);
432 $ilCtrl = $this->ctrl;
434 $delivered_id = $this->request->getSubmittedFileId();
436 if (!$this->submission->canView()) {
437 $this->returnToParentObject();
440 if (!is_array($delivered_id) && $delivered_id > 0) {
441 $delivered_id = [$delivered_id];
443 if (is_array($delivered_id) && $delivered_id !== []) {
444 $this->submission->downloadFiles($delivered_id);
447 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"please_select_a_delivered_file_to_download"),
true);
448 $ilCtrl->redirect($this,
"submissionScreen");
Provides fluid interface to RBAC services.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
@classDescription Date and time handling
Exercise submission base gui.
uploadZipObject()
Upload zip file.
uploadZipFormObject(ilPropertyFormGUI $a_form=null)
confirmDeleteDeliveredObject()
Confirm deletion of delivered files.
static getOverviewContent(ilInfoScreenGUI $a_info, ilExSubmission $a_submission)
initZipUploadForm()
Init upload form form.
__construct(ilObjExercise $a_exercise, ilExSubmission $a_submission)
deleteDeliveredObject()
Delete file(s) submitted by user.
downloadNewReturnedObject()
Download newly submitted files of user.
downloadObject()
User downloads (own) submitted files.
initUploadForm()
Init upload form form.
downloadReturnedObject(bool $a_only_new=false)
Download submitted files of user.
uploadFormObject(ilPropertyFormGUI $a_form=null)
uploadFileObject()
Upload files.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addProperty(string $a_name, string $a_value, string $a_link="")
add a property to current section
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...
if(!file_exists(getcwd() . '/ilias.ini.php'))
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc