ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5
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 Public Member Functions inherited from ilExSubmissionBaseGUI
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

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.

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

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  }
$_POST['username']
Definition: cron.php:12
global $tpl
Definition: ilias.php:8
global $ilCtrl
Definition: ilias.php:18
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
global $lng
Definition: privfeed.php:40
Confirmation screen class.
+ Here is the call graph for this function:

◆ deleteDeliveredObject()

ilExSubmissionFileGUI::deleteDeliveredObject ( )

Delete file(s) submitted by user.

Parameters

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

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

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.
$_POST['username']
Definition: cron.php:12
global $ilCtrl
Definition: ilias.php:18
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ 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.

References downloadReturnedObject().

419  {
420  $this->downloadReturnedObject(true);
421  }
downloadReturnedObject($a_only_new=false)
Download submitted files of user.
+ Here is the call graph for this function:

◆ downloadObject()

ilExSubmissionFileGUI::downloadObject ( )

User downloads (own) submitted files.

Parameters

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

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

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
global $ilCtrl
Definition: ilias.php:18
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ 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.

References ilExSubmissionBaseGUI\returnToParentObject().

Referenced by downloadNewReturnedObject().

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  }
+ 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.

References $cmd, $ilCtrl, and ilExSubmissionBaseGUI\returnToParentObject().

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
global $ilCtrl
Definition: ilias.php:18
+ Here is the call graph for this function:

◆ getOverviewContent()

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

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

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

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
global $ilCtrl
Definition: ilias.php:18
addProperty($a_name, $a_value, $a_link="")
add a property to current section
global $lng
Definition: privfeed.php:40
getFiles(array $a_file_ids=null, $a_only_valid=false, $a_min_timestamp=null)
+ 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.

References $ilCtrl, $lng, and ilFileWizardInputGUI\setFilenames().

Referenced by uploadFileObject(), and uploadFormObject().

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 property form user interface.
This class represents a file wizard property in a property form.
global $ilCtrl
Definition: ilias.php:18
setFilenames($a_filenames)
Set filenames.
global $lng
Definition: privfeed.php:40
+ Here is the call graph for this function:
+ 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.

References $ilCtrl, $lng, and ilFormPropertyGUI\setRequired().

Referenced by uploadZipFormObject(), and uploadZipObject().

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 property form user interface.
This class represents a file property in a property form.
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:40
setRequired($a_required)
Set Required.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ submissionScreenObject()

ilExSubmissionFileGUI::submissionScreenObject ( )

Displays a form which allows members to deliver their solutions.

public

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

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

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 sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static formatDate(ilDateTime $date)
Format a date public.
Date and time handling
+ Here is the call graph for this function:

◆ uploadFileObject()

ilExSubmissionFileGUI::uploadFileObject ( )

Upload files.

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

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

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  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
print $file
uploadFormObject(ilPropertyFormGUI $a_form=null)
Display form for single file upload.
global $ilCtrl
Definition: ilias.php:18
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$success
Definition: Utf8Test.php:87
handleNewUpload($a_no_notifications=false)
initUploadForm()
Init upload form form.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ 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.

References initUploadForm().

Referenced by uploadFileObject().

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  }
initUploadForm()
Init upload form form.
+ 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.

References initZipUploadForm().

Referenced by uploadZipObject().

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.
+ 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.

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

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  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
global $ilCtrl
Definition: ilias.php:18
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
handleNewUpload($a_no_notifications=false)
uploadZipFormObject(ilPropertyFormGUI $a_form=null)
Display form for zip file upload.
initZipUploadForm()
Init upload form form.
+ Here is the call graph for this function:

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