ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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)
 Constructor. More...
 
 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 ()
 

Protected Attributes

 $toolbar
 
 $help
 
 $user
 
 $ui
 
- Protected Attributes inherited from ilExSubmissionBaseGUI
 $ctrl
 
 $tabs_gui
 
 $lng
 
 $tpl
 
 $exercise
 
 $submission
 
 $assignment
 
 $type_guis
 

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.

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

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

References $DIC, and user().

38  {
39  global $DIC;
40 
41  parent::__construct($a_exercise, $a_submission);
42 
43  $this->toolbar = $DIC->toolbar();
44  $this->help = $DIC["ilHelp"];
45  $this->user = $DIC->user();
46 
47  $this->ui = $DIC->ui();
48  }
global $DIC
Definition: saml.php:7
user()
Definition: user.php:4
+ Here is the call graph for this function:

Member Function Documentation

◆ confirmDeleteDeliveredObject()

ilExSubmissionFileGUI::confirmDeleteDeliveredObject ( )

Confirm deletion of delivered files.

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

References $_POST, ilExSubmissionBaseGUI\$ctrl, $f, $files, $i, $ilCtrl, ilExSubmissionBaseGUI\$lng, $title, ilExSubmissionBaseGUI\$tpl, and ilUtil\sendFailure().

338  {
340  $tpl = $this->tpl;
341  $lng = $this->lng;
342 
343  if (!$this->submission->canSubmit()) {
344  ilUtil::sendFailure($this->lng->txt("exercise_time_over"), true);
345  $ilCtrl->redirect($this, "submissionScreen");
346  }
347 
348  if (!is_array($_POST["delivered"]) || count($_POST["delivered"]) == 0) {
349  ilUtil::sendFailure($lng->txt("no_checkbox"), true);
350  $ilCtrl->redirect($this, "submissionScreen");
351  } else {
352  $this->tabs_gui->clearTargets();
353  $this->tabs_gui->setBackTarget(
354  $this->lng->txt("back"),
355  $this->ctrl->getLinkTarget($this, "submissionScreen")
356  );
357 
358  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
359  $cgui = new ilConfirmationGUI();
360  $cgui->setFormAction($ilCtrl->getFormAction($this));
361  $cgui->setHeaderText($lng->txt("info_delete_sure"));
362  $cgui->setCancel($lng->txt("cancel"), "submissionScreen");
363  $cgui->setConfirm($lng->txt("delete"), "deleteDelivered");
364 
365  $files = $this->submission->getFiles();
366 
367  foreach ($_POST["delivered"] as $i) {
368  reset($files);
369  $title = "";
370  foreach ($files as $f) {
371  if ($f["returned_id"] == $i) {
372  $title = $f["filetitle"];
373  }
374  }
375  $cgui->addItem("delivered[]", $i, $title);
376  }
377 
378  $tpl->setContent($cgui->getHTML());
379  }
380  }
$files
Definition: metarefresh.php:49
global $ilCtrl
Definition: ilias.php:18
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$i
Definition: disco.tpl.php:19
$_POST["username"]
Confirmation screen class.
+ Here is the call graph for this function:

◆ deleteDeliveredObject()

ilExSubmissionFileGUI::deleteDeliveredObject ( )

Delete file(s) submitted by user.

Parameters

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

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

389  {
391 
392  if (!$this->submission->canSubmit()) {
393  ilUtil::sendFailure($this->lng->txt("exercise_time_over"), true);
394  } elseif (!count($_POST["delivered"])) {
395  ilUtil::sendFailure($this->lng->txt("please_select_a_delivered_file_to_delete"), true);
396  } else {
397  $this->submission->deleteSelectedFiles($_POST["delivered"]);
398  $this->handleRemovedUpload();
399 
400  ilUtil::sendSuccess($this->lng->txt("exc_submitted_files_deleted"), true);
401  }
402  $ilCtrl->redirect($this, "submissionScreen");
403  }
global $ilCtrl
Definition: ilias.php:18
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$_POST["username"]
+ Here is the call graph for this function:

◆ downloadNewReturnedObject()

ilExSubmissionFileGUI::downloadNewReturnedObject ( )

Download newly submitted files of user.

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

References downloadReturnedObject().

433  {
434  $this->downloadReturnedObject(true);
435  }
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 443 of file class.ilExSubmissionFileGUI.php.

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

444  {
446 
447  $delivered_id = $_REQUEST["delivered"];
448 
449  if (!$this->submission->canView()) {
450  $this->returnToParentObject();
451  }
452 
453  if (!is_array($delivered_id) && $delivered_id > 0) {
454  $delivered_id = [$delivered_id];
455  }
456  if (is_array($delivered_id) && count($delivered_id) > 0) {
457  $this->submission->downloadFiles($delivered_id);
458  exit;
459  } else {
460  ilUtil::sendFailure($this->lng->txt("please_select_a_delivered_file_to_download"), true);
461  $ilCtrl->redirect($this, "submissionScreen");
462  }
463  }
global $ilCtrl
Definition: ilias.php:18
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
exit
Definition: backend.php:16
+ Here is the call graph for this function:

◆ downloadReturnedObject()

ilExSubmissionFileGUI::downloadReturnedObject (   $a_only_new = false)

Download submitted files of user.

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

References ilExSubmissionBaseGUI\$lng, ilExSubmissionBaseGUI\returnToParentObject(), and ilUtil\sendInfo().

Referenced by downloadNewReturnedObject().

409  {
410  $lng = $this->lng;
411 
412  $peer_review_mask_filename = false;
413 
414  if ($this->submission->canView()) {
415  $peer_review_mask_filename = $this->submission->hasPeerReviewAccess();
416  } else {
417  // no access
418  return;
419  }
420 
421  $this->submission->downloadFiles(null, $a_only_new, $peer_review_mask_filename);
422  // we only get here, if no files have been found for download
423  if ($a_only_new) {
424  ilUtil::sendInfo($lng->txt("exc_all_new_files_offered_already"), true);
425  }
426  $this->returnToParentObject();
427  }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilExSubmissionFileGUI::executeCommand ( )

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

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

51  {
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  }
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 68 of file class.ilExSubmissionFileGUI.php.

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

69  {
70  global $DIC;
71 
72  $lng = $DIC->language();
73  $ilCtrl = $DIC->ctrl();
74 
75  $titles = array();
76  foreach ($a_submission->getFiles() as $file) {
77  $titles[] = $file["filetitle"];
78  }
79  $files_str = implode($titles, "<br>");
80  if ($files_str == "") {
81  $files_str = $lng->txt("message_no_delivered_files");
82  }
83 
84  // no team == no submission
85  if (!$a_submission->hasNoTeamYet()) {
86  if ($a_submission->canSubmit()) {
87  $title = (count($titles) == 0
88  ? $lng->txt("exc_hand_in")
89  : $lng->txt("exc_edit_submission"));
90 
91  $button = ilLinkButton::getInstance();
92  $button->setPrimary(true);
93  $button->setCaption($title, false);
94  $button->setUrl($ilCtrl->getLinkTargetByClass(array("ilExSubmissionGUI", "ilExSubmissionFileGUI"), "submissionScreen"));
95  $files_str .= "<br><br>" . $button->render();
96  } else {
97  if (count($titles) > 0) {
98  $button = ilLinkButton::getInstance();
99  $button->setCaption("already_delivered_files");
100  $button->setUrl($ilCtrl->getLinkTargetByClass(array("ilExSubmissionGUI", "ilExSubmissionFileGUI"), "submissionScreen"));
101  $files_str .= "<br><br>" . $button->render();
102  }
103  }
104  }
105 
106  $a_info->addProperty($lng->txt("exc_files_returned"), $files_str);
107  }
global $DIC
Definition: saml.php:7
global $ilCtrl
Definition: ilias.php:18
addProperty($a_name, $a_value, $a_link="")
add a property to current section
getFiles(array $a_file_ids=null, $a_only_valid=false, $a_min_timestamp=null)
Get submission items (not only files)
+ Here is the call graph for this function:

◆ initUploadForm()

ilExSubmissionFileGUI::initUploadForm ( )
protected

Init upload form form.

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

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

Referenced by uploadFileObject(), and uploadFormObject().

217  {
218  $lng = $this->lng;
220 
221  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
222  $form = new ilPropertyFormGUI();
223 
224  // file input
225  include_once("./Services/Form/classes/class.ilFileWizardInputGUI.php");
226  $fi = new ilFileWizardInputGUI($lng->txt("file"), "deliver");
227  $fi->setFilenames(array(0 => ''));
228  $fi->setRequired(true);
229  $form->addItem($fi);
230 
231  $form->addCommandButton("uploadFile", $lng->txt("upload"));
232  $form->addCommandButton("submissionScreen", $lng->txt("cancel"));
233 
234  $form->setTitle($lng->txt("file_add"));
235  $form->setFormAction($ilCtrl->getFormAction($this, "uploadFile"));
236 
237  return $form;
238  }
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
if(isset($_POST['submit'])) $form
setFilenames($a_filenames)
Set filenames.
+ 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 243 of file class.ilExSubmissionFileGUI.php.

References ilExSubmissionBaseGUI\$ctrl, $form, $ilCtrl, ilExSubmissionBaseGUI\$lng, and ilFileInputGUI\setSuffixes().

Referenced by uploadZipFormObject(), and uploadZipObject().

244  {
245  $lng = $this->lng;
247 
248  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
249  $form = new ilPropertyFormGUI();
250 
251  include_once("./Services/Form/classes/class.ilFileInputGUI.php");
252  $fi = new ilFileInputGUI($lng->txt("file"), "deliver");
253  $fi->setSuffixes(array("zip"));
254  $fi->setRequired(true);
255  $form->addItem($fi);
256 
257  $form->addCommandButton("uploadZip", $lng->txt("upload"));
258  $form->addCommandButton("submissionScreen", $lng->txt("cancel"));
259 
260  $form->setTitle($lng->txt("header_zip"));
261  $form->setFormAction($ilCtrl->getFormAction($this, "uploadZip"));
262 
263  return $form;
264  }
This class represents a property form user interface.
This class represents a file property in a property form.
global $ilCtrl
Definition: ilias.php:18
if(isset($_POST['submit'])) $form
setSuffixes($a_suffixes)
Set Accepted Suffixes.
+ 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 114 of file class.ilExSubmissionFileGUI.php.

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

115  {
116  $ilToolbar = $this->toolbar;
117  $ilHelp = $this->help;
119 
120 
121  $this->handleTabs();
122 
123  $ilHelp->setScreenIdComponent("exc");
124  $ilHelp->setScreenId("submissions");
125 
126  if (!$this->submission->canSubmit()) {
127  ilUtil::sendInfo($this->lng->txt("exercise_time_over"));
128  } else {
129  $max_files = $this->submission->getAssignment()->getMaxFile();
130 
131  if ($this->submission->canAddFile()) {
132  // #15883 - extended deadline warning
133  $deadline = $this->assignment->getPersonalDeadline($ilUser->getId());
134  if ($deadline &&
135  time() > $deadline) {
137  $dl = sprintf($this->lng->txt("exc_late_submission_warning"), $dl);
138  $dl = '<span class="warning">' . $dl . '</span>';
139  $ilToolbar->addText($dl);
140  }
141 
142  $b = $this->ui->factory()->button()->standard(
143  $this->lng->txt("file_add"),
144  $this->ctrl->getLinkTarget($this, "uploadForm")
145  );
146  $ilToolbar->addStickyItem($b);
147 
148  if (!$max_files ||
149  $max_files > 1) {
150  $ilToolbar->addButton(
151  $this->lng->txt("header_zip"),
152  $this->ctrl->getLinkTarget($this, "uploadZipForm")
153  );
154  }
155  }
156 
157  if ($max_files) {
158  ilUtil::sendInfo(sprintf($this->lng->txt("exc_max_file_reached"), $max_files));
159  }
160  }
161 
162  include_once("./Modules/Exercise/classes/class.ilExcDeliveredFilesTableGUI.php");
163  $tab = new ilExcDeliveredFilesTableGUI($this, "submissionScreen", $this->submission);
164  $this->tpl->setContent($tab->getHTML());
165  }
const IL_CAL_UNIX
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
Date and time handling
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:

◆ uploadFileObject()

ilExSubmissionFileGUI::uploadFileObject ( )

Upload files.

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

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

270  {
272 
273  // #15322
274  if (!$this->submission->canSubmit()) {
275  ilUtil::sendInfo($this->lng->txt("exercise_time_over"), true);
276  } else {
277  $form = $this->initUploadForm();
278  if (!$form->checkInput()) {
279  return $this->uploadFormObject($form);
280  }
281 
282  $success = false;
283  foreach ($_FILES["deliver"]["name"] as $k => $v) {
284  $file = array(
285  "name" => $_FILES["deliver"]["name"][$k],
286  "type" => $_FILES["deliver"]["type"][$k],
287  "tmp_name" => $_FILES["deliver"]["tmp_name"][$k],
288  "error" => $_FILES["deliver"]["error"][$k],
289  "size" => $_FILES["deliver"]["size"][$k],
290  );
291  if (!$this->submission->uploadFile($file)) {
292  ilUtil::sendFailure($this->lng->txt("exc_upload_error") . " [Single File]", true);
293  } else {
294  $success = true;
295  }
296  }
297 
298  if ($success) {
299  ilUtil::sendSuccess($this->lng->txt("file_added"), true);
300  $this->handleNewUpload();
301  }
302  }
303 
304  $ilCtrl->redirect($this, "submissionScreen");
305  }
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:86
handleNewUpload($a_no_notifications=false)
if(isset($_POST['submit'])) $form
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 170 of file class.ilExSubmissionFileGUI.php.

References $help, and initUploadForm().

Referenced by uploadFileObject().

171  {
172  if (!$this->submission->canSubmit()) {
173  $this->ctrl->redirect($this, "submissionScreen");
174  }
175 
176  $this->tabs_gui->clearTargets();
177  $this->tabs_gui->setBackTarget(
178  $this->lng->txt("back"),
179  $this->ctrl->getLinkTarget($this, "submissionScreen")
180  );
181 
182  $ilHelp = $this->help;
183  $ilHelp->setScreenIdComponent("exc");
184  $ilHelp->setScreenId("upload_submission");
185 
186  if (!$a_form) {
187  $a_form = $this->initUploadForm();
188  }
189  $this->tpl->setContent($a_form->getHTML());
190  }
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 195 of file class.ilExSubmissionFileGUI.php.

References initZipUploadForm().

Referenced by uploadZipObject().

196  {
197  if (!$this->submission->canSubmit()) {
198  $this->ctrl->redirect($this, "submissionScreen");
199  }
200 
201  $this->tabs_gui->clearTargets();
202  $this->tabs_gui->setBackTarget(
203  $this->lng->txt("back"),
204  $this->ctrl->getLinkTarget($this, "submissionScreen")
205  );
206 
207  if (!$a_form) {
208  $a_form = $this->initZipUploadForm();
209  }
210  $this->tpl->setContent($a_form->getHTML());
211  }
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 310 of file class.ilExSubmissionFileGUI.php.

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

311  {
313 
314  // #15322
315  if (!$this->submission->canSubmit()) {
316  ilUtil::sendInfo($this->lng->txt("exercise_time_over"), true);
317  } else {
318  $form = $this->initZipUploadForm();
319  if (!$form->checkInput()) {
320  return $this->uploadZipFormObject($form);
321  }
322 
323  if (preg_match("/zip/", $_FILES["deliver"]["type"]) == 1) {
324  if ($this->submission->processUploadedZipFile($_FILES["deliver"]["tmp_name"])) {
325  ilUtil::sendSuccess($this->lng->txt("file_added"), true);
326  $this->handleNewUpload();
327  }
328  }
329  }
330 
331  $ilCtrl->redirect($this, "submissionScreen");
332  }
global $ilCtrl
Definition: ilias.php:18
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
handleNewUpload($a_no_notifications=false)
if(isset($_POST['submit'])) $form
uploadZipFormObject(ilPropertyFormGUI $a_form=null)
Display form for zip file upload.
initZipUploadForm()
Init upload form form.
+ Here is the call graph for this function:

Field Documentation

◆ $help

ilExSubmissionFileGUI::$help
protected

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

Referenced by submissionScreenObject(), and uploadFormObject().

◆ $toolbar

ilExSubmissionFileGUI::$toolbar
protected

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

Referenced by submissionScreenObject().

◆ $ui

ilExSubmissionFileGUI::$ui
protected

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

◆ $user

ilExSubmissionFileGUI::$user
protected

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

Referenced by submissionScreenObject().


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