ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilExSubmissionFileGUI Class Reference

File-based submissions. More...

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

Public Member Functions

 executeCommand ()
 
 submissionScreenObject ()
 Displays a form which allows members to deliver their solutions. More...
 
 uploadFormObject (ilPropertyFormGUI $a_form=null)
 Display form for single file upload. More...
 
 uploadZipFormObject (ilPropertyFormGUI $a_form=null)
 Display form for zip file upload. More...
 
 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 ($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
 __construct (ilObjExercise $a_exercise, ilExSubmission $a_submission)
 
 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 ($a_no_notifications=false)
 
 handleRemovedUpload ()
 

Additional Inherited Members

- Protected Attributes inherited from ilExSubmissionBaseGUI
 $exercise
 
 $submission
 
 $assignment
 

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

@ilCtrl_Calls ilExSubmissionFileGUI:

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

Member Function Documentation

◆ confirmDeleteDeliveredObject()

ilExSubmissionFileGUI::confirmDeleteDeliveredObject ( )

Confirm deletion of delivered files.

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

319 {
320 global $ilCtrl, $tpl, $lng;
321
322 if (!$this->submission->canSubmit())
323 {
324 ilUtil::sendFailure($this->lng->txt("exercise_time_over"), true);
325 $ilCtrl->redirect($this, "submissionScreen");
326 }
327
328 if (!is_array($_POST["delivered"]) || count($_POST["delivered"]) == 0)
329 {
330 ilUtil::sendFailure($lng->txt("no_checkbox"), true);
331 $ilCtrl->redirect($this, "submissionScreen");
332 }
333 else
334 {
335 $this->tabs_gui->clearTargets();
336 $this->tabs_gui->setBackTarget($this->lng->txt("back"),
337 $this->ctrl->getLinkTarget($this, "submissionScreen"));
338
339 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
340 $cgui = new ilConfirmationGUI();
341 $cgui->setFormAction($ilCtrl->getFormAction($this));
342 $cgui->setHeaderText($lng->txt("info_delete_sure"));
343 $cgui->setCancel($lng->txt("cancel"), "submissionScreen");
344 $cgui->setConfirm($lng->txt("delete"), "deleteDelivered");
345
346 $files = $this->submission->getFiles();
347
348 foreach ($_POST["delivered"] as $i)
349 {
350 reset ($files);
351 $title = "";
352 foreach ($files as $f)
353 {
354 if ($f["returned_id"] == $i)
355 {
356 $title = $f["filetitle"];
357 }
358 }
359 $cgui->addItem("delivered[]", $i, $title);
360 }
361
362 $tpl->setContent($cgui->getHTML());
363 }
364 }
global $tpl
Definition: ilias.php:8
Confirmation screen class.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$_POST['username']
Definition: cron.php:12
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:40

References $_POST, $ilCtrl, $lng, $tpl, and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ deleteDeliveredObject()

ilExSubmissionFileGUI::deleteDeliveredObject ( )

Delete file(s) submitted by user.

Parameters

return

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

373 {
374 global $ilCtrl;
375
376 if (!$this->submission->canSubmit())
377 {
378 ilUtil::sendFailure($this->lng->txt("exercise_time_over"), true);
379 }
380 else if (!count($_POST["delivered"]))
381 {
382 ilUtil::sendFailure($this->lng->txt("please_select_a_delivered_file_to_delete"), true);
383 }
384 else
385 {
386 $this->submission->deleteSelectedFiles($_POST["delivered"]);
387 $this->handleRemovedUpload();
388
389 ilUtil::sendSuccess($this->lng->txt("exc_submitted_files_deleted"), true);
390 }
391 $ilCtrl->redirect($this, "submissionScreen");
392 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.

References $_POST, $ilCtrl, ilExSubmissionBaseGUI\handleRemovedUpload(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ downloadNewReturnedObject()

ilExSubmissionFileGUI::downloadNewReturnedObject ( )

Download newly submitted files of user.

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

419 {
420 $this->downloadReturnedObject(true);
421 }
downloadReturnedObject($a_only_new=false)
Download submitted files of user.

References downloadReturnedObject().

+ Here is the call graph for this function:

◆ downloadObject()

ilExSubmissionFileGUI::downloadObject ( )

User downloads (own) submitted files.

Parameters

return

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

430 {
431 global $ilCtrl;
432
433 if(!$this->submission->canView())
434 {
435 $this->returnToParentObject();
436 }
437
438 if (count($_REQUEST["delivered"]))
439 {
440 if(!is_array($_REQUEST["delivered"]))
441 {
442 $_REQUEST["delivered"] = array($_REQUEST["delivered"]);
443 }
444 $this->submission->downloadFiles($_REQUEST["delivered"]);
445 exit;
446 }
447 else
448 {
449 ilUtil::sendFailure($this->lng->txt("please_select_a_delivered_file_to_download"), true);
450 $ilCtrl->redirect($this, "submissionScreen");
451 }
452 }
exit
Definition: login.php:54
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7

References $_REQUEST, $ilCtrl, exit, ilExSubmissionBaseGUI\returnToParentObject(), and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ downloadReturnedObject()

ilExSubmissionFileGUI::downloadReturnedObject (   $a_only_new = false)

Download submitted files of user.

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

398 {
399 $peer_review_mask_filename = false;
400
401 if($this->submission->canView())
402 {
403 $peer_review_mask_filename = $this->submission->hasPeerReviewAccess();
404 }
405 else
406 {
407 // no access
408 return;
409 }
410
411 $this->submission->downloadFiles(null, $a_only_new, $peer_review_mask_filename);
412 $this->returnToParentObject();
413 }

References ilExSubmissionBaseGUI\returnToParentObject().

Referenced by downloadNewReturnedObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilExSubmissionFileGUI::executeCommand ( )

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

15 {
16 global $ilCtrl;
17
18 if(!$this->submission->canView())
19 {
20 $this->returnToParentObject();
21 }
22
23 $class = $ilCtrl->getNextClass($this);
24 $cmd = $ilCtrl->getCmd("submissionScreen");
25
26 switch($class)
27 {
28 default:
29 $this->{$cmd."Object"}();
30 break;
31 }
32 }
$cmd
Definition: sahs_server.php:35

References $cmd, $ilCtrl, 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 34 of file class.ilExSubmissionFileGUI.php.

35 {
36 global $lng, $ilCtrl;
37
38 $titles = array();
39 foreach($a_submission->getFiles() as $file)
40 {
41 $titles[] = $file["filetitle"];
42 }
43 $files_str = implode($titles, ", ");
44 if ($files_str == "")
45 {
46 $files_str = $lng->txt("message_no_delivered_files");
47 }
48
49 // no team == no submission
50 if(!$a_submission->hasNoTeamYet())
51 {
52 if ($a_submission->canSubmit())
53 {
54 $title = (count($titles) == 0
55 ? $lng->txt("exc_hand_in")
56 : $lng->txt("exc_edit_submission"));
57
58 $button = ilLinkButton::getInstance();
59 $button->setPrimary(true);
60 $button->setCaption($title, false);
61 $button->setUrl($ilCtrl->getLinkTargetByClass(array("ilExSubmissionGUI", "ilExSubmissionFileGUI"), "submissionScreen"));
62 $files_str.= " ".$button->render();
63 }
64 else
65 {
66 if (count($titles) > 0)
67 {
68 $button = ilLinkButton::getInstance();
69 $button->setCaption("already_delivered_files");
70 $button->setUrl($ilCtrl->getLinkTargetByClass(array("ilExSubmissionGUI", "ilExSubmissionFileGUI"), "submissionScreen"));
71 $files_str.= " ".$button->render();
72 }
73 }
74 }
75
76 $a_info->addProperty($lng->txt("exc_files_returned"), $files_str);
77 }
print $file
getFiles(array $a_file_ids=null, $a_only_valid=false, $a_min_timestamp=null)
addProperty($a_name, $a_value, $a_link="")
add a property to current section
static getInstance()
Factory.

References $file, $ilCtrl, $lng, ilInfoScreenGUI\addProperty(), ilExSubmission\canSubmit(), ilExSubmission\getFiles(), ilLinkButton\getInstance(), and ilExSubmission\hasNoTeamYet().

+ Here is the call graph for this function:

◆ initUploadForm()

ilExSubmissionFileGUI::initUploadForm ( )
protected

Init upload form form.

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

186 {
187 global $lng, $ilCtrl;
188
189 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
190 $form = new ilPropertyFormGUI();
191
192 // file input
193 include_once("./Services/Form/classes/class.ilFileWizardInputGUI.php");
194 $fi = new ilFileWizardInputGUI($lng->txt("file"), "deliver");
195 $fi->setFilenames(array(0 => ''));
196 $fi->setRequired(true);
197 $form->addItem($fi);
198
199 $form->addCommandButton("uploadFile", $lng->txt("upload"));
200 $form->addCommandButton("submissionScreen", $lng->txt("cancel"));
201
202 $form->setTitle($lng->txt("file_add"));
203 $form->setFormAction($ilCtrl->getFormAction($this, "uploadFile"));
204 return $form;
205 }
This class represents a file wizard property in a property form.
This class represents a property form user interface.

References $ilCtrl, and $lng.

Referenced by uploadFileObject(), and uploadFormObject().

+ Here is the caller graph for this function:

◆ initZipUploadForm()

ilExSubmissionFileGUI::initZipUploadForm ( )
protected

Init upload form form.

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

211 {
212 global $lng, $ilCtrl;
213
214 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
215 $form = new ilPropertyFormGUI();
216
217 include_once("./Services/Form/classes/class.ilFileInputGUI.php");
218 $fi = new ilFileInputGUI($lng->txt("file"), "deliver");
219 $fi->setRequired(true);
220 $fi->setSuffixes(array("zip"));
221 $form->addItem($fi);
222
223 $form->addCommandButton("uploadZip", $lng->txt("upload"));
224 $form->addCommandButton("submissionScreen", $lng->txt("cancel"));
225
226 $form->setTitle($lng->txt("header_zip"));
227 $form->setFormAction($ilCtrl->getFormAction($this, "uploadZip"));
228
229 return $form;
230 }
This class represents a file property in a property form.

References $ilCtrl, and $lng.

Referenced by uploadZipFormObject(), and uploadZipObject().

+ Here is the caller graph for this function:

◆ submissionScreenObject()

ilExSubmissionFileGUI::submissionScreenObject ( )

Displays a form which allows members to deliver their solutions.

@access public

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

85 {
86 global $ilToolbar, $ilHelp;
87
88
89 $this->handleTabs();
90
91 $ilHelp->setScreenIdComponent("exc");
92 $ilHelp->setScreenId("submissions");
93
94 if (!$this->submission->canSubmit())
95 {
96 ilUtil::sendInfo($this->lng->txt("exercise_time_over"));
97 }
98 else
99 {
100 $max_files = $this->submission->getAssignment()->getMaxFile();
101
102 if($this->submission->canAddFile())
103 {
104 $ilToolbar->addButton($this->lng->txt("file_add"),
105 $this->ctrl->getLinkTarget($this, "uploadForm"));
106
107 if(!$max_files ||
108 $max_files > 1)
109 {
110 $ilToolbar->addButton($this->lng->txt("header_zip"),
111 $this->ctrl->getLinkTarget($this, "uploadZipForm"));
112 }
113
114 // #15883 - extended deadline warning
115 if($this->assignment->getDeadline() &&
116 time() > $this->assignment->getDeadline())
117 {
118 $dl = ilDatePresentation::formatDate(new ilDateTime($this->assignment->getDeadline(),IL_CAL_UNIX));
119 $dl = sprintf($this->lng->txt("exc_late_submission_warning"), $dl);
120 $dl = '<span class="warning">'.$dl.'</span>';
121 $ilToolbar->addText($dl);
122 }
123 }
124
125 if($max_files)
126 {
127 ilUtil::sendInfo(sprintf($this->lng->txt("exc_max_file_reached"), $max_files));
128 }
129 }
130
131 include_once("./Modules/Exercise/classes/class.ilExcDeliveredFilesTableGUI.php");
132 $tab = new ilExcDeliveredFilesTableGUI($this, "submissionScreen", $this->submission);
133 $this->tpl->setContent($tab->getHTML());
134 }
const IL_CAL_UNIX
static formatDate(ilDateTime $date)
Format a date @access public.
@classDescription Date and time handling
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.

References $tab, ilDatePresentation\formatDate(), ilExSubmissionBaseGUI\handleTabs(), IL_CAL_UNIX, and ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ uploadFileObject()

ilExSubmissionFileGUI::uploadFileObject ( )

Upload files.

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

236 {
237 global $ilCtrl;
238
239 // #15322
240 if (!$this->submission->canSubmit())
241 {
242 ilUtil::sendInfo($this->lng->txt("exercise_time_over"), true);
243 }
244 else
245 {
246 $form = $this->initUploadForm();
247 if(!$form->checkInput())
248 {
249 return $this->uploadFormObject($form);
250 }
251
252 $success = false;
253 foreach ($_FILES["deliver"]["name"] as $k => $v)
254 {
255 $file = array(
256 "name" => $_FILES["deliver"]["name"][$k],
257 "type" => $_FILES["deliver"]["type"][$k],
258 "tmp_name" => $_FILES["deliver"]["tmp_name"][$k],
259 "error" => $_FILES["deliver"]["error"][$k],
260 "size" => $_FILES["deliver"]["size"][$k],
261 );
262 if(!$this->submission->uploadFile($file))
263 {
264 ilUtil::sendFailure($this->lng->txt("exc_upload_error"), true);
265 }
266 else
267 {
268 $success = true;
269 }
270 }
271
272 if($success)
273 {
274 ilUtil::sendSuccess($this->lng->txt("file_added"), true);
275 $this->handleNewUpload();
276 }
277 }
278
279 $ilCtrl->redirect($this, "submissionScreen");
280 }
$success
Definition: Utf8Test.php:87
handleNewUpload($a_no_notifications=false)
initUploadForm()
Init upload form form.
uploadFormObject(ilPropertyFormGUI $a_form=null)
Display form for single file upload.

References $file, $ilCtrl, $success, ilExSubmissionBaseGUI\handleNewUpload(), initUploadForm(), ilUtil\sendFailure(), ilUtil\sendInfo(), ilUtil\sendSuccess(), and uploadFormObject().

+ Here is the call graph for this function:

◆ uploadFormObject()

ilExSubmissionFileGUI::uploadFormObject ( ilPropertyFormGUI  $a_form = null)

Display form for single file upload.

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

140 {
141 if (!$this->submission->canSubmit())
142 {
143 $this->ctrl->redirect($this, "submissionScreen");
144 }
145
146 $this->tabs_gui->clearTargets();
147 $this->tabs_gui->setBackTarget($this->lng->txt("back"),
148 $this->ctrl->getLinkTarget($this, "submissionScreen"));
149
150 global $ilHelp;
151 $ilHelp->setScreenIdComponent("exc");
152 $ilHelp->setScreenId("upload_submission");
153
154 if(!$a_form)
155 {
156 $a_form = $this->initUploadForm();
157 }
158 $this->tpl->setContent($a_form->getHTML());
159 }

References initUploadForm().

Referenced by uploadFileObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ uploadZipFormObject()

ilExSubmissionFileGUI::uploadZipFormObject ( ilPropertyFormGUI  $a_form = null)

Display form for zip file upload.

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

165 {
166 if (!$this->submission->canSubmit())
167 {
168 $this->ctrl->redirect($this, "submissionScreen");
169 }
170
171 $this->tabs_gui->clearTargets();
172 $this->tabs_gui->setBackTarget($this->lng->txt("back"),
173 $this->ctrl->getLinkTarget($this, "submissionScreen"));
174
175 if(!$a_form)
176 {
177 $a_form = $this->initZipUploadForm();
178 }
179 $this->tpl->setContent($a_form->getHTML());
180 }
initZipUploadForm()
Init upload form form.

References initZipUploadForm().

Referenced by uploadZipObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ uploadZipObject()

ilExSubmissionFileGUI::uploadZipObject ( )

Upload zip file.

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

286 {
287 global $ilCtrl;
288
289 // #15322
290 if (!$this->submission->canSubmit())
291 {
292 ilUtil::sendInfo($this->lng->txt("exercise_time_over"), true);
293 }
294 else
295 {
296 $form = $this->initZipUploadForm();
297 if(!$form->checkInput())
298 {
299 return $this->uploadZipFormObject($form);
300 }
301
302 if (preg_match("/zip/",$_FILES["deliver"]["type"]) == 1)
303 {
304 if($this->submission->processUploadedZipFile($_FILES["deliver"]["tmp_name"]))
305 {
306 ilUtil::sendSuccess($this->lng->txt("file_added"), true);
307 $this->handleNewUpload();
308 }
309 }
310 }
311
312 $ilCtrl->redirect($this, "submissionScreen");
313 }
uploadZipFormObject(ilPropertyFormGUI $a_form=null)
Display form for zip file upload.

References $ilCtrl, ilExSubmissionBaseGUI\handleNewUpload(), initZipUploadForm(), ilUtil\sendInfo(), ilUtil\sendSuccess(), and uploadZipFormObject().

+ Here is the call graph for this function:

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