ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 320 of file class.ilExSubmissionFileGUI.php.

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

References $_POST, $files, $ilCtrl, $lng, $title, $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 374 of file class.ilExSubmissionFileGUI.php.

375 {
376 global $ilCtrl;
377
378 if (!$this->submission->canSubmit())
379 {
380 ilUtil::sendFailure($this->lng->txt("exercise_time_over"), true);
381 }
382 else if (!count($_POST["delivered"]))
383 {
384 ilUtil::sendFailure($this->lng->txt("please_select_a_delivered_file_to_delete"), true);
385 }
386 else
387 {
388 $this->submission->deleteSelectedFiles($_POST["delivered"]);
389 $this->handleRemovedUpload();
390
391 ilUtil::sendSuccess($this->lng->txt("exc_submitted_files_deleted"), true);
392 }
393 $ilCtrl->redirect($this, "submissionScreen");
394 }
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 420 of file class.ilExSubmissionFileGUI.php.

421 {
422 $this->downloadReturnedObject(true);
423 }
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 431 of file class.ilExSubmissionFileGUI.php.

432 {
433 global $ilCtrl;
434
435 if(!$this->submission->canView())
436 {
437 $this->returnToParentObject();
438 }
439
440 if (count($_REQUEST["delivered"]))
441 {
442 if(!is_array($_REQUEST["delivered"]))
443 {
444 $_REQUEST["delivered"] = array($_REQUEST["delivered"]);
445 }
446 $this->submission->downloadFiles($_REQUEST["delivered"]);
447 exit;
448 }
449 else
450 {
451 ilUtil::sendFailure($this->lng->txt("please_select_a_delivered_file_to_download"), true);
452 $ilCtrl->redirect($this, "submissionScreen");
453 }
454 }

References $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 399 of file class.ilExSubmissionFileGUI.php.

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

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 }
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.
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file

References $file, $ilCtrl, $lng, $title, 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 186 of file class.ilExSubmissionFileGUI.php.

187 {
188 global $lng, $ilCtrl;
189
190 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
191 $form = new ilPropertyFormGUI();
192
193 // file input
194 include_once("./Services/Form/classes/class.ilFileWizardInputGUI.php");
195 $fi = new ilFileWizardInputGUI($lng->txt("file"), "deliver");
196 $fi->setFilenames(array(0 => ''));
197 $fi->setRequired(true);
198 $form->addItem($fi);
199
200 $form->addCommandButton("uploadFile", $lng->txt("upload"));
201 $form->addCommandButton("submissionScreen", $lng->txt("cancel"));
202
203 $form->setTitle($lng->txt("file_add"));
204 $form->setFormAction($ilCtrl->getFormAction($this, "uploadFile"));
205
206 return $form;
207 }
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 212 of file class.ilExSubmissionFileGUI.php.

213 {
214 global $lng, $ilCtrl;
215
216 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
217 $form = new ilPropertyFormGUI();
218
219 include_once("./Services/Form/classes/class.ilFileInputGUI.php");
220 $fi = new ilFileInputGUI($lng->txt("file"), "deliver");
221 $fi->setSuffixes(array("zip"));
222 $fi->setRequired(true);
223 $form->addItem($fi);
224
225 $form->addCommandButton("uploadZip", $lng->txt("upload"));
226 $form->addCommandButton("submissionScreen", $lng->txt("cancel"));
227
228 $form->setTitle($lng->txt("header_zip"));
229 $form->setFormAction($ilCtrl->getFormAction($this, "uploadZip"));
230
231 return $form;
232 }
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, $ilUser;
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 // #15883 - extended deadline warning
105 $deadline = $this->assignment->getPersonalDeadline($ilUser->getId());
106 if($deadline &&
107 time() > $deadline)
108 {
110 $dl = sprintf($this->lng->txt("exc_late_submission_warning"), $dl);
111 $dl = '<span class="warning">'.$dl.'</span>';
112 $ilToolbar->addText($dl);
113 }
114
115 $ilToolbar->addButton($this->lng->txt("file_add"),
116 $this->ctrl->getLinkTarget($this, "uploadForm"));
117
118 if(!$max_files ||
119 $max_files > 1)
120 {
121 $ilToolbar->addButton($this->lng->txt("header_zip"),
122 $this->ctrl->getLinkTarget($this, "uploadZipForm"));
123 }
124 }
125
126 if($max_files)
127 {
128 ilUtil::sendInfo(sprintf($this->lng->txt("exc_max_file_reached"), $max_files));
129 }
130 }
131
132 include_once("./Modules/Exercise/classes/class.ilExcDeliveredFilesTableGUI.php");
133 $tab = new ilExcDeliveredFilesTableGUI($this, "submissionScreen", $this->submission);
134 $this->tpl->setContent($tab->getHTML());
135 }
sprintf('%.4f', $callTime)
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.
$ilUser
Definition: imgupload.php:18

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

+ Here is the call graph for this function:

◆ uploadFileObject()

ilExSubmissionFileGUI::uploadFileObject ( )

Upload files.

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

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

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

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 165 of file class.ilExSubmissionFileGUI.php.

166 {
167 if (!$this->submission->canSubmit())
168 {
169 $this->ctrl->redirect($this, "submissionScreen");
170 }
171
172 $this->tabs_gui->clearTargets();
173 $this->tabs_gui->setBackTarget($this->lng->txt("back"),
174 $this->ctrl->getLinkTarget($this, "submissionScreen"));
175
176 if(!$a_form)
177 {
178 $a_form = $this->initZipUploadForm();
179 }
180 $this->tpl->setContent($a_form->getHTML());
181 }
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 287 of file class.ilExSubmissionFileGUI.php.

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