ILIAS  release_8 Revision v8.24
class.ilObjFileGUI.php
Go to the documentation of this file.
1<?php
25
37{
38 public const UPLOAD_MAX_FILES = 100;
39 public const PARAM_FILES = 0;
40
41 public const PARAM_UPLOAD_ORIGIN = 'origin';
42 public const UPLOAD_ORIGIN_STANDARD = 'standard';
43 public const UPLOAD_ORIGIN_DROPZONE = 'dropzone';
44
45 public const CMD_EDIT = "edit";
46 public const CMD_VERSIONS = "versions";
47 public const CMD_UPLOAD_FILES = "uploadFiles";
48
49 public ?ilObject $object = null;
51 protected UIServices $ui;
54 protected Services $storage;
55 protected ?ilLogger $log = null;
57 protected \ILIAS\Refinery\Factory $refinery;
58 protected \ILIAS\HTTP\Wrapper\WrapperFactory $http;
60
64 public function __construct(int $a_id = 0, int $a_id_type = self::REPOSITORY_NODE_ID, int $a_parent_node_id = 0)
65 {
66 global $DIC;
67 $this->http = $DIC->http()->wrapper();
68 $this->request = $DIC->http()->request();
69 $this->refinery = $DIC->refinery();
70 $this->file_service_settings = $DIC->fileServiceSettings();
71 $this->user = $DIC->user();
72 $this->lng = $DIC->language();
74 $this->ui = $DIC->ui();
75 $this->storage = $DIC->resourceStorage();
76 $this->upload_handler = new ilObjFileUploadHandlerGUI();
77 $this->stakeholder = new ilObjFileStakeholder();
78 parent::__construct($a_id, $a_id_type, $a_parent_node_id);
79 $this->obj_service = $DIC->object();
80 $this->lng->loadLanguageModule(ilObjFile::OBJECT_TYPE);
81 }
82
83 public function getType(): string
84 {
86 }
87
88 public function getParentId(): int
89 {
90 return $this->parent_id;
91 }
92
93 public function executeCommand(): void
94 {
95 global $DIC;
96 $ilNavigationHistory = $DIC['ilNavigationHistory'];
97 $ilCtrl = $DIC['ilCtrl'];
98 $ilUser = $DIC['ilUser'];
99 $ilTabs = $DIC['ilTabs'];
100 $ilErr = $DIC['ilErr'];
101
102 $next_class = $this->ctrl->getNextClass($this);
103 $cmd = $this->ctrl->getCmd();
104
105 if (!$this->getCreationMode()) {
106 if ($this->id_type == self::REPOSITORY_NODE_ID
107 && $this->checkPermissionBool("read")
108 ) {
109 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->node_id);
110 $link = $ilCtrl->getLinkTargetByClass("ilrepositorygui", "infoScreen");
111 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->ref_id);
112
113 // add entry to navigation history
114 $ilNavigationHistory->addItem(
115 $this->node_id,
116 $link,
118 );
119 }
120 }
121
122 $this->prepareOutput();
123
124 switch ($next_class) {
125 case "ilinfoscreengui":
126 $this->infoScreenForward(); // forwards command
127 break;
128
129 case 'ilobjectmetadatagui':
130 if (!$this->checkPermissionBool("write")) {
131 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
132 }
133
134 $ilTabs->activateTab("id_meta");
135
136 $md_gui = new ilObjectMetaDataGUI($this->object);
137
138 // todo: make this work
139 // $md_gui->addMDObserver($this->object,'MDUpdateListener','Technical');
140
141 $this->ctrl->forwardCommand($md_gui);
142 break;
143
144 // repository permissions
145 case 'ilpermissiongui':
146 $ilTabs->activateTab("id_permissions");
147 $perm_gui = new ilPermissionGUI($this);
148 $this->ctrl->forwardCommand($perm_gui);
149 break;
150
151 case "ilexportgui":
152 $ilTabs->activateTab("export");
153 $exp_gui = new ilExportGUI($this);
154 $exp_gui->addFormat("xml");
155 $this->ctrl->forwardCommand($exp_gui);
156 break;
157
158 case 'ilobjectcopygui':
159 $cp = new ilObjectCopyGUI($this);
160 $cp->setType(ilObjFile::OBJECT_TYPE);
161 $this->ctrl->forwardCommand($cp);
162 break;
163
164 // personal workspace permissions
165 case "ilworkspaceaccessgui":
166 $ilTabs->activateTab("id_permissions");
167 $wspacc = new ilWorkspaceAccessGUI($this->node_id, $this->getAccessHandler());
168 $this->ctrl->forwardCommand($wspacc);
169 break;
170
171 case "ilcommonactiondispatchergui":
173 $this->ctrl->forwardCommand($gui);
174 break;
175
176 case "illearningprogressgui":
177 $ilTabs->activateTab('learning_progress');
178 $user_id = $this->http->query()->has('user_id')
179 ? $this->http->query()->retrieve('user_id', $this->refinery->kindlyTo()->int())
180 : $ilUser->getId();
181 $new_gui = new ilLearningProgressGUI(
183 $this->object->getRefId(),
184 $user_id
185 );
186 $this->ctrl->forwardCommand($new_gui);
187 $this->tabs_gui->setTabActive('learning_progress');
188 break;
189 case strtolower(ilFileVersionsGUI::class):
190 $this->tabs_gui->activateTab("id_versions");
191
192 if (!$this->checkPermissionBool("write")) {
193 $this->error->raiseError($this->lng->txt("permission_denied"), $this->error->MESSAGE);
194 }
196 $obj = $this->object;
197 $this->ctrl->forwardCommand(new ilFileVersionsGUI($obj));
198 break;
199 case strtolower(ilObjFileUploadHandlerGUI::class):
200 $this->ctrl->forwardCommand(new ilObjFileUploadHandlerGUI());
201 break;
202
203 default:
204 // in personal workspace use object2gui
205 if ($this->id_type === self::WORKSPACE_NODE_ID) {
206 $this->addHeaderAction();
207
208 // coming from goto we need default command
209 if (empty($cmd)) {
210 $ilCtrl->setCmd("infoScreen");
211 }
212 $ilTabs->clearTargets();
213
214 parent::executeCommand();
215 }
216
217 if (empty($cmd) || $cmd === 'render') {
218 $cmd = "infoScreen";
219 }
220
221 $this->$cmd();
222 break;
223 }
224
225 $this->addHeaderAction();
226 }
227
232 protected function render(): void
233 {
234 $this->infoScreen();
235 }
236
237 protected function addUIFormToAccordion(ilAccordionGUI $accordion, Standard $form, int $form_type): void
238 {
239 // abort if form-type is unknown
240 if (!in_array($form_type, [self::CFORM_NEW, self::CFORM_CLONE, self::CFORM_IMPORT], true)) {
241 return;
242 }
243
244 $inputs = $form->getInputs();
245 // use label of first input as title, because UI Component forms don't support form-titles yet
246 $title = (!empty($inputs)) ?
247 $inputs[array_key_first($inputs)]->getLabel() : '';
248
249 $tpl = new ilTemplate("tpl.creation_acc_head.html", true, true, "Services/Object");
250 $tpl->setVariable("TITLE", $this->lng->txt("option") . " " . $form_type . ": " . $title);
251
252 $accordion->addItem($tpl->get(), $this->ui->renderer()->render($form));
253 }
254
255 protected function addLegacyFormToAccordion(
256 ilAccordionGUI $accordion,
257 ilPropertyFormGUI $form,
258 int $form_type
259 ): void {
260 // abort if form-type is unknown
261 if (!in_array($form_type, [self::CFORM_NEW, self::CFORM_CLONE, self::CFORM_IMPORT], true)) {
262 return;
263 }
264
265 // see bug #0016217
266 if (method_exists($this, "getCreationFormTitle")) {
267 if (!empty(($title = $this->getCreationFormTitle($form_type)))) {
268 $form->setTitle($title);
269 }
270 }
271
272 $tpl = new ilTemplate("tpl.creation_acc_head.html", true, true, "Services/Object");
273 $tpl->setVariable("TITLE", $this->lng->txt("option") . " " . $form_type . ": " . $form->getTitle());
274
275 $accordion->addItem($tpl->get(), $form->getHTML());
276 }
277
278 protected function getCreationFormsHTML(array $a_forms): string
279 {
280 // abort if empty array was passed
281 if (empty($a_forms)) {
282 return '';
283 }
284
285 if (1 === count($a_forms)) {
286 $creation_form = end($a_forms);
287 if ($creation_form instanceof Standard) {
288 return $this->ui->renderer()->render($creation_form);
289 }
290
291 if ($creation_form instanceof ilPropertyFormGUI) {
292 return $creation_form->getHTML();
293 }
294 }
295
296 $accordion = new ilAccordionGUI();
297 $accordion->setBehaviour(ilAccordionGUI::FIRST_OPEN);
298
299 foreach ($a_forms as $type => $form) {
300 if ($form instanceof Standard) {
301 $this->addUIFormToAccordion($accordion, $form, $type);
302 }
303
304 if ($form instanceof ilPropertyFormGUI) {
305 $this->addLegacyFormToAccordion($accordion, $form, $type);
306 }
307 }
308
309 return "<div class='ilCreationFormSection'>{$accordion->getHTML()}</div>";
310 }
311
315 protected function initCreationForms($a_new_type): array
316 {
317 $forms[self::CFORM_NEW] = $this->initUploadForm();
318
319 // repository only
320 if ($this->id_type !== self::WORKSPACE_NODE_ID) {
321 $forms[self::CFORM_IMPORT] = $this->initImportForm(ilObjFile::OBJECT_TYPE);
322 $forms[self::CFORM_CLONE] = $this->fillCloneTemplate(null, ilObjFile::OBJECT_TYPE);
323 }
324
325 return $forms;
326 }
327
328 public function initUploadForm(): Standard
329 {
330 $this->ctrl->setParameterByClass(self::class, 'new_type', $this->getType());
331 $this->ctrl->setParameterByClass(
332 self::class,
333 self::PARAM_UPLOAD_ORIGIN,
334 self::UPLOAD_ORIGIN_STANDARD
335 );
336
337 return $this->ui->factory()->input()->container()->form()->standard(
338 $this->ctrl->getFormActionByClass(self::class, self::CMD_UPLOAD_FILES),
339 [
340 self::PARAM_FILES => $this->ui->factory()->input()->field()->file(
341 $this->upload_handler,
342 $this->lng->txt('upload_files'),
343 null,
344 $this->ui->factory()->input()->field()->group([
345 ilObjFileProcessorInterface::OPTION_FILENAME => $this->ui->factory()->input()->field()->text($this->lng->txt('title')),
346 ilObjFileProcessorInterface::OPTION_DESCRIPTION => $this->ui->factory()->input()->field()->textarea($this->lng->txt('description')),
347 ])
348 )->withMaxFiles(self::UPLOAD_MAX_FILES)
349 ->withMaxFileSize((int) ilFileUtils::getUploadSizeLimitBytes())
350 ->withRequired(true),
351 ]
352 )->withSubmitCaption($this->lng->txt('upload_files'));
353 }
354
358 protected function uploadFiles(): void
359 {
360 $origin = ($this->http->query()->has(self::PARAM_UPLOAD_ORIGIN)) ?
361 $this->http->query()->retrieve(
362 self::PARAM_UPLOAD_ORIGIN,
363 $this->refinery->kindlyTo()->string()
364 ) : self::UPLOAD_ORIGIN_STANDARD;
365
366 if (self::UPLOAD_ORIGIN_DROPZONE === $origin) {
367 $dropzone = new ilObjFileUploadDropzone($this->parent_id);
368 $dropzone = $dropzone->getDropzone()->withRequest($this->request);
369 $files = $dropzone->getData()[self::PARAM_FILES] ?? null;
370 ;
371 } else {
372 $form = $this->initUploadForm()->withRequest($this->request);
373 $files = $form->getData()[self::PARAM_FILES] ?? null;
374 }
375
376 if (empty($files)) {
377 $form = $this->initUploadForm()->withRequest($this->request);
378 $this->tpl->setContent($this->ui->renderer()->render($form));
379 return;
380 }
381
382 $processor = new ilObjFileProcessor(
383 $this->stakeholder,
384 $this,
385 $this->storage,
386 $this->file_service_settings
387 );
388
389 $errors = false;
390 foreach ($files as $file_data) {
391 $rid = $this->storage->manage()->find($file_data[$this->upload_handler->getFileIdentifierParameterName()]);
392 if (null !== $rid) {
393 try {
394 $processor->process($rid, [
397 ]);
398 } catch (Throwable $t) {
399 $errors = true;
400 if (null !== $this->log) {
401 $this->log->error($t->getMessage() . ": " . $t->getTraceAsString());
402 }
403 }
404 }
405 }
406
407 if ($errors) {
408 $this->ui->mainTemplate()->setOnScreenMessage(
409 'failure',
410 $this->lng->txt('could_not_create_file_objs'),
411 true
412 );
413 }
414
415 if ($processor->getInvalidFileNames() !== []) {
416 $this->ui->mainTemplate()->setOnScreenMessage(
417 'info',
418 sprintf(
419 $this->lng->txt('file_upload_info_file_with_critical_extension'),
420 implode(', ', $processor->getInvalidFileNames())
421 ),
422 true
423 );
424 }
425
426 switch ($this->id_type) {
427 case self::WORKSPACE_NODE_ID:
428 $link = $this->ctrl->getLinkTargetByClass(ilObjWorkspaceRootFolderGUI::class);
429 break;
430 case self::REPOSITORY_NODE_ID:
431 default:
432 $link = ilLink::_getLink($this->requested_ref_id);
433 break;
434 }
435
436 $this->ctrl->redirectToURL($link);
437 }
438
439 public function putObjectInTree(ilObject $obj, int $parent_node_id = null): void
440 {
441 // this is needed to support multi fileuploads in personal and shared resources
442 $backup_node_id = $this->node_id;
443 parent::putObjectInTree($obj, $parent_node_id);
444 $this->node_id = $backup_node_id;
445 }
446
450 public function update(): void
451 {
452 global $DIC;
453 $ilTabs = $DIC['ilTabs'];
454
455 $form = $this->initPropertiesForm();
456 if (!$form->checkInput()) {
457 $ilTabs->activateTab("settings");
458 $form->setValuesByPost();
459 $this->tpl->setContent($form->getHTML());
460
461 return;
462 }
463
464 $title = $form->getInput('title');
465 // bugfix mantis 26045:
466 $filename = $this->object->getFileName();
467 if (trim($title) === '') {
468 $title = $filename;
469 }
470 $title = $this->object->appendSuffixToTitle($title, $filename);
471
472 $this->object->handleChangedObjectTitle($title);
473 $this->object->setDescription($form->getInput('description'));
474 $this->object->setRating($form->getInput('rating'));
475
476 $this->object->update();
477 $this->obj_service->commonSettings()->legacyForm($form, $this->object)->saveTileImage();
478
479 // BEGIN ChangeEvent: Record update event.
480 if (!empty($data["name"])) {
481 global $DIC;
482 $ilUser = $DIC['ilUser'];
483 ilChangeEvent::_recordWriteEvent($this->object->getId(), $ilUser->getId(), 'update');
484 ilChangeEvent::_catchupWriteEvents($this->object->getId(), $ilUser->getId());
485 }
486 // END ChangeEvent: Record update event.
487
488 // Update ecs export settings
489 $ecs = new ilECSFileSettings($this->object);
490 $ecs->handleSettingsUpdate();
491
492 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
493 ilUtil::redirect($this->ctrl->getLinkTarget($this, self::CMD_EDIT, '', false, false));
494 }
495
496 public function edit(): void
497 {
498 global $DIC;
499 $ilTabs = $DIC['ilTabs'];
500 $ilErr = $DIC['ilErr'];
501
502 if (!$this->checkPermissionBool("write")) {
503 $ilErr->raiseError($this->lng->txt("msg_no_perm_write"));
504 }
505
506 $ilTabs->activateTab("settings");
507
508 $form = $this->initPropertiesForm();
509
510 $val = [];
511 $val['title'] = $this->object->getTitle();
512 $val['description'] = $this->object->getLongDescription();
513 $val['rating'] = $this->object->hasRating();
514 $form->setValuesByArray($val);
515 $ecs = new ilECSFileSettings($this->object);
516 $ecs->addSettingsToForm($form, ilObjFile::OBJECT_TYPE);
517
518 $this->tpl->setContent($form->getHTML());
519 }
520
522 {
523 $form = new ilPropertyFormGUI();
524 $form->setFormAction($this->ctrl->getFormAction($this, 'update'));
525
526 $form->setTitle($this->lng->txt('file_edit'));
527 $form->addCommandButton('update', $this->lng->txt('save'));
528 $form->addCommandButton('cancel', $this->lng->txt('cancel'));
529
530 $title = new ilTextInputGUI($this->lng->txt('title'), 'title');
531 $title->setValue($this->object->getTitle());
532 $title->setInfo($this->lng->txt("if_no_title_then_filename"));
533 $form->addItem($title);
534
535 $o = new ilNonEditableValueGUI($this->lng->txt('upload_info'));
536 $o->setValue($this->lng->txt('upload_info_desc'));
537 $form->addItem($o);
538
539 $desc = new ilTextAreaInputGUI($this->lng->txt('description'), 'description');
540 $desc->setRows(3);
541 $form->addItem($desc);
542
543 if ($this->id_type === self::REPOSITORY_NODE_ID) {
544 $this->lng->loadLanguageModule('rating');
545 $rate = new ilCheckboxInputGUI($this->lng->txt('rating_activate_rating'), 'rating');
546 $rate->setInfo($this->lng->txt('rating_activate_rating_info'));
547 $form->addItem($rate);
548 }
549
550 $presentationHeader = new ilFormSectionHeaderGUI();
551 $presentationHeader->setTitle($this->lng->txt('settings_presentation_header'));
552 $form->addItem($presentationHeader);
553 $this->obj_service->commonSettings()->legacyForm($form, $this->object)->addTileImage();
554
555 return $form;
556 }
557
558 public function sendFile(): bool
559 {
560 $hist_entry_id = $this->http->query()->has('hist_id')
561 ? $this->http->query()->retrieve('hist_id', $this->refinery->kindlyTo()->int())
562 : null;
563 try {
564 if (ANONYMOUS_USER_ID === $this->user->getId() && $this->http->query()->has('transaction')) {
565 $this->object->sendFile($hist_entry_id);
566 }
567
568 if ($this->checkPermissionBool("read")) {
569 // Record read event and catchup with write events
571 $this->object->getType(),
572 $this->object->getRefId(),
573 $this->object->getId(),
574 $this->user->getId()
575 );
576 ilLPStatusWrapper::_updateStatus($this->object->getId(), $this->user->getId());
577
578 $this->object->sendFile($hist_entry_id);
579 } else {
580 $this->error->raiseError($this->lng->txt("permission_denied"), $this->error->MESSAGE);
581 }
582 } catch (\ILIAS\Filesystem\Exception\FileNotFoundException $e) {
583 $this->error->raiseError($e->getMessage(), $this->error->MESSAGE);
584 }
585
586 return true;
587 }
588
592 public function versions(): void
593 {
594 $this->ctrl->redirectByClass(ilFileVersionsGUI::class);
595 }
596
597 public function unzipCurrentRevision(): void
598 {
599 $this->ctrl->redirectByClass(ilFileVersionsGUI::class, ilFileVersionsGUI::CMD_UNZIP_CURRENT_REVISION);
600 }
601
607 public function infoScreen(): void
608 {
609 $this->ctrl->setCmd("showSummary");
610 $this->ctrl->setCmdClass("ilinfoscreengui");
611 $this->infoScreenForward();
612 }
613
617 public function infoScreenForward(): void
618 {
619 $this->tabs_gui->activateTab("id_info");
620
621 if (!$this->checkPermissionBool("visible") && !$this->checkPermissionBool("read")) {
622 $GLOBALS['DIC']['ilErr']->raiseError($this->lng->txt("msg_no_perm_read"));
623 }
624
625 $info = new ilInfoScreenGUI($this);
626
627 if ($this->checkPermissionBool("read", "sendfile")) {
628 $button = ilLinkButton::getInstance();
629 $button->setTarget('_blank');
630 $button->setCaption("file_download");
631 $button->setPrimary(true);
632
633 // get permanent download link for repository
634 if ($this->id_type === self::REPOSITORY_NODE_ID) {
635 $button->setUrl(ilObjFileAccess::_getPermanentDownloadLink($this->node_id));
636 } else {
637 $button->setUrl($this->ctrl->getLinkTarget($this, "sendfile"));
638 }
639
640 $this->toolbar->addButtonInstance($button);
641 }
642
643 $info->enablePrivateNotes();
644
645 if ($this->checkPermissionBool("read")) {
646 $info->enableNews();
647 }
648
649 // no news editing for files, just notifications
650 $info->enableNewsEditing(false);
651 if ($this->checkPermissionBool("write")) {
652 $news_set = new ilSetting("news");
653 $enable_internal_rss = $news_set->get("enable_rss_for_internal");
654
655 if ($enable_internal_rss) {
656 $info->setBlockProperty("news", "settings", true);
657 $info->setBlockProperty("news", "public_notifications_option", true);
658 }
659 }
660
661 // standard meta data
662 $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
663
664 // File Info
665 $info->addSection($this->lng->txt("file_info"));
666 $info->addProperty($this->lng->txt("filename"), $this->object->getFileName());
667 $info->addProperty($this->lng->txt("type"), $this->object->getFileType());
668 $info->addProperty($this->lng->txt("resource_id"), $this->object->getResourceId());
669 $info->addProperty($this->lng->txt("storage_id"), $this->object->getStorageID());
670
671 $info->addProperty(
672 $this->lng->txt("size"),
673 ilUtil::formatSize($this->object->getFileSize(), 'long')
674 );
675 $info->addProperty($this->lng->txt("version"), $this->object->getVersion());
676
677 $version = $this->object->getVersions([$this->object->getVersion()]);
678 $version = end($version);
679 if ($version instanceof ilObjFileVersion) {
680 $info->addProperty(
681 $this->lng->txt("version_uploaded"),
682 (new ilDateTime($version->getDate(), IL_CAL_DATETIME))->get(IL_CAL_DATETIME)
683 );
684 }
685
686 if ($this->object->getPageCount() > 0) {
687 $info->addProperty($this->lng->txt("page_count"), $this->object->getPageCount());
688 }
689
690 // using getVersions function instead of ilHistory direct
691 $version_uploader = $version["user_id"] ?? -1; // unknown uploader
692 $info->addProperty($this->lng->txt("file_uploaded_by"), ilUserUtil::getNamePresentation($version_uploader));
693
694 // download link added in repository
695 if ($this->id_type == self::REPOSITORY_NODE_ID && $this->checkPermissionBool("read", "sendfile")) {
696 $tpl = new ilTemplate("tpl.download_link.html", true, true, "Modules/File");
697 $tpl->setVariable("LINK", ilObjFileAccess::_getPermanentDownloadLink($this->node_id));
698 $info->addProperty($this->lng->txt("download_link"), $tpl->get());
699 }
700
701 if ($this->id_type == self::WORKSPACE_NODE_ID) {
702 $info->addProperty($this->lng->txt("perma_link"), $this->getPermanentLinkWidget());
703 }
704 if (!$this->ctrl->isAsynch()
705 && ilPreview::hasPreview($this->object->getId(), $this->object->getType())
706 && $this->checkPermissionBool("read")
707 ) {
708 // get context for access checks later on
709 switch ($this->id_type) {
710 case self::WORKSPACE_NODE_ID:
711 case self::WORKSPACE_OBJECT_ID:
713 break;
714
715 default:
717 break;
718 }
719
720 $preview = new ilPreviewGUI($this->node_id, $context, $this->object->getId(), $this->access_handler);
721 $info->addProperty($this->lng->txt("preview"), $preview->getInlineHTML());
722 }
723
724 // forward the command
725 // $this->ctrl->setCmd("showSummary");
726 // $this->ctrl->setCmdClass("ilinfoscreengui");
727 $this->ctrl->forwardCommand($info);
728 }
729
730 // get tabs
731 protected function setTabs(): void
732 {
733 global $DIC;
734 $ilTabs = $DIC['ilTabs'];
735 $lng = $DIC['lng'];
736 $ilHelp = $DIC['ilHelp'];
737
738 $ilHelp->setScreenIdComponent(ilObjFile::OBJECT_TYPE);
739
740 $this->ctrl->setParameter($this, "ref_id", $this->node_id);
741
742 if ($this->checkPermissionBool("write")) {
743 $ilTabs->addTab(
744 "id_versions",
745 $lng->txt(self::CMD_VERSIONS),
746 $this->ctrl->getLinkTargetByClass(ilFileVersionsGUI::class, ilFileVersionsGUI::CMD_DEFAULT)
747 );
748 }
749
750 if ($this->checkPermissionBool("visible") || $this->checkPermissionBool("read")) {
751 $ilTabs->addTab(
752 "id_info",
753 $lng->txt("info_short"),
754 $this->ctrl->getLinkTargetByClass(array("ilobjfilegui", "ilinfoscreengui"), "showSummary")
755 );
756 }
757
758 if ($this->checkPermissionBool("write")) {
759 $ilTabs->addTab(
760 "settings",
761 $lng->txt("settings"),
762 $this->ctrl->getLinkTarget($this, self::CMD_EDIT)
763 );
764 }
765
766 if (ilLearningProgressAccess::checkAccess($this->object->getRefId())) {
767 $ilTabs->addTab(
768 'learning_progress',
769 $lng->txt('learning_progress'),
770 $this->ctrl->getLinkTargetByClass(array(__CLASS__, 'illearningprogressgui'), '')
771 );
772 }
773
774 // meta data
775 if ($this->checkPermissionBool("write")) {
776 $mdgui = new ilObjectMetaDataGUI($this->object);
777 $mdtab = $mdgui->getTab();
778 if ($mdtab) {
779 $ilTabs->addTab(
780 "id_meta",
781 $lng->txt("meta_data"),
782 $mdtab
783 );
784 }
785 }
786
787 // export
788 if ($this->checkPermissionBool("write")) {
789 $ilTabs->addTab(
790 "export",
791 $lng->txt("export"),
792 $this->ctrl->getLinkTargetByClass("ilexportgui", "")
793 );
794 }
795
796 // will add permission tab if needed
797 parent::setTabs();
798 }
799
800 public static function _goto($a_target, $a_additional = null): void
801 {
802 global $DIC;
803 $main_tpl = $DIC->ui()->mainTemplate();
804 $ilErr = $DIC['ilErr'];
805 $lng = $DIC['lng'];
806 $ilAccess = $DIC['ilAccess'];
807
808 if ($a_additional && substr($a_additional, -3) == "wsp") {
810 }
811
812 // added support for direct download goto links
813 if ($a_additional && substr($a_additional, -8) === "download") {
814 ilObjectGUI::_gotoRepositoryNode((int) $a_target, "sendfile");
815 }
816
817 // static method, no workspace support yet
818
819 if ($ilAccess->checkAccess("visible", "", $a_target)
820 || $ilAccess->checkAccess("read", "", $a_target)
821 ) {
822 ilObjectGUI::_gotoRepositoryNode($a_target, "infoScreen");
823 } else {
824 if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
825 $main_tpl->setOnScreenMessage('failure', sprintf(
826 $lng->txt("msg_no_perm_read_item"),
828 ), true);
830 }
831 }
832
833 $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
834 }
835
839 protected function addLocatorItems(): void
840 {
841 global $DIC;
842 $ilLocator = $DIC['ilLocator'];
843
844 if (is_object($this->object)) {
845 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, ""), "", $this->node_id);
846 }
847 }
848
849 protected function initHeaderAction($a_sub_type = null, $a_sub_id = null): ?\ilObjectListGUI
850 {
851 $lg = parent::initHeaderAction($a_sub_type, $a_sub_id);
852 if ($lg instanceof ilObjectListGUI && $this->object->hasRating()) {
853 $lg->enableRating(
854 true,
855 null,
856 false,
857 [ilCommonActionDispatcherGUI::class, ilRatingGUI::class]
858 );
859 }
860
861 return $lg;
862 }
863}
$version
Definition: plugin.php:24
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
$filename
Definition: buildRTE.php:78
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:32
Provides fluid interface to RBAC services.
Definition: UIServices.php:24
const IL_CAL_DATETIME
error(string $a_errmsg)
return true
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addItem(string $a_header, string $a_content, bool $a_force_open=false)
static _recordReadEvent(string $a_type, int $a_ref_id, int $obj_id, int $usr_id, bool $isCatchupWriteEvents=true, $a_ext_rc=null, $a_ext_time=null)
static _catchupWriteEvents(int $obj_id, int $usr_id, ?string $timestamp=null)
Catches up with all write events which occured before the specified timestamp.
static _recordWriteEvent(int $obj_id, int $usr_id, string $action, ?int $parent_obj_id=null)
Records a write event.
This class represents a checkbox property in a property form.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
@classDescription Date and time handling
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getUploadSizeLimitBytes()
Class ilFileVersionsGUI.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilInfoScreenGUI.
static _updateStatus(int $a_obj_id, int $a_usr_id, ?object $a_obj=null, bool $a_percentage=false, bool $a_force_raise=false)
language handling
static checkAccess(int $a_ref_id, bool $a_allow_only_read=true)
check access to learning progress
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getLogger(string $a_component_id)
Get component logger.
Component logger with individual log levels by component id.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getPermanentDownloadLink(int $ref_id)
Gets the permanent download link for the file.
GUI class for file objects.
update()
updates object entry in object_data
uploadFiles()
MUST be protected, since this is Called from ilObject2GUI when used in Personal Workspace.
initCreationForms($a_new_type)
infoScreen()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually,...
render()
This Method is needed if called from personal resources.
getCreationFormsHTML(array $a_forms)
Get HTML for creation forms (accordion)
const UPLOAD_ORIGIN_DROPZONE
addUIFormToAccordion(ilAccordionGUI $accordion, Standard $form, int $form_type)
getType()
Functions that must be overwritten.
initHeaderAction($a_sub_type=null, $a_sub_id=null)
ILIAS HTTP Wrapper WrapperFactory $http
const UPLOAD_ORIGIN_STANDARD
static _goto($a_target, $a_additional=null)
ILIAS Refinery Factory $refinery
infoScreenForward()
show information screen
__construct(int $a_id=0, int $a_id_type=self::REPOSITORY_NODE_ID, int $a_parent_node_id=0)
Constructor.
putObjectInTree(ilObject $obj, int $parent_node_id=null)
Add object to tree at given position.
ilObjectService $obj_service
ilFileServicesSettings $file_service_settings
ResourceStakeholder $stakeholder
addLegacyFormToAccordion(ilAccordionGUI $accordion, ilPropertyFormGUI $form, int $form_type)
addLocatorItems()
Functions to be overwritten.
UploadHandler $upload_handler
setTabs()
create tabs (repository/workspace switch)
Class ilObjFileProcessorInterface.
Class ilObjFileStakeholder.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const OBJECT_TYPE
New implementation of ilObjectGUI.
executeCommand()
execute command
ilGlobalTemplateInterface $tpl
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $node_id=null)
prepareOutput(bool $show_sub_objects=true)
GUI class for the workflow of copying objects.
static _gotoSharedWorkspaceNode(int $wsp_id)
static _gotoRepositoryRoot(bool $raise_error=false)
Goto repository root.
addHeaderAction()
Add header action menu.
static _gotoRepositoryNode(int $ref_id, string $cmd="")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
static hasPreview(int $a_obj_id, string $a_type="")
Determines whether the object with the specified reference id has a preview.
This class represents a property form user interface.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
special template class to simplify handling of ITX/PEAR
This class represents a text area property in a property form.
This class represents a text property in a property form.
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link="", bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
static formatSize(int $size, string $a_mode='short', ?ilLanguage $a_lng=null)
Returns the specified file size value in a human friendly form.
static redirect(string $a_script)
if(!file_exists(getcwd() . '/ilias.ini.php'))
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: confirmReg.php:20
const ANONYMOUS_USER_ID
Definition: constants.php:27
const ROOT_FOLDER_ID
Definition: constants.php:32
global $DIC
Definition: feed.php:28
$preview
Definition: imgupload.php:81
$errors
Definition: imgupload.php:65
$ilUser
Definition: imgupload.php:34
setVariable(string $variable, $value='')
Sets the given variable to the given value.
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
Class FlySystemFileAccessTest \Provider\FlySystem @runTestsInSeparateProcesses @preserveGlobalState d...
static http()
Fetches the global http state from ILIAS.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
Class ChatMainBarProvider \MainMenu\Provider.
$type
$ilErr
Definition: raiseError.php:17
$lng
$context
Definition: webdav.php:29