ILIAS  release_8 Revision v8.24
ilExSubmissionFileGUI Class Reference

File-based submissions. More...

+ Inheritance diagram for ilExSubmissionFileGUI:
+ Collaboration diagram for ilExSubmissionFileGUI:

Public Member Functions

 __construct (ilObjExercise $a_exercise, ilExSubmission $a_submission)
 
 executeCommand ()
 
 submissionScreenObject ()
 
 uploadFormObject (ilPropertyFormGUI $a_form=null)
 
 uploadZipFormObject (ilPropertyFormGUI $a_form=null)
 
 uploadFileObject ()
 Upload files. More...
 
 uploadZipObject ()
 Upload zip file. More...
 
 confirmDeleteDeliveredObject ()
 Confirm deletion of delivered files. More...
 
 deleteDeliveredObject ()
 Delete file(s) submitted by user. More...
 
 downloadReturnedObject (bool $a_only_new=false)
 Download submitted files of user. More...
 
 downloadNewReturnedObject ()
 Download newly submitted files of user. More...
 
 downloadObject ()
 User downloads (own) submitted files. More...
 
- Public Member Functions inherited from ilExSubmissionBaseGUI
 returnToParentObject ()
 

Static Public Member Functions

static getOverviewContent (ilInfoScreenGUI $a_info, ilExSubmission $a_submission)
 
static getOverviewContent (ilInfoScreenGUI $a_info, ilExSubmission $a_submission)
 

Protected Member Functions

 initUploadForm ()
 Init upload form form. More...
 
 initZipUploadForm ()
 Init upload form form. More...
 
- Protected Member Functions inherited from ilExSubmissionBaseGUI
 handleTabs ()
 
 handleNewUpload (bool $a_no_notifications=false)
 
 handleRemovedUpload ()
 
 triggerAssignmentTool ()
 

Protected Attributes

ilToolbarGUI $toolbar
 
ilHelpGUI $help
 
ilObjUser $user
 
UIServices $ui
 
- Protected Attributes inherited from ilExSubmissionBaseGUI
ilCtrl $ctrl
 
ilTabsGUI $tabs_gui
 
ilLanguage $lng
 
ilGlobalTemplateInterface $tpl
 
ilObjExercise $exercise
 
ilExSubmission $submission
 
ilExAssignment $assignment
 
MandatoryAssignmentsManager $mandatory_manager
 
ContextServices $tool_context
 
ilExAssignmentTypesGUI $type_guis
 
int $requested_ref_id
 
GUIRequest $request
 

Detailed Description

File-based submissions.

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

@ilCtrl_Calls ilExSubmissionFileGUI:

Definition at line 29 of file class.ilExSubmissionFileGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilExSubmissionFileGUI::__construct ( ilObjExercise  $a_exercise,
ilExSubmission  $a_submission 
)

Definition at line 36 of file class.ilExSubmissionFileGUI.php.

39 {
40 global $DIC;
41
42 parent::__construct($a_exercise, $a_submission);
43
44 $this->toolbar = $DIC->toolbar();
45 $this->help = $DIC["ilHelp"];
46 $this->user = $DIC->user();
47 $this->ui = $DIC->ui();
48 }
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\help(), ILIAS\Repository\toolbar(), ILIAS\Repository\ui(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ confirmDeleteDeliveredObject()

ilExSubmissionFileGUI::confirmDeleteDeliveredObject ( )

Confirm deletion of delivered files.

Definition at line 330 of file class.ilExSubmissionFileGUI.php.

330 : void
331 {
332 $ilCtrl = $this->ctrl;
335
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");
340 }
341
342 if (count($file_ids) == 0) {
343 $this->tpl->setOnScreenMessage('failure', $lng->txt("no_checkbox"), true);
344 $ilCtrl->redirect($this, "submissionScreen");
345 } else {
346 $this->tabs_gui->clearTargets();
347 $this->tabs_gui->setBackTarget(
348 $this->lng->txt("back"),
349 $this->ctrl->getLinkTarget($this, "submissionScreen")
350 );
351
352 $cgui = new ilConfirmationGUI();
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");
357
358 $files = $this->submission->getFiles();
359
360 foreach ($file_ids as $i) {
361 reset($files);
362 $title = "";
363 foreach ($files as $f) {
364 if ($f["returned_id"] == $i) {
365 $title = $f["filetitle"];
366 }
367 }
368 $cgui->addItem("delivered[]", $i, $title);
369 }
370
371 $tpl->setContent($cgui->getHTML());
372 }
373 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilGlobalTemplateInterface $tpl
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...
setContent(string $a_html)
Sets content for standard template.
$i
Definition: metadata.php:41

References Vendor\Package\$f, $i, $lng, $tpl, and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ deleteDeliveredObject()

ilExSubmissionFileGUI::deleteDeliveredObject ( )

Delete file(s) submitted by user.

Definition at line 378 of file class.ilExSubmissionFileGUI.php.

378 : void
379 {
380 $ilCtrl = $this->ctrl;
381
382 $file_ids = $this->request->getSubmittedFileIds();
383
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);
388 } else {
389 $this->submission->deleteSelectedFiles($file_ids);
390 $this->handleRemovedUpload();
391
392 $this->tpl->setOnScreenMessage('success', $this->lng->txt("exc_submitted_files_deleted"), true);
393 }
394 $ilCtrl->redirect($this, "submissionScreen");
395 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ downloadNewReturnedObject()

ilExSubmissionFileGUI::downloadNewReturnedObject ( )

Download newly submitted files of user.

Definition at line 422 of file class.ilExSubmissionFileGUI.php.

422 : void
423 {
424 $this->downloadReturnedObject(true);
425 }
downloadReturnedObject(bool $a_only_new=false)
Download submitted files of user.

◆ downloadObject()

ilExSubmissionFileGUI::downloadObject ( )

User downloads (own) submitted files.

Definition at line 430 of file class.ilExSubmissionFileGUI.php.

430 : void
431 {
432 $ilCtrl = $this->ctrl;
433
434 $delivered_id = $this->request->getSubmittedFileId();
435
436 if (!$this->submission->canView()) {
437 $this->returnToParentObject();
438 }
439
440 if (!is_array($delivered_id) && $delivered_id > 0) {
441 $delivered_id = [$delivered_id];
442 }
443 if (is_array($delivered_id) && $delivered_id !== []) {
444 $this->submission->downloadFiles($delivered_id);
445 exit;
446 } else {
447 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("please_select_a_delivered_file_to_download"), true);
448 $ilCtrl->redirect($this, "submissionScreen");
449 }
450 }
exit
Definition: login.php:28

References exit, and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ downloadReturnedObject()

ilExSubmissionFileGUI::downloadReturnedObject ( bool  $a_only_new = false)

Download submitted files of user.

Definition at line 400 of file class.ilExSubmissionFileGUI.php.

400 : void
401 {
403
404 if ($this->submission->canView()) {
405 $peer_review_mask_filename = $this->submission->hasPeerReviewAccess();
406 } else {
407 // no access
408 return;
409 }
410
411 $this->submission->downloadFiles(null, $a_only_new, $peer_review_mask_filename);
412 // we only get here, if no files have been found for download
413 if ($a_only_new) {
414 $this->tpl->setOnScreenMessage('info', $lng->txt("exc_all_new_files_offered_already"), true);
415 }
416 $this->returnToParentObject();
417 }

References $lng.

◆ executeCommand()

ilExSubmissionFileGUI::executeCommand ( )

Definition at line 50 of file class.ilExSubmissionFileGUI.php.

50 : void
51 {
52 $ilCtrl = $this->ctrl;
53
54 if (!$this->submission->canView()) {
55 $this->returnToParentObject();
56 }
57
58 $class = $ilCtrl->getNextClass($this);
59 $cmd = $ilCtrl->getCmd("submissionScreen");
60
61 switch ($class) {
62 default:
63 $this->{$cmd . "Object"}();
64 break;
65 }
66 }

References ilExSubmissionBaseGUI\$ctrl, and ilExSubmissionBaseGUI\returnToParentObject().

+ Here is the call graph for this function:

◆ getOverviewContent()

static ilExSubmissionFileGUI::getOverviewContent ( ilInfoScreenGUI  $a_info,
ilExSubmission  $a_submission 
)
static

Reimplemented from ilExSubmissionBaseGUI.

Definition at line 68 of file class.ilExSubmissionFileGUI.php.

71 : void {
72 global $DIC;
73
74 $lng = $DIC->language();
75 $ilCtrl = $DIC->ctrl();
76
77 $titles = array();
78 foreach ($a_submission->getFiles() as $file) {
79 $titles[] = htmlentities($file["filetitle"]);
80 }
81 $files_str = implode("<br>", $titles);
82 if ($files_str == "") {
83 $files_str = $lng->txt("message_no_delivered_files");
84 }
85
86 // no team == no submission
87 if (!$a_submission->hasNoTeamYet()) {
88 if ($a_submission->canSubmit()) {
89 $title = (count($titles) == 0
90 ? $lng->txt("exc_hand_in")
91 : $lng->txt("exc_edit_submission"));
92
93 $button = ilLinkButton::getInstance();
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();
98 } else {
99 if (count($titles) > 0) {
100 $button = ilLinkButton::getInstance();
101 $button->setCaption("already_delivered_files");
102 $button->setUrl($ilCtrl->getLinkTargetByClass(array("ilExSubmissionGUI", "ilExSubmissionFileGUI"), "submissionScreen"));
103 $files_str .= "<br><br>" . $button->render();
104 }
105 }
106 }
107
108 $a_info->addProperty($lng->txt("exc_files_returned"), $files_str);
109 }
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)
addProperty(string $a_name, string $a_value, string $a_link="")
add a property to current section

◆ initUploadForm()

ilExSubmissionFileGUI::initUploadForm ( )
protected

Init upload form form.

Definition at line 211 of file class.ilExSubmissionFileGUI.php.

212 {
214 $ilCtrl = $this->ctrl;
215
216 $form = new ilPropertyFormGUI();
217
218 // file input
219 $fi = new ilFileWizardInputGUI($lng->txt("file"), "deliver");
220 $fi->setFilenames(array(0 => ''));
221 $fi->setRequired(true);
222 $form->addItem($fi);
223
224 $form->addCommandButton("uploadFile", $lng->txt("upload"));
225 $form->addCommandButton("submissionScreen", $lng->txt("cancel"));
226
227 $form->setTitle($lng->txt("file_add"));
228 $form->setFormAction($ilCtrl->getFormAction($this, "uploadFile"));
229
230 return $form;
231 }
This class represents a file wizard property in a property form.
This class represents a property form user interface.

References $lng.

◆ initZipUploadForm()

ilExSubmissionFileGUI::initZipUploadForm ( )
protected

Init upload form form.

Definition at line 236 of file class.ilExSubmissionFileGUI.php.

237 {
239 $ilCtrl = $this->ctrl;
240
241 $form = new ilPropertyFormGUI();
242
243 $fi = new ilFileInputGUI($lng->txt("file"), "deliver");
244 $fi->setSuffixes(array("zip"));
245 $fi->setRequired(true);
246 $form->addItem($fi);
247
248 $form->addCommandButton("uploadZip", $lng->txt("upload"));
249 $form->addCommandButton("submissionScreen", $lng->txt("cancel"));
250
251 $form->setTitle($lng->txt("header_zip"));
252 $form->setFormAction($ilCtrl->getFormAction($this, "uploadZip"));
253
254 return $form;
255 }
This class represents a file property in a property form.

References $lng.

◆ submissionScreenObject()

ilExSubmissionFileGUI::submissionScreenObject ( )

Definition at line 112 of file class.ilExSubmissionFileGUI.php.

112 : void
113 {
114 $ilToolbar = $this->toolbar;
115 $ilHelp = $this->help;
117
118 $this->triggerAssignmentTool();
119
120 $this->handleTabs();
121
122 $ilHelp->setScreenIdComponent("exc");
123 $ilHelp->setScreenId("submissions");
124
125 if (!$this->submission->canSubmit()) {
126 $this->tpl->setOnScreenMessage('info', $this->lng->txt("exercise_time_over"));
127 } else {
128 $max_files = $this->submission->getAssignment()->getMaxFile();
129
130 if ($this->submission->canAddFile()) {
131 // #15883 - extended deadline warning
132 $deadline = $this->assignment->getPersonalDeadline($ilUser->getId());
133 if ($deadline &&
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);
139 }
140
141 $b = $this->ui->factory()->button()->standard(
142 $this->lng->txt("file_add"),
143 $this->ctrl->getLinkTarget($this, "uploadForm")
144 );
145 $ilToolbar->addStickyItem($b);
146
147 if (!$max_files ||
148 $max_files > 1) {
149 $ilToolbar->addButton(
150 $this->lng->txt("header_zip"),
151 $this->ctrl->getLinkTarget($this, "uploadZipForm")
152 );
153 }
154 }
155
156 if ($max_files) {
157 $this->tpl->setOnScreenMessage('info', sprintf($this->lng->txt("exc_max_file_reached"), $max_files));
158 }
159 }
160
161 $tab = new ilExcDeliveredFilesTableGUI($this, "submissionScreen", $this->submission);
162 $this->tpl->setContent($tab->getHTML());
163 }
const IL_CAL_UNIX
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
@classDescription Date and time handling
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$ilUser
Definition: imgupload.php:34

References Vendor\Package\$b, $ilUser, ilDatePresentation\formatDate(), IL_CAL_UNIX, ILIAS\Repository\lng(), and ILIAS\Repository\ui().

+ Here is the call graph for this function:

◆ uploadFileObject()

ilExSubmissionFileGUI::uploadFileObject ( )

Upload files.

Definition at line 260 of file class.ilExSubmissionFileGUI.php.

260 : void
261 {
262 $ilCtrl = $this->ctrl;
263
264 // #15322
265 if (!$this->submission->canSubmit()) {
266 $this->tpl->setOnScreenMessage('info', $this->lng->txt("exercise_time_over"), true);
267 } else {
268 $form = $this->initUploadForm();
269 if (!$form->checkInput()) {
270 $this->uploadFormObject($form);
271 return;
272 }
273
274 $success = false;
275 foreach ($_FILES["deliver"]["name"] as $k => $v) {
276 $file = array(
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],
282 );
283 if (!$this->submission->uploadFile($file)) {
284 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("exc_upload_error") . " [Single File]", true);
285 } else {
286 $success = true;
287 }
288 }
289
290 if ($success) {
291 $this->tpl->setOnScreenMessage('success', $this->lng->txt("file_added"), true);
292 $this->handleNewUpload();
293 }
294 }
295
296 $ilCtrl->redirect($this, "submissionScreen");
297 }
handleNewUpload(bool $a_no_notifications=false)
initUploadForm()
Init upload form form.
uploadFormObject(ilPropertyFormGUI $a_form=null)

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ uploadFormObject()

ilExSubmissionFileGUI::uploadFormObject ( ilPropertyFormGUI  $a_form = null)

Definition at line 166 of file class.ilExSubmissionFileGUI.php.

168 : void {
169 if (!$this->submission->canSubmit()) {
170 $this->ctrl->redirect($this, "submissionScreen");
171 }
172
173 $this->tabs_gui->clearTargets();
174 $this->tabs_gui->setBackTarget(
175 $this->lng->txt("back"),
176 $this->ctrl->getLinkTarget($this, "submissionScreen")
177 );
178
179 $ilHelp = $this->help;
180 $ilHelp->setScreenIdComponent("exc");
181 $ilHelp->setScreenId("upload_submission");
182
183 if (!$a_form) {
184 $a_form = $this->initUploadForm();
185 }
186 $this->tpl->setContent($a_form->getHTML());
187 }
setScreenIdComponent(string $a_comp)

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ uploadZipFormObject()

ilExSubmissionFileGUI::uploadZipFormObject ( ilPropertyFormGUI  $a_form = null)

Definition at line 189 of file class.ilExSubmissionFileGUI.php.

191 : void {
192 if (!$this->submission->canSubmit()) {
193 $this->ctrl->redirect($this, "submissionScreen");
194 }
195
196 $this->tabs_gui->clearTargets();
197 $this->tabs_gui->setBackTarget(
198 $this->lng->txt("back"),
199 $this->ctrl->getLinkTarget($this, "submissionScreen")
200 );
201
202 if (!$a_form) {
203 $a_form = $this->initZipUploadForm();
204 }
205 $this->tpl->setContent($a_form->getHTML());
206 }
initZipUploadForm()
Init upload form form.

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ uploadZipObject()

ilExSubmissionFileGUI::uploadZipObject ( )

Upload zip file.

Definition at line 302 of file class.ilExSubmissionFileGUI.php.

302 : void
303 {
304 $ilCtrl = $this->ctrl;
305
306 // #15322
307 if (!$this->submission->canSubmit()) {
308 $this->tpl->setOnScreenMessage('info', $this->lng->txt("exercise_time_over"), true);
309 } else {
310 $form = $this->initZipUploadForm();
311 if (!$form->checkInput()) {
312 $this->uploadZipFormObject($form);
313 return;
314 }
315
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();
320 }
321 }
322 }
323
324 $ilCtrl->redirect($this, "submissionScreen");
325 }
uploadZipFormObject(ilPropertyFormGUI $a_form=null)

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

Field Documentation

◆ $help

ilHelpGUI ilExSubmissionFileGUI::$help
protected

Definition at line 32 of file class.ilExSubmissionFileGUI.php.

◆ $toolbar

ilToolbarGUI ilExSubmissionFileGUI::$toolbar
protected

Definition at line 31 of file class.ilExSubmissionFileGUI.php.

◆ $ui

UIServices ilExSubmissionFileGUI::$ui
protected

Definition at line 34 of file class.ilExSubmissionFileGUI.php.

◆ $user

ilObjUser ilExSubmissionFileGUI::$user
protected

Definition at line 33 of file class.ilExSubmissionFileGUI.php.


The documentation for this class was generated from the following file: