41 parent::__construct($a_exercise, $a_submission);
43 $this->toolbar = $DIC->toolbar();
44 $this->help = $DIC[
"ilHelp"];
45 $this->
user = $DIC->user();
47 $this->ui = $DIC->ui();
54 if (!$this->submission->canView()) {
58 $class =
$ilCtrl->getNextClass($this);
59 $cmd =
$ilCtrl->getCmd(
"submissionScreen");
63 $this->{$cmd .
"Object"}();
72 $lng = $DIC->language();
76 foreach ($a_submission->
getFiles() as $file) {
77 $titles[] = $file[
"filetitle"];
79 $files_str = implode($titles,
"<br>");
80 if ($files_str ==
"") {
81 $files_str =
$lng->txt(
"message_no_delivered_files");
87 $title = (count($titles) == 0
88 ?
$lng->txt(
"exc_hand_in")
89 :
$lng->txt(
"exc_edit_submission"));
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();
97 if (count($titles) > 0) {
99 $button->setCaption(
"already_delivered_files");
100 $button->setUrl(
$ilCtrl->getLinkTargetByClass(array(
"ilExSubmissionGUI",
"ilExSubmissionFileGUI"),
"submissionScreen"));
101 $files_str .=
"<br><br>" . $button->render();
123 $ilHelp->setScreenIdComponent(
"exc");
124 $ilHelp->setScreenId(
"submissions");
126 if (!$this->submission->canSubmit()) {
129 $max_files = $this->submission->getAssignment()->getMaxFile();
131 if ($this->submission->canAddFile()) {
133 $deadline = $this->assignment->getPersonalDeadline(
$ilUser->getId());
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);
142 $b = $this->ui->factory()->button()->standard(
143 $this->lng->txt(
"file_add"),
144 $this->ctrl->getLinkTarget($this,
"uploadForm")
146 $ilToolbar->addStickyItem($b);
150 $ilToolbar->addButton(
151 $this->lng->txt(
"header_zip"),
152 $this->ctrl->getLinkTarget($this,
"uploadZipForm")
158 ilUtil::sendInfo(sprintf($this->lng->txt(
"exc_max_file_reached"), $max_files));
162 include_once(
"./Modules/Exercise/classes/class.ilExcDeliveredFilesTableGUI.php");
164 $this->tpl->setContent(
$tab->getHTML());
172 if (!$this->submission->canSubmit()) {
173 $this->ctrl->redirect($this,
"submissionScreen");
176 $this->tabs_gui->clearTargets();
177 $this->tabs_gui->setBackTarget(
178 $this->lng->txt(
"back"),
179 $this->ctrl->getLinkTarget($this,
"submissionScreen")
183 $ilHelp->setScreenIdComponent(
"exc");
184 $ilHelp->setScreenId(
"upload_submission");
189 $this->tpl->setContent($a_form->getHTML());
197 if (!$this->submission->canSubmit()) {
198 $this->ctrl->redirect($this,
"submissionScreen");
201 $this->tabs_gui->clearTargets();
202 $this->tabs_gui->setBackTarget(
203 $this->lng->txt(
"back"),
204 $this->ctrl->getLinkTarget($this,
"submissionScreen")
210 $this->tpl->setContent($a_form->getHTML());
221 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
225 include_once(
"./Services/Form/classes/class.ilFileWizardInputGUI.php");
228 $fi->setRequired(
true);
231 $form->addCommandButton(
"uploadFile",
$lng->txt(
"upload"));
232 $form->addCommandButton(
"submissionScreen",
$lng->txt(
"cancel"));
235 $form->setFormAction(
$ilCtrl->getFormAction($this,
"uploadFile"));
248 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
251 include_once(
"./Services/Form/classes/class.ilFileInputGUI.php");
254 $fi->setRequired(
true);
257 $form->addCommandButton(
"uploadZip",
$lng->txt(
"upload"));
258 $form->addCommandButton(
"submissionScreen",
$lng->txt(
"cancel"));
260 $form->setTitle(
$lng->txt(
"header_zip"));
261 $form->setFormAction(
$ilCtrl->getFormAction($this,
"uploadZip"));
274 if (!$this->submission->canSubmit()) {
278 if (!
$form->checkInput()) {
283 foreach ($_FILES[
"deliver"][
"name"] as $k => $v) {
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],
291 if (!$this->submission->uploadFile($file)) {
299 ilUtil::sendSuccess($this->lng->txt(
"file_added"),
true);
304 $ilCtrl->redirect($this,
"submissionScreen");
315 if (!$this->submission->canSubmit()) {
319 if (!
$form->checkInput()) {
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);
331 $ilCtrl->redirect($this,
"submissionScreen");
343 if (!$this->submission->canSubmit()) {
345 $ilCtrl->redirect($this,
"submissionScreen");
348 if (!is_array(
$_POST[
"delivered"]) || count(
$_POST[
"delivered"]) == 0) {
350 $ilCtrl->redirect($this,
"submissionScreen");
352 $this->tabs_gui->clearTargets();
353 $this->tabs_gui->setBackTarget(
354 $this->lng->txt(
"back"),
355 $this->ctrl->getLinkTarget($this,
"submissionScreen")
358 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
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");
365 $files = $this->submission->getFiles();
367 foreach (
$_POST[
"delivered"] as
$i) {
371 if ($f[
"returned_id"] == $i) {
375 $cgui->addItem(
"delivered[]", $i,
$title);
378 $tpl->setContent($cgui->getHTML());
392 if (!$this->submission->canSubmit()) {
394 } elseif (!count(
$_POST[
"delivered"])) {
397 $this->submission->deleteSelectedFiles(
$_POST[
"delivered"]);
400 ilUtil::sendSuccess($this->lng->txt(
"exc_submitted_files_deleted"),
true);
402 $ilCtrl->redirect($this,
"submissionScreen");
412 $peer_review_mask_filename =
false;
414 if ($this->submission->canView()) {
415 $peer_review_mask_filename = $this->submission->hasPeerReviewAccess();
421 $this->submission->downloadFiles(null, $a_only_new, $peer_review_mask_filename);
447 $delivered_id = $_REQUEST[
"delivered"];
449 if (!$this->submission->canView()) {
453 if (!is_array($delivered_id) && $delivered_id > 0) {
454 $delivered_id = [$delivered_id];
456 if (is_array($delivered_id) && count($delivered_id) > 0) {
457 $this->submission->downloadFiles($delivered_id);
461 $ilCtrl->redirect($this,
"submissionScreen");
submissionScreenObject()
Displays a form which allows members to deliver their solutions.
downloadReturnedObject($a_only_new=false)
Download submitted files of user.
uploadZipObject()
Upload zip file.
downloadNewReturnedObject()
Download newly submitted files of user.
Exercise submission base gui.
uploadFormObject(ilPropertyFormGUI $a_form=null)
Display form for single file upload.
static getOverviewContent(ilInfoScreenGUI $a_info, ilExSubmission $a_submission)
__construct(ilObjExercise $a_exercise, ilExSubmission $a_submission)
Constructor.
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.
downloadObject()
User downloads (own) submitted files.
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.
uploadFileObject()
Upload files.
confirmDeleteDeliveredObject()
Confirm deletion of delivered files.
addProperty($a_name, $a_value, $a_link="")
add a property to current section
Exercise submission //TODO: This class has to much static methods related to delivered "files"...
uploadZipFormObject(ilPropertyFormGUI $a_form=null)
Display form for zip file upload.
getFiles(array $a_file_ids=null, $a_only_valid=false, $a_min_timestamp=null)
Get submission items (not only files)
Confirmation screen class.
initZipUploadForm()
Init upload form form.
deleteDeliveredObject()
Delete file(s) submitted by user.