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[] = htmlentities($file[
"filetitle"]);
79 $files_str = implode(
"<br>", $titles);
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();
125 $ilHelp->setScreenIdComponent(
"exc");
126 $ilHelp->setScreenId(
"submissions");
128 if (!$this->submission->canSubmit()) {
131 $max_files = $this->submission->getAssignment()->getMaxFile();
133 if ($this->submission->canAddFile()) {
135 $deadline = $this->assignment->getPersonalDeadline(
$ilUser->getId());
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);
144 $b = $this->
ui->factory()->button()->standard(
145 $this->lng->txt(
"file_add"),
146 $this->ctrl->getLinkTarget($this,
"uploadForm")
148 $ilToolbar->addStickyItem(
$b);
152 $ilToolbar->addButton(
153 $this->lng->txt(
"header_zip"),
154 $this->ctrl->getLinkTarget($this,
"uploadZipForm")
160 ilUtil::sendInfo(sprintf($this->lng->txt(
"exc_max_file_reached"), $max_files));
165 $this->tpl->setContent(
$tab->getHTML());
173 if (!$this->submission->canSubmit()) {
174 $this->ctrl->redirect($this,
"submissionScreen");
177 $this->tabs_gui->clearTargets();
178 $this->tabs_gui->setBackTarget(
179 $this->lng->txt(
"back"),
180 $this->ctrl->getLinkTarget($this,
"submissionScreen")
184 $ilHelp->setScreenIdComponent(
"exc");
185 $ilHelp->setScreenId(
"upload_submission");
190 $this->tpl->setContent($a_form->getHTML());
198 if (!$this->submission->canSubmit()) {
199 $this->ctrl->redirect($this,
"submissionScreen");
202 $this->tabs_gui->clearTargets();
203 $this->tabs_gui->setBackTarget(
204 $this->lng->txt(
"back"),
205 $this->ctrl->getLinkTarget($this,
"submissionScreen")
211 $this->tpl->setContent($a_form->getHTML());
227 $fi->setRequired(
true);
230 $form->addCommandButton(
"uploadFile",
$lng->txt(
"upload"));
231 $form->addCommandButton(
"submissionScreen",
$lng->txt(
"cancel"));
233 $form->setTitle(
$lng->txt(
"file_add"));
234 $form->setFormAction(
$ilCtrl->getFormAction($this,
"uploadFile"));
251 $fi->setRequired(
true);
254 $form->addCommandButton(
"uploadZip",
$lng->txt(
"upload"));
255 $form->addCommandButton(
"submissionScreen",
$lng->txt(
"cancel"));
257 $form->setTitle(
$lng->txt(
"header_zip"));
258 $form->setFormAction(
$ilCtrl->getFormAction($this,
"uploadZip"));
271 if (!$this->submission->canSubmit()) {
275 if (!$form->checkInput()) {
280 foreach ($_FILES[
"deliver"][
"name"] as $k => $v) {
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],
288 if (!$this->submission->uploadFile($file)) {
296 ilUtil::sendSuccess($this->lng->txt(
"file_added"),
true);
301 $ilCtrl->redirect($this,
"submissionScreen");
312 if (!$this->submission->canSubmit()) {
316 if (!$form->checkInput()) {
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);
328 $ilCtrl->redirect($this,
"submissionScreen");
340 if (!$this->submission->canSubmit()) {
342 $ilCtrl->redirect($this,
"submissionScreen");
345 if (!is_array(
$_POST[
"delivered"]) || count(
$_POST[
"delivered"]) == 0) {
347 $ilCtrl->redirect($this,
"submissionScreen");
349 $this->tabs_gui->clearTargets();
350 $this->tabs_gui->setBackTarget(
351 $this->lng->txt(
"back"),
352 $this->ctrl->getLinkTarget($this,
"submissionScreen")
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");
361 $files = $this->submission->getFiles();
363 foreach (
$_POST[
"delivered"] as
$i) {
366 foreach ($files as
$f) {
367 if ($f[
"returned_id"] == $i) {
368 $title = $f[
"filetitle"];
371 $cgui->addItem(
"delivered[]", $i, $title);
374 $tpl->setContent($cgui->getHTML());
388 if (!$this->submission->canSubmit()) {
390 } elseif (!count(
$_POST[
"delivered"])) {
393 $this->submission->deleteSelectedFiles(
$_POST[
"delivered"]);
396 ilUtil::sendSuccess($this->lng->txt(
"exc_submitted_files_deleted"),
true);
398 $ilCtrl->redirect($this,
"submissionScreen");
408 $peer_review_mask_filename =
false;
410 if ($this->submission->canView()) {
411 $peer_review_mask_filename = $this->submission->hasPeerReviewAccess();
417 $this->submission->downloadFiles(null, $a_only_new, $peer_review_mask_filename);
443 $delivered_id = $_REQUEST[
"delivered"];
445 if (!$this->submission->canView()) {
449 if (!is_array($delivered_id) && $delivered_id > 0) {
450 $delivered_id = [$delivered_id];
452 if (is_array($delivered_id) && count($delivered_id) > 0) {
453 $this->submission->downloadFiles($delivered_id);
457 $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.
triggerAssignmentTool()
Trigger assigment tool.
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)
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
__construct(Container $dic, ilPlugin $plugin)
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.