ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
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 ()
 
 triggerAssignmentTool ()
 Trigger assigment tool. More...
 

Protected Attributes

 $toolbar
 
 $help
 
 $user
 
 $ui
 
- Protected Attributes inherited from ilExSubmissionBaseGUI
 $ctrl
 
 $tabs_gui
 
 $lng
 
 $tpl
 
 $exercise
 
 $submission
 
 $assignment
 
 $mandatory_manager
 
 $tool_context
 
 $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, ILIAS\GlobalScreen\Provider\__construct(), help(), ui(), 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  }
user()
Definition: user.php:4
help()
Definition: help.php:2
global $DIC
Definition: goto.php:24
ui()
Definition: ui.php:5
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ confirmDeleteDeliveredObject()

ilExSubmissionFileGUI::confirmDeleteDeliveredObject ( )

Confirm deletion of delivered files.

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

References $_POST, ilExSubmissionBaseGUI\$ctrl, Vendor\Package\$f, $i, ilExSubmissionBaseGUI\$lng, ilExSubmissionBaseGUI\$tpl, and ilUtil\sendFailure().

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

◆ deleteDeliveredObject()

ilExSubmissionFileGUI::deleteDeliveredObject ( )

Delete file(s) submitted by user.

Parameters

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

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

385  {
386  $ilCtrl = $this->ctrl;
387 
388  if (!$this->submission->canSubmit()) {
389  ilUtil::sendFailure($this->lng->txt("exercise_time_over"), true);
390  } elseif (!count($_POST["delivered"])) {
391  ilUtil::sendFailure($this->lng->txt("please_select_a_delivered_file_to_delete"), true);
392  } else {
393  $this->submission->deleteSelectedFiles($_POST["delivered"]);
394  $this->handleRemovedUpload();
395 
396  ilUtil::sendSuccess($this->lng->txt("exc_submitted_files_deleted"), true);
397  }
398  $ilCtrl->redirect($this, "submissionScreen");
399  }
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 428 of file class.ilExSubmissionFileGUI.php.

References downloadReturnedObject().

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

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

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

◆ downloadReturnedObject()

ilExSubmissionFileGUI::downloadReturnedObject (   $a_only_new = false)

Download submitted files of user.

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

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

Referenced by downloadNewReturnedObject().

405  {
406  $lng = $this->lng;
407 
408  $peer_review_mask_filename = false;
409 
410  if ($this->submission->canView()) {
411  $peer_review_mask_filename = $this->submission->hasPeerReviewAccess();
412  } else {
413  // no access
414  return;
415  }
416 
417  $this->submission->downloadFiles(null, $a_only_new, $peer_review_mask_filename);
418  // we only get here, if no files have been found for download
419  if ($a_only_new) {
420  ilUtil::sendInfo($lng->txt("exc_all_new_files_offered_already"), true);
421  }
422  $this->returnToParentObject();
423  }
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, and ilExSubmissionBaseGUI\returnToParentObject().

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  }
+ 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, ilExSubmissionBaseGUI\$lng, 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[] = htmlentities($file["filetitle"]);
78  }
79  $files_str = implode("<br>", $titles);
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: goto.php:24
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 217 of file class.ilExSubmissionFileGUI.php.

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

Referenced by uploadFileObject(), and uploadFormObject().

218  {
219  $lng = $this->lng;
220  $ilCtrl = $this->ctrl;
221 
222  $form = new ilPropertyFormGUI();
223 
224  // file input
225  $fi = new ilFileWizardInputGUI($lng->txt("file"), "deliver");
226  $fi->setFilenames(array(0 => ''));
227  $fi->setRequired(true);
228  $form->addItem($fi);
229 
230  $form->addCommandButton("uploadFile", $lng->txt("upload"));
231  $form->addCommandButton("submissionScreen", $lng->txt("cancel"));
232 
233  $form->setTitle($lng->txt("file_add"));
234  $form->setFormAction($ilCtrl->getFormAction($this, "uploadFile"));
235 
236  return $form;
237  }
This class represents a property form user interface.
This class represents a file wizard property in a property 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 242 of file class.ilExSubmissionFileGUI.php.

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

Referenced by uploadZipFormObject(), and uploadZipObject().

243  {
244  $lng = $this->lng;
245  $ilCtrl = $this->ctrl;
246 
247  $form = new ilPropertyFormGUI();
248 
249  $fi = new ilFileInputGUI($lng->txt("file"), "deliver");
250  $fi->setSuffixes(array("zip"));
251  $fi->setRequired(true);
252  $form->addItem($fi);
253 
254  $form->addCommandButton("uploadZip", $lng->txt("upload"));
255  $form->addCommandButton("submissionScreen", $lng->txt("cancel"));
256 
257  $form->setTitle($lng->txt("header_zip"));
258  $form->setFormAction($ilCtrl->getFormAction($this, "uploadZip"));
259 
260  return $form;
261  }
This class represents a property form user interface.
This class represents a file property in a property 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 Vendor\Package\$b, $help, $ilUser, $toolbar, $user, ilDatePresentation\formatDate(), ilExSubmissionBaseGUI\handleTabs(), IL_CAL_UNIX, ilUtil\sendInfo(), ilExSubmissionBaseGUI\triggerAssignmentTool(), and ui().

115  {
116  $ilToolbar = $this->toolbar;
117  $ilHelp = $this->help;
119 
120 
121  $this->triggerAssignmentTool();
122 
123  $this->handleTabs();
124 
125  $ilHelp->setScreenIdComponent("exc");
126  $ilHelp->setScreenId("submissions");
127 
128  if (!$this->submission->canSubmit()) {
129  ilUtil::sendInfo($this->lng->txt("exercise_time_over"));
130  } else {
131  $max_files = $this->submission->getAssignment()->getMaxFile();
132 
133  if ($this->submission->canAddFile()) {
134  // #15883 - extended deadline warning
135  $deadline = $this->assignment->getPersonalDeadline($ilUser->getId());
136  if ($deadline &&
137  time() > $deadline) {
139  $dl = sprintf($this->lng->txt("exc_late_submission_warning"), $dl);
140  $dl = '<span class="warning">' . $dl . '</span>';
141  $ilToolbar->addText($dl);
142  }
143 
144  $b = $this->ui->factory()->button()->standard(
145  $this->lng->txt("file_add"),
146  $this->ctrl->getLinkTarget($this, "uploadForm")
147  );
148  $ilToolbar->addStickyItem($b);
149 
150  if (!$max_files ||
151  $max_files > 1) {
152  $ilToolbar->addButton(
153  $this->lng->txt("header_zip"),
154  $this->ctrl->getLinkTarget($this, "uploadZipForm")
155  );
156  }
157  }
158 
159  if ($max_files) {
160  ilUtil::sendInfo(sprintf($this->lng->txt("exc_max_file_reached"), $max_files));
161  }
162  }
163 
164  $tab = new ilExcDeliveredFilesTableGUI($this, "submissionScreen", $this->submission);
165  $this->tpl->setContent($tab->getHTML());
166  }
triggerAssignmentTool()
Trigger assigment tool.
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.
ui()
Definition: ui.php:5
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:

◆ uploadFileObject()

ilExSubmissionFileGUI::uploadFileObject ( )

Upload files.

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

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

267  {
268  $ilCtrl = $this->ctrl;
269 
270  // #15322
271  if (!$this->submission->canSubmit()) {
272  ilUtil::sendInfo($this->lng->txt("exercise_time_over"), true);
273  } else {
274  $form = $this->initUploadForm();
275  if (!$form->checkInput()) {
276  return $this->uploadFormObject($form);
277  }
278 
279  $success = false;
280  foreach ($_FILES["deliver"]["name"] as $k => $v) {
281  $file = array(
282  "name" => $_FILES["deliver"]["name"][$k],
283  "type" => $_FILES["deliver"]["type"][$k],
284  "tmp_name" => $_FILES["deliver"]["tmp_name"][$k],
285  "error" => $_FILES["deliver"]["error"][$k],
286  "size" => $_FILES["deliver"]["size"][$k],
287  );
288  if (!$this->submission->uploadFile($file)) {
289  ilUtil::sendFailure($this->lng->txt("exc_upload_error") . " [Single File]", true);
290  } else {
291  $success = true;
292  }
293  }
294 
295  if ($success) {
296  ilUtil::sendSuccess($this->lng->txt("file_added"), true);
297  $this->handleNewUpload();
298  }
299  }
300 
301  $ilCtrl->redirect($this, "submissionScreen");
302  }
uploadFormObject(ilPropertyFormGUI $a_form=null)
Display form for single file upload.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$success
Definition: Utf8Test.php:86
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 171 of file class.ilExSubmissionFileGUI.php.

References $help, and initUploadForm().

Referenced by uploadFileObject().

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

References initZipUploadForm().

Referenced by uploadZipObject().

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

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

308  {
309  $ilCtrl = $this->ctrl;
310 
311  // #15322
312  if (!$this->submission->canSubmit()) {
313  ilUtil::sendInfo($this->lng->txt("exercise_time_over"), true);
314  } else {
315  $form = $this->initZipUploadForm();
316  if (!$form->checkInput()) {
317  return $this->uploadZipFormObject($form);
318  }
319 
320  if (preg_match("/zip/", $_FILES["deliver"]["type"]) == 1) {
321  if ($this->submission->processUploadedZipFile($_FILES["deliver"]["tmp_name"])) {
322  ilUtil::sendSuccess($this->lng->txt("file_added"), true);
323  $this->handleNewUpload();
324  }
325  }
326  }
327 
328  $ilCtrl->redirect($this, "submissionScreen");
329  }
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:

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: