ILIAS  trunk Revision v12.0_alpha-1227-g7ff6d300864
class.ilContainerGUI.php
Go to the documentation of this file.
1<?php
2
26
35{
36 protected \ILIAS\Container\InternalGUIService $gui;
37 protected \ILIAS\Style\Content\GUIService $content_style_gui;
41 protected \ILIAS\Container\InternalDomainService $domain;
42 protected ilTabsGUI $tabs;
47 protected ilLogger $log;
51 public int $bl_cnt = 1; // block counter
52 public bool $multi_download_enabled = false;
53 protected UIServices $ui;
56 protected ?Standard $ui_filter = null;
57 protected bool $edit_order = false;
58 protected bool $adminCommands = false;
59 protected string $requested_redirectSource = "";
60 protected int $current_position = 0;
63 protected ?ModeManager $mode_manager = null;
65 protected \ILIAS\Style\Content\DomainService $content_style_domain;
66
67 public function __construct(
68 $a_data,
69 int $a_id,
70 bool $a_call_by_reference = true,
71 bool $a_prepare_output = true
72 ) {
74 global $DIC;
75
76 $this->lng = $DIC->language();
77 $this->tpl = $DIC["tpl"];
78 $this->ctrl = $DIC->ctrl();
79 $this->tabs = $DIC->tabs();
80 $this->settings = $DIC->settings();
81 $this->user = $DIC->user();
82 $this->access = $DIC->access();
83 $this->tree = $DIC->repositoryTree();
84 $this->error = $DIC["ilErr"];
85 $this->obj_definition = $DIC["objDefinition"];
86 $this->rbacadmin = $DIC->rbac()->admin();
87 $this->rbacreview = $DIC->rbac()->review();
88 $this->log = $DIC["ilLog"];
89 $this->obj_data_cache = $DIC["ilObjDataCache"];
90 $this->toolbar = $DIC->toolbar();
91 $this->app_event_handler = $DIC["ilAppEventHandler"];
92 $this->ui = $DIC->ui();
93 $this->global_screen = $DIC->globalScreen();
94 $this->component_factory = $DIC["component.factory"];
95 $rbacsystem = $DIC->rbac()->system();
96 $lng = $DIC->language();
97
98 $this->rbacsystem = $rbacsystem;
99
100 $lng->loadLanguageModule("cntr");
101 $lng->loadLanguageModule('cont');
102
103 // prepare output things should generally be made in executeCommand
104 // method (maybe dependent on current class/command
105 parent::__construct($a_data, $a_id, $a_call_by_reference, false);
106
107 $this->clipboard = $DIC
108 ->repository()
109 ->internal()
110 ->domain()
111 ->clipboard();
112 $this->std_request = $DIC
113 ->container()
114 ->internal()
115 ->gui()
116 ->standardRequest();
117 $this->requested_redirectSource = $this->std_request->getRedirectSource();
118 $this->domain = $DIC->container()
119 ->internal()
120 ->domain();
121
122 $this->container_filter_service = new ilContainerFilterService();
123 $this->initFilter();
124 $cs = $DIC->contentStyle();
125 $this->content_style_gui = $cs->gui();
126 $this->content_style_domain = $cs->domain();
127 $this->gui = $DIC->container()->internal()->gui();
128 }
129
130 protected function getModeManager(): ModeManager
131 {
132 if (is_null($this->mode_manager)) {
133 $this->mode_manager = $this->domain
134 ->content()
135 ->mode($this->getObject());
136 }
137 return $this->mode_manager;
138 }
139
140 protected function getItemPresentation(
141 $include_empty_blocks = true,
142 ?string $lang = null
143 ): \ILIAS\Container\Content\ItemPresentationManager {
144 if (is_null($this->item_presentation)) {
145 $this->item_presentation = $this->domain
146 ->content()
147 ->itemPresentation(
148 $this->getObject(),
149 $this->container_user_filter,
150 $include_empty_blocks,
151 $lang
152 );
153 }
155 }
156
157 public function executeCommand(): void
158 {
159 $tpl = $this->tpl;
160
161 $next_class = $this->ctrl->getNextClass();
162 $cmd = $this->ctrl->getCmd("render");
163
164 switch ($next_class) {
165 // page editing
166 case "ilcontainerpagegui":
167 if ($this->requested_redirectSource !== "ilinternallinkgui") {
168 $ret = $this->forwardToPageObject();
169 $tpl->setContent($ret);
170 } else {
171 return;
172 }
173 break;
174
175 default:
176 $this->prepareOutput();
177 $cmd .= "Object";
178 $this->$cmd();
179 break;
180 }
181 }
182
183 protected function getEditFormValues(): array
184 {
185 $values = parent::getEditFormValues();
186
187 $values['didactic_type'] =
188 'dtpl_' . ilDidacticTemplateObjSettings::lookupTemplateId($this->object->getRefId());
189
190 return $values;
191 }
192
193 protected function afterUpdate(): void
194 {
195 // check if template is changed
197 $this->object->getRefId()
198 );
199 $new_tpl_id = $this->getDidacticTemplateVar('dtpl');
200
201 if ($new_tpl_id !== $current_tpl_id) {
202 // redirect to didactic template confirmation
203 $this->ctrl->setParameterByClass(ilDidacticTemplateGUI::class, "didactic_type", $new_tpl_id);
204 $this->ctrl->redirectByClass(ilDidacticTemplateGUI::class, "confirmTemplateSwitch");
205 }
206 parent::afterUpdate();
207 }
208
210 {
211 return $this->std_request->getDidacticTemplateId();
212 }
213
214 public function forwardToPageObject(): string
215 {
217 $ilTabs = $this->tabs;
218 $ilCtrl = $this->ctrl;
219 $cmd = $ilCtrl->getCmd();
220 if (in_array($cmd, ["displayMediaFullscreen", "downloadFile", "displayMedia"])) {
221 $this->checkPermission("read");
222 } else {
223 $this->checkPermission("write");
224 }
225
226 $ilTabs->clearTargets();
227
228 if ($this->requested_redirectSource === "ilinternallinkgui") {
229 exit;
230 }
231
232 $ilTabs->setBackTarget(
233 $lng->txt("back"),
234 $this->ctrl->getLinkTargetByClass("ilcontainerpagegui", "edit")
235 );
236
237 // page object
238
239 $lng->loadLanguageModule("content");
240 $this->content_style_gui->addCss($this->tpl, $this->object->getRefId());
241 // $this->tpl->setCurrentBlock("SyntaxStyle");
242 $this->tpl->addCss(ilObjStyleSheet::getSyntaxStylePath());
243 // $this->tpl->parseCurrentBlock();
244
246 "cont",
247 $this->object->getId()
248 )) {
249 // doesn't exist -> create new one
250 $new_page_object = new ilContainerPage();
251 $new_page_object->setParentId($this->object->getId());
252 $new_page_object->setId($this->object->getId());
253 $new_page_object->createFromXML();
254 }
255
256 // get page object
257 $page_gui = new ilContainerPageGUI($this->object->getId());
258 $style = $this->content_style_domain->styleForRefId($this->object->getRefId());
259 $page_gui->setStyleId(
260 $style->getEffectiveStyleId()
261 );
262 $page_gui->setItemPresentationManager($this->getItemPresentation(
263 false,
264 $page_gui->getLanguage()
265 ));
266 $page_gui->setTemplateTargetVar("ADM_CONTENT");
267 $page_gui->setFileDownloadLink("");
268 //$page_gui->setLinkParams($this->ctrl->getUrlParameterString()); // todo
269 $page_gui->setPresentationTitle("");
270 $page_gui->setTemplateOutput(false);
271
272 // style tab
273 $page_gui->setTabHook($this, "addPageTabs");
274
275 return $this->ctrl->forwardCommand($page_gui);
276 }
277
278 public function addPageTabs(): void
279 {
280 $ilTabs = $this->tabs;
281 $ilCtrl = $this->ctrl;
282
283 $ilTabs->addTarget(
284 "obj_sty",
285 $ilCtrl->getLinkTargetByClass("ilObjectContentStyleSettingsGUI", ''),
286 "editStyleProperties",
287 "ilobjectcontentstylesettingsgui"
288 );
289 }
290
291 public function getContainerPageHTML(): string
292 {
293 $ilSetting = $this->settings;
294 $ilUser = $this->user;
295
296 if (!$ilSetting->get("enable_cat_page_edit") || $this->object->filteredSubtree()) {
297 return "";
298 }
299
300 // if page does not exist, return nothing
302 "cont",
303 $this->object->getId()
304 )) {
305 return "";
306 }
307 $this->content_style_gui->addCss($this->tpl, $this->object->getRefId());
308 $this->tpl->setCurrentBlock("SyntaxStyle");
309 $this->tpl->setVariable(
310 "LOCATION_SYNTAX_STYLESHEET",
312 );
313 $this->tpl->parseCurrentBlock();
314
315 // get page object
316 $ot = $this->object->getObjectTranslation();
317 $lang = $ot->getEffectiveCOPageLang($ilUser->getCurrentLanguage(), "cont");
318 $page_gui = new ilContainerPageGUI($this->object->getId(), 0, $lang);
319 $style = $this->content_style_domain->styleForRefId($this->object->getRefId());
320 $page_gui->setStyleId($style->getEffectiveStyleId());
321
322 $page_gui->setPresentationTitle("");
323 $page_gui->setTemplateOutput(false);
324 $page_gui->setHeader("");
325 $ret = $page_gui->showPage();
326
327 //$ret = "<div style='background-color: white; padding:5px; margin-bottom: 30px;'>".$ret."</div>";
328
329 //$ret =& $page_gui->executeCommand();
330 return $ret;
331 }
332
333 protected function setTitleAndDescription(): void
334 {
335 if (ilContainer::_lookupContainerSetting($this->object->getId(), "hide_header_icon_and_title")) {
336 $this->tpl->setTitle($this->object->getTitle(), true);
337 } else {
338 parent::setTitleAndDescription();
339 }
340 }
341
342 protected function showPossibleSubObjects(): void
343 {
344 if ($this->isActiveOrdering()) {
345 return;
346 }
348 $this->buildAddNewItemElements($this->getCreatableObjectTypes())
349 );
350 $gui->render();
351 }
352
354 {
355 $view_mode = $this->object->getViewMode();
356 if ($this->object->filteredSubtree()) {
357 $view_mode = ilContainer::VIEW_SIMPLE;
358 }
359 switch ($view_mode) {
360 // all items in one block
362 $container_view = new ilContainerSimpleContentGUI(
363 $this,
364 $this->getItemPresentation()
365 );
366 break;
367
369 $container_view = new ilContainerObjectiveGUI(
370 $this,
371 $this->getItemPresentation()
372 );
373 break;
374
375 // all items in one block
377 case ilCourseConstants::IL_CRS_VIEW_TIMING: // not nice this workaround
378 $container_view = new ilContainerSessionsContentGUI(
379 $this,
380 $this->getItemPresentation()
381 );
382 break;
383
384 // all items in one block
386 default:
387 $container_view = new ilContainerByTypeContentGUI(
388 $this,
389 $this->getItemPresentation()
390 );
391 break;
392 }
393 return $container_view;
394 }
395
396 public function renderObject(): void
397 {
398 $ilTabs = $this->tabs;
399 $ilCtrl = $this->ctrl;
400 $ilSetting = $this->settings;
401 $user = $this->user;
402 $toolbar = $this->toolbar;
404
405 $container_view = $this->getContentGUI();
406
407 $this->setContentSubTabs();
408 if ($this->isActiveAdministrationPanel()) {
409 if (!$this->item_presentation->canManageItems()) {
410 $this->ctrl->redirect($this, "disableAdministrationPanel");
411 }
412 $ilTabs->activateSubTab("manage");
413 } else {
414 $ilTabs->activateSubTab("view_content");
415 }
416
417 $container_view->setOutput();
418
419 //$this->adminCommands = $container_view->adminCommands;
420
421 $is_container_cmd = strtolower($this->std_request->getCmdClass()) === strtolower(get_class($this))
422 || ($this->std_request->getCmdClass() === "");
423
424 // it is important not to show the subobjects/admin panel here, since
425 // we will create nested forms in case, e.g. a news/calendar item is added
426 if ($is_container_cmd) {
427 $this->showAdministrationPanel();
428
429 if (!$this->edit_order) {
430 $this->showPossibleSubObjects();
431 }
432 if ($this->isActiveAdministrationPanel()) {
433 $this->addImportButtonToToolbar();
434 }
435
436 if (is_object($this->object) &&
437 $user->getId() !== ANONYMOUS_USER_ID &&
438 $this->rbacsystem->checkAccess("write", $this->object->getRefId())
439 ) {
440 if ($ilSetting->get("enable_cat_page_edit")) {
441 if (!$this->isActiveAdministrationPanel() &&
442 !$this->isActiveOrdering() &&
443 $this->supportsPageEditor()
444 ) {
445 $toolbar->addButton(
446 $lng->txt("cntr_text_media_editor"),
447 $ilCtrl->getLinkTarget($this, "editPageFrame")
448 );
449 }
450 }
451 }
452 if (!$this->edit_order) {
453 if (!$this->isActiveAdministrationPanel() && $this->getCreationMode() === false) {
455 }
456 }
457 }
458
459 $this->showContainerFilter();
460
461 $this->showPermanentLink();
462
463 // add tree updater javascript
464 if ($this->requested_ref_id > 1 && $ilSetting->get("rep_tree_synchronize")) {
465 $ilCtrl->setParameter($this, "active_node", $this->requested_ref_id);
466 }
467 }
468
469 protected function supportsPageEditor(): bool
470 {
471 return true;
472 }
473
477 public function renderBlockAsynchObject(): void
478 {
479 $container_view = $this->getContentGUI();
480 echo $container_view->getSingleTypeBlockAsynch(
481 $this->std_request->getType()
482 );
483 exit;
484 }
485
486 public function setContentSubTabs(): void
487 {
488 $this->addStandardContainerSubTabs();
489 }
490
491 public function showAdministrationPanel(): void
492 {
493 global $DIC;
494
495 $ilAccess = $this->access;
497
498 $main_tpl = $DIC->ui()->mainTemplate();
499
500 $lng->loadLanguageModule('cntr');
501
502 if ($this->clipboard->hasEntries() && !$this->edit_order) {
503 // #11545
504 $main_tpl->setPageFormAction($this->ctrl->getFormAction($this));
505
506 $toolbar = new ilToolbarGUI();
507 $toolbar->setId("admclip");
508 $this->ctrl->setParameter($this, "type", "");
509 $this->ctrl->setParameter($this, "item_ref_id", "");
510
511 $toolbar->addComponent(
512 $this->ui->factory()->button()->standard(
513 $this->lng->txt('paste_clipboard_items'),
514 $this->ctrl->getLinkTargetByClass([ilRepositoryGUI::class, static::class], 'paste')
515 )
516 );
517
518 $toolbar->addComponent(
519 $this->ui->factory()->button()->standard(
520 $this->lng->txt('clear_clipboard'),
521 $this->ctrl->getLinkTargetByClass([ilRepositoryGUI::class, static::class], 'clear')
522 )
523 );
524
525 $main_tpl->addAdminPanelToolbar($toolbar, true, false);
526 } elseif ($this->isActiveAdministrationPanel()) {
527 // #11545
528 $main_tpl->setPageFormAction($this->ctrl->getFormAction($this));
529 $toolbar = new ilToolbarGUI();
530 $toolbar->setId("adm");
531 $this->ctrl->setParameter($this, "type", "");
532 $this->ctrl->setParameter($this, "item_ref_id", "");
533
534 if ($this->gotItems()) {
535 $toolbar->setLeadingImage(
536 ilUtil::getImagePath("nav/arrow_upright.svg"),
537 $lng->txt("actions")
538 );
539 $toolbar->addFormButton(
540 $this->lng->txt('delete_selected_items'),
541 'delete'
542 );
543 $toolbar->addFormButton(
544 $this->lng->txt('move_selected_items'),
545 'cut'
546 );
547 $toolbar->addFormButton(
548 $this->lng->txt('copy_selected_items'),
549 'copy'
550 );
551 $toolbar->addFormButton(
552 $this->lng->txt('link_selected_items'),
553 'link'
554 );
555
556 $toolbar = $this->addAvailabilityPeriodButtonToToolbar($toolbar);
557 // add download button if multi download enabled
558 $folder_set = new ilSetting('fold');
559 if ((bool) $folder_set->get('enable_multi_download') === true) {
560 $toolbar->addSeparator();
561 $toolbar->addFormButton(
562 $this->lng->txt('download_selected_items'),
563 'download'
564 );
565 }
566 }
567 $main_tpl->addAdminPanelToolbar(
568 $toolbar,
569 $this->gotItems() && !$this->clipboard->hasEntries(),
570 $this->gotItems() && !$this->clipboard->hasEntries()
571 );
572
573 // form action needed, see http://www.ilias.de/mantis/view.php?id=9630
574 if ($this->gotItems()) {
575 $main_tpl->setPageFormAction($this->ctrl->getFormAction($this));
576 }
577 } elseif ($this->edit_order) {
578 if ($this->getItemPresentation()->hasItems() && $ilAccess->checkAccess("write", "", $this->object->getRefId())) {
579 if ($this->isActiveOrdering()) {
580 // #11843
581 $main_tpl->setPageFormAction($this->ctrl->getFormAction($this));
582
583 $toolbar = new ilToolbarGUI();
584 $this->ctrl->setParameter($this, "type", "");
585 $this->ctrl->setParameter($this, "item_ref_id", "");
586
587 $toolbar->addFormButton(
588 $this->lng->txt('sorting_save'),
589 'saveSorting'
590 );
591
592 $main_tpl->addAdminPanelToolbar($toolbar, true, false);
593 }
594 }
595 }
596 // bugfix mantis 24559
597 // undoing an erroneous change inside mantis 23516 by adding "Download Multiple Objects"-functionality for non-admins
598 // as they don't have the possibility to use the multi-download-capability of the manage-tab
599 elseif ($this->isMultiDownloadEnabled()) {
600 // bugfix mantis 0021272
602 $num_files = $this->tree->getChildsByType($ref_id, "file");
603 $num_folders = $this->tree->getChildsByType($ref_id, "fold");
604 if (count($num_files) > 0 || count($num_folders) > 0) {
605 // #11843
606 $GLOBALS['tpl']->setPageFormAction($this->ctrl->getFormAction($this));
607
608 $toolbar = new ilToolbarGUI();
609 $this->ctrl->setParameter($this, "type", "");
610 $this->ctrl->setParameter($this, "item_ref_id", "");
611
612 $toolbar->addFormButton(
613 $this->lng->txt('download_selected_items'),
614 'download'
615 );
616
617 $GLOBALS['tpl']->addAdminPanelToolbar(
618 $toolbar,
619 $this->gotItems(),
620 $this->gotItems()
621 );
622 } else {
623 $this->tpl->setOnScreenMessage('info', $this->lng->txt('msg_no_downloadable_objects'), true);
624 }
625 }
626 }
627
628 protected function gotItems(): bool
629 {
630 return $this->getItemPresentation()->hasItems();
631 }
632
633 public function showPermanentLink(): void
634 {
635 global $DIC;
636
637 $tpl = $DIC->ui()->mainTemplate();
638
639 $tpl->setPermanentLink(
640 $this->object->getType(),
641 $this->object->getRefId(),
642 "",
643 "_top"
644 );
645 }
646
647 public function editPageFrameObject(): void
648 {
649 $this->ctrl->redirectByClass([static::class, "ilcontainerpagegui"], "edit");
650 }
651
652 public function cancelPageContentObject(): void
653 {
654 $this->ctrl->redirect($this, "");
655 }
656
657 public function showLinkListObject(): void
658 {
660 $tree = $this->tree;
661
662 $cnt = [];
663
664 $tpl = new ilGlobalTemplate(
665 "tpl.container_link_help.html",
666 true,
667 true,
668 "components/ILIAS/Container"
669 );
670
671 $type_ordering = [
672 "cat",
673 "fold",
674 "crs",
675 "grp",
676 "chat",
677 "frm",
678 "lres",
679 "glo",
680 "webr",
681 "file",
682 "exc",
683 "tst",
684 "svy",
685 "mep",
686 "qpl",
687 "spl"
688 ];
689
690 $childs = $tree->getChilds($this->requested_ref_id);
691 foreach ($childs as $child) {
692 if (in_array($child["type"], ["lm", "sahs", "htlm"])) {
693 $cnt["lres"]++;
694 } else {
695 $cnt[$child["type"]]++;
696 }
697 }
698
699 $tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
700 $tpl->setVariable("TXT_HELP_HEADER", $lng->txt("help"));
701 foreach ($type_ordering as $type) {
702 $tpl->setCurrentBlock("row");
703 if ($type !== "lres") {
704 $tpl->setVariable(
705 "TYPE",
706 $lng->txt("objs_" . $type) .
707 " (" . ((int) $cnt[$type]) . ")"
708 );
709 } else {
710 $tpl->setVariable(
711 "TYPE",
712 $lng->txt("obj_lrss") .
713 " (" . ((int) $cnt["lres"]) . ")"
714 );
715 }
716 $tpl->setVariable("TXT_LINK", "[list-" . $type . "]");
717 $tpl->parseCurrentBlock();
718 }
719 $tpl->printToStdout();
720 exit;
721 }
722
723 public function addHeaderRow(
724 ilTemplate $a_tpl,
725 string $a_type,
726 bool $a_show_image = true
727 ): void {
728 $icon = ilUtil::getImagePath("standard/icon_" . $a_type . ".svg");
729 $title = $this->lng->txt("objs_" . $a_type);
730
731 if ($a_show_image) {
732 $a_tpl->setCurrentBlock("container_header_row_image");
733 $a_tpl->setVariable("HEADER_IMG", $icon);
734 $a_tpl->setVariable("HEADER_ALT", $title);
735 } else {
736 $a_tpl->setCurrentBlock("container_header_row");
737 }
738
739 $a_tpl->setVariable("BLOCK_HEADER_CONTENT", $title);
740 $a_tpl->parseCurrentBlock();
741 //$a_tpl->touchBlock("container_row");
742 }
743
744 public function addStandardRow(
745 ilTemplate $a_tpl,
746 string $a_html,
747 ?int $a_item_ref_id = null,
748 ?int $a_item_obj_id = null,
749 string $a_image_type = ""
750 ): void {
751 $ilSetting = $this->settings;
752
753 $nbsp = true;
754 if ($ilSetting->get("icon_position_in_lists") === "item_rows") {
755 $icon = ilUtil::getImagePath("standard/icon_" . $a_image_type . ".svg");
756 $alt = $this->lng->txt("obj_" . $a_image_type);
757
758 if ($ilSetting->get('custom_icons')) {
759 global $DIC;
761 $customIconFactory = $DIC['object.customicons.factory'];
762 $customIcon = $customIconFactory->getPresenterByObjId($a_item_obj_id, $a_image_type);
763
764 if ($customIcon->exists()) {
765 $icon = $customIcon->getFullPath();
766 }
767 }
768
769 $a_tpl->setCurrentBlock("block_row_image");
770 $a_tpl->setVariable("ROW_IMG", $icon);
771 $a_tpl->setVariable("ROW_ALT", $alt);
772 $a_tpl->parseCurrentBlock();
773 $nbsp = false;
774 }
775
776 if ($this->isActiveAdministrationPanel()) {
777 $a_tpl->setCurrentBlock("block_row_check");
778 $a_tpl->setVariable("ITEM_ID", $a_item_ref_id);
779 $a_tpl->parseCurrentBlock();
780 $nbsp = false;
781 }
782 if ($this->isActiveAdministrationPanel() &&
784 $a_tpl->setCurrentBlock('block_position');
785 $a_tpl->setVariable('POS_TYPE', $a_image_type);
786 $a_tpl->setVariable('POS_ID', $a_item_ref_id);
787 $a_tpl->setVariable('POSITION', sprintf('%.1f', $this->current_position++));
788 $a_tpl->parseCurrentBlock();
789 }
790 if ($nbsp) {
791 $a_tpl->setVariable("ROW_NBSP", "&nbsp;");
792 }
793 $a_tpl->setCurrentBlock("container_standard_row");
794 $a_tpl->setVariable("BLOCK_ROW_CONTENT", $a_html);
795 $a_tpl->parseCurrentBlock();
796 $a_tpl->touchBlock("container_row");
797 }
798
799 public function addMessageRow(
800 ilTemplate $a_tpl,
801 string $a_message,
802 string $a_type
803 ): void {
804 $type = $this->lng->txt("obj_" . $a_type);
805 $a_message = str_replace("[type]", $type, $a_message);
806
807 $a_tpl->setVariable("ROW_NBSP", "&nbsp;");
808
809 $a_tpl->setCurrentBlock("container_standard_row");
810 $a_tpl->setVariable(
811 "BLOCK_ROW_CONTENT",
812 $a_message
813 );
814 $a_tpl->parseCurrentBlock();
815 $a_tpl->touchBlock("container_row");
816 }
817
818 public function setPageEditorTabs(): void
819 {
821
822 if (!$this->isActiveAdministrationPanel()
823 || strtolower($this->ctrl->getCmdClass()) !== "ilcontainerpagegui") {
824 return;
825 }
826
827 $lng->loadLanguageModule("content");
828 //$tabs_gui = new ilTabsGUI();
829 //$tabs_gui->setSubTabs();
830
831 // back to upper context
832 $this->tabs_gui->setBackTarget(
833 $this->lng->txt("obj_cat"),
834 $this->ctrl->getLinkTarget($this, "")
835 );
836
837 $this->tabs_gui->addTarget(
838 "edit",
839 $this->ctrl->getLinkTargetByClass("ilcontainerpagegui", "view"),
840 ["", "view"],
841 "ilcontainerpagegui"
842 );
843
844 //$this->tpl->setTabs($tabs_gui->getHTML());
845 }
846
851 bool $a_include_view = true
852 ): void {
853 $ilTabs = $this->tabs;
855 $ilCtrl = $this->ctrl;
856 $ilUser = $this->user;
857
858 if (!is_object($this->object)) {
859 return;
860 }
861
862 if ($a_include_view && $this->rbacsystem->checkAccess("visible,read", $this->object->getRefId())) {
863 if (!$this->isActiveAdministrationPanel()) {
864 $ilTabs->addSubTab("view_content", $lng->txt("view"), $ilCtrl->getLinkTargetByClass(static::class, "view"));
865 } else {
866 $ilTabs->addSubTab(
867 "view_content",
868 $lng->txt("view"),
869 $ilCtrl->getLinkTarget($this, "disableAdministrationPanel")
870 );
871 }
872 }
873
874 $item_presentation = $this->getItemPresentation();
875 if ($item_presentation->canManageItems()) {
876 if ($this->isActiveAdministrationPanel()) {
877 $ilTabs->addSubTab("manage", $lng->txt("cntr_manage"), $ilCtrl->getLinkTarget($this, ""));
878 } else {
879 $ilTabs->addSubTab(
880 "manage",
881 $lng->txt("cntr_manage"),
882 $ilCtrl->getLinkTarget($this, "enableAdministrationPanel")
883 );
884 }
885 }
886 if ($item_presentation->canOrderItems()) {
887 $ilTabs->addSubTab("ordering", $lng->txt("cntr_ordering"), $ilCtrl->getLinkTarget($this, "editOrder"));
888 }
889 }
890
891 protected function getTabs(): void
892 {
893 $rbacsystem = $this->rbacsystem;
894 $ilCtrl = $this->ctrl;
895
896 // edit permissions
897 if ($rbacsystem->checkAccess('edit_permission', $this->ref_id)) {
898 $this->tabs_gui->addTarget(
899 "perm_settings",
900 $this->ctrl->getLinkTargetByClass([get_class($this), 'ilpermissiongui'], "perm"),
901 ["perm", "info", "owner"],
902 'ilpermissiongui'
903 );
904 if ($ilCtrl->getNextClass() === "ilpermissiongui") {
905 $this->tabs_gui->activateTab("perm_settings");
906 }
907 }
908
909 // show clipboard
910 if (strtolower($this->std_request->getBaseClass()) === "ilrepositorygui" &&
911 $this->clipboard->hasEntries()) {
912 $this->tabs_gui->addTarget(
913 "clipboard",
914 $this->ctrl->getLinkTarget($this, "clipboard"),
915 "clipboard",
916 get_class($this)
917 );
918 }
919 }
920
921 //*****************
922 // COMMON METHODS (may be overwritten in derived classes
923 // if special handling is necessary)
924 //*****************
925
926 public function enableAdministrationPanelObject(): void
927 {
928 $this->getModeManager()->setAdminMode();
929 $this->ctrl->redirect($this, "render");
930 }
931
932 public function disableAdministrationPanelObject(): void
933 {
934 $this->getModeManager()->setContentMode();
935 $this->ctrl->redirect($this, "render");
936 }
937
938 public function editOrderObject(): void
939 {
940 $ilTabs = $this->tabs;
941 $this->edit_order = true;
942 $this->getModeManager()->setOrderingMode();
943 $this->renderObject();
944
945 $ilTabs->activateSubTab("ordering");
946 }
947
948 // Check if ordering is enabled
949 public function isActiveOrdering(): bool
950 {
951 return $this->edit_order;
952 }
953
954 public function isActiveItemOrdering(): bool
955 {
956 if ($this->isActiveOrdering()) {
958 }
959 return false;
960 }
961
962
963 // bugfix mantis 24559
964 // undoing an erroneous change inside mantis 23516 by adding "Download Multiple Objects"-functionality for non-admins
965 // as they don't have the possibility to use the multi-download-capability of the manage-tab
966 public function enableMultiDownloadObject(): void
967 {
968 $this->multi_download_enabled = true;
969 $this->renderObject();
970 }
971
972 public function isMultiDownloadEnabled(): bool
973 {
974 return $this->multi_download_enabled;
975 }
976
981 public function cutObject(): void
982 {
983 $rbacsystem = $this->rbacsystem;
984 $ilCtrl = $this->ctrl;
985 $ilErr = $this->error;
986
987 $ids = $this->std_request->getSelectedIds();
988 $no_cut = [];
989
990 if (count($ids) === 0) {
991 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"), true);
992 $this->ctrl->redirect($this, "");
993 }
994
995 // FOR ALL OBJECTS THAT SHOULD BE COPIED
996 foreach ($ids as $ref_id) {
997 // GET COMPLETE NODE_DATA OF ALL SUBTREE NODES
998 $node_data = $this->tree->getNodeData($ref_id);
999 $subtree_nodes = $this->tree->getSubTree($node_data);
1000
1001 $all_node_data[] = $node_data;
1002 $all_subtree_nodes[] = $subtree_nodes;
1003
1004 // CHECK DELETE PERMISSION OF ALL OBJECTS IN ACTUAL SUBTREE
1005 foreach ($subtree_nodes as $node) {
1006 if ($node['type'] === 'rolf') {
1007 continue;
1008 }
1009
1010 if (!$rbacsystem->checkAccess('delete', $node["ref_id"])) {
1011 $no_cut[] = $node["ref_id"];
1012 }
1013 }
1014 }
1015 // IF THERE IS ANY OBJECT WITH NO PERMISSION TO 'delete'
1016 if (count($no_cut)) {
1017 $titles = [];
1018 foreach ($no_cut as $cut_id) {
1019 $titles[] = ilObject::_lookupTitle(ilObject::_lookupObjId($cut_id));
1020 }
1021 $ilErr->raiseError(
1022 $this->lng->txt("msg_no_perm_cut") . " " . implode(',', $titles),
1023 $ilErr->MESSAGE
1024 );
1025 }
1026 $this->clipboard->setParent($this->requested_ref_id);
1027 $this->clipboard->setCmd($ilCtrl->getCmd());
1028 $this->clipboard->setRefIds($this->std_request->getSelectedIds());
1029
1030 $this->tpl->setOnScreenMessage('info', $this->lng->txt("msg_cut_clipboard"), true);
1031
1032 $this->initAndDisplayMoveIntoObjectObject();
1033 }
1034
1039 public function copyObject(): void
1040 {
1041 $rbacsystem = $this->rbacsystem;
1042 $ilCtrl = $this->ctrl;
1043 $objDefinition = $this->obj_definition;
1044 $ilErr = $this->error;
1045
1046 $no_copy = [];
1047
1048 $ids = $this->std_request->getSelectedIds();
1049
1050 if (count($ids) === 0) {
1051 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"), true);
1052 $this->ctrl->redirect($this, "");
1053 }
1054
1055 // FOR ALL OBJECTS THAT SHOULD BE COPIED
1056 $containers = 0;
1057 foreach ($ids as $ref_id) {
1058 // GET COMPLETE NODE_DATA OF ALL SUBTREE NODES
1059 $node_data = $this->tree->getNodeData($ref_id);
1060
1061 // count containers
1062 if ($objDefinition->isContainer($node_data["type"])) {
1063 $containers++;
1064 }
1065
1066 $subtree_nodes = $this->tree->getSubTree($node_data);
1067
1068 $all_node_data[] = $node_data;
1069 $all_subtree_nodes[] = $subtree_nodes;
1070
1071 // CHECK COPY PERMISSION OF ALL OBJECTS IN ACTUAL SUBTREE
1072 foreach ($subtree_nodes as $node) {
1073 if ($node['type'] === 'rolf') {
1074 continue;
1075 }
1076
1077 if (!$rbacsystem->checkAccess('visible,read', $node["ref_id"])) {
1078 $no_copy[] = $node["ref_id"];
1079 }
1080 }
1081 }
1082
1083 if ($containers > 0 && count($this->std_request->getSelectedIds()) > 1) {
1084 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("cntr_container_only_on_their_own"), true);
1085 $this->ctrl->redirect($this, "");
1086 }
1087
1088 // IF THERE IS ANY OBJECT WITH NO PERMISSION TO 'delete'
1089 if (is_array($no_copy) && count($no_copy)) {
1090 $titles = [];
1091 foreach ($no_copy as $copy_id) {
1092 $titles[] = ilObject::_lookupTitle(ilObject::_lookupObjId($copy_id));
1093 }
1094 $this->tpl->setOnScreenMessage(
1095 'failure',
1096 $this->lng->txt("msg_no_perm_copy") . " " . implode(',', $titles),
1097 true
1098 );
1099 $this->ctrl->redirect($this, "");
1100 }
1101
1102 // if we have a single container, set it as source id and redirect to ilObjectCopyGUI
1103 $ids = $this->std_request->getSelectedIds();
1104 if (count($ids) === 1) {
1105 $ilCtrl->setParameterByClass("ilobjectcopygui", "source_id", $ids[0]);
1106 } else {
1107 $ilCtrl->setParameterByClass("ilobjectcopygui", "source_ids", implode("_", $ids));
1108 }
1109 $ilCtrl->redirectByClass("ilobjectcopygui", "initTargetSelection");
1110
1111 $this->clipboard->setParent($this->requested_ref_id);
1112 $this->clipboard->setCmd($ilCtrl->getCmd());
1113 $this->clipboard->setRefIds($ids);
1114
1115 $this->tpl->setOnScreenMessage('info', $this->lng->txt("msg_copy_clipboard"), true);
1116
1117 $this->initAndDisplayCopyIntoMultipleObjectsObject();
1118 }
1119
1120 public function downloadObject(): void
1121 {
1122 if (in_array($this->user->getId(), [ANONYMOUS_USER_ID, 0], true)) {
1123 return;
1124 }
1125
1126 $ilErr = $this->error;
1127 // This variable determines whether the task has been initiated by a folder's action drop-down to prevent a folder
1128 // duplicate inside the zip.
1129 $initiated_by_folder_action = false;
1130
1131 $ids = $this->std_request->getSelectedIds();
1132
1133 if (count($ids) === 0) {
1134 $object = ilObjectFactory::getInstanceByRefId($this->requested_ref_id);
1135 $object_type = $object->getType();
1136 if ($object_type === "fold") {
1137 $ids = [$this->requested_ref_id];
1138 $initiated_by_folder_action = true;
1139 } else {
1140 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"), true);
1141 $this->ctrl->redirect($this, "");
1142 }
1143 }
1144
1145 foreach ($ids as $ref_id) {
1146 if (!in_array(ilObject::_lookupType($ref_id, true), ["crs", "grp", "fold", "file"])) {
1147 $this->lng->loadLanguageModule("cont");
1148 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("cont_only_crs_grp_fold_download"), true);
1149 $this->ctrl->redirect($this, "");
1150 }
1151 }
1152
1153 $download_job = new ilDownloadContainerFilesBackgroundTask(
1154 $GLOBALS['DIC']->user()->getId(),
1155 $ids,
1156 $initiated_by_folder_action
1157 );
1158
1159 $download_job->setBucketTitle($this->getBucketTitle());
1160 if ($download_job->run()) {
1161 $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_bt_download_started'), true);
1162 }
1163 $GLOBALS['DIC']->ctrl()->redirect($this);
1164 }
1165
1166 public function getBucketTitle(): string
1167 {
1168 return ilFileUtils::getASCIIFilename($this->object->getTitle());
1169 }
1170
1175 public function linkObject(): void
1176 {
1177 $rbacsystem = $this->rbacsystem;
1178 $ilCtrl = $this->ctrl;
1179 $ilErr = $this->error;
1180
1181 $no_cut = [];
1182 $no_link = [];
1183
1184 $ids = $this->std_request->getSelectedIds();
1185
1186 if (count($ids) === 0) {
1187 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"), true);
1188 $this->ctrl->redirect($this, "");
1189 }
1190
1191 // CHECK ACCESS
1192 foreach ($ids as $ref_id) {
1193 if (!$rbacsystem->checkAccess('delete', $ref_id)) {
1194 $no_cut[] = $ref_id;
1195 }
1196
1198
1199 if (!$this->obj_definition->allowLink($object->getType())) {
1200 $no_link[] = $object->getType();
1201 }
1202 }
1203
1204 // NO ACCESS
1205 if ($no_cut !== []) {
1206 $this->tpl->setOnScreenMessage(
1207 'failure',
1208 $this->lng->txt("msg_no_perm_link") . " " . implode(',', $no_cut),
1209 true
1210 );
1211 $this->ctrl->redirect($this, "");
1212 }
1213
1214 if ($no_link !== []) {
1215 //#12203
1216 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('msg_obj_no_link'), true);
1217 $this->ctrl->redirect($this, "");
1218 }
1219
1220 $this->clipboard->setParent($this->requested_ref_id);
1221 $this->clipboard->setCmd($ilCtrl->getCmd());
1222 $this->clipboard->setRefIds($ids);
1223
1224 $suffix = 'p';
1225 if (count($this->clipboard->getRefIds()) === 1) {
1226 $suffix = 's';
1227 }
1228 $this->tpl->setOnScreenMessage('info', $this->lng->txt("msg_link_clipboard_" . $suffix), true);
1229
1230 $this->initAndDisplayLinkIntoMultipleObjectsObject();
1231 }
1232
1236 public function clearObject(): void
1237 {
1238 $this->clipboard->clear();
1239
1240 //var_dump($this->getReturnLocation("clear",$this->ctrl->getLinkTarget($this)),get_class($this));
1241
1242 // only redirect if clipboard was cleared
1243 if ($this->ctrl->getCmd() === "clear") {
1244 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_clear_clipboard"), true);
1245 // fixed mantis 0018474: Clear Clipboard redirects to Subtab View, instead of Subtab "Edit Multiple"
1246 $this->ctrl->redirect($this, 'render');
1247 }
1248 }
1249
1251 {
1252 $rbacsystem = $this->rbacsystem;
1253 $rbacadmin = $this->rbacadmin;
1254 $rbacreview = $this->rbacreview;
1255 $ilLog = $this->log;
1256 $tree = $this->tree;
1257 $ilObjDataCache = $this->obj_data_cache;
1258 $ilUser = $this->user;
1259 $ilErr = $this->error;
1260 $lng = $this->lng;
1261 $ui = $this->ui;
1262
1263 $exists = [];
1264 $is_child = [];
1265 $not_allowed_subobject = [];
1266 $no_paste = [];
1267
1268 $command = $this->clipboard->getCmd();
1269 if (!in_array($command, ['cut', 'link', 'copy'])) {
1270 $message = __METHOD__ . ": cmd was neither 'cut', 'link' nor 'copy'; may be a hack attempt!";
1271 $ilErr->raiseError($message, $ilErr->WARNING);
1272 }
1273
1274 $nodes = $this->std_request->getNodes();
1275
1276 if (count($nodes) === 0) {
1277 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_at_least_one_object'));
1278 switch ($command) {
1279 case 'link':
1280 case 'copy':
1281 case 'cut':
1282 $this->showPasteTreeObject();
1283 break;
1284 }
1285 return;
1286 }
1287
1288 // this loop does all checks
1289 $folder_objects_cache = [];
1290 foreach ($this->clipboard->getRefIds() as $ref_id) {
1292 $current_parent_id = $tree->getParentId($obj_data->getRefId());
1293
1294 foreach ($nodes as $folder_ref_id) {
1295 if (!array_key_exists($folder_ref_id, $folder_objects_cache)) {
1296 $folder_objects_cache[$folder_ref_id] = ilObjectFactory::getInstanceByRefId($folder_ref_id);
1297 }
1298
1299 // CHECK ACCESS
1300 if (!$rbacsystem->checkAccess('create', $folder_ref_id, $obj_data->getType())) {
1301 $no_paste[] = sprintf(
1302 $this->lng->txt('msg_no_perm_paste_object_in_folder'),
1303 $obj_data->getTitle() . ' [' . $obj_data->getRefId() . ']',
1304 $folder_objects_cache[$folder_ref_id]->getTitle(
1305 ) . ' [' . $folder_objects_cache[$folder_ref_id]->getRefId() . ']'
1306 );
1307 }
1308
1309 // CHECK IF REFERENCE ALREADY EXISTS
1310 if ($folder_ref_id == $current_parent_id) {
1311 $exists[] = sprintf(
1312 $this->lng->txt('msg_obj_exists_in_folder'),
1313 $obj_data->getTitle() . ' [' . $obj_data->getRefId() . ']',
1314 $folder_objects_cache[$folder_ref_id]->getTitle(
1315 ) . ' [' . $folder_objects_cache[$folder_ref_id]->getRefId() . ']'
1316 );
1317 }
1318
1319 // CHECK IF PASTE OBJECT SHALL BE CHILD OF ITSELF
1320 if ($ref_id == $folder_ref_id || $tree->isGrandChild($ref_id, $folder_ref_id)) {
1321 $is_child[] = sprintf(
1322 $this->lng->txt('msg_paste_object_not_in_itself'),
1323 $obj_data->getTitle() . ' [' . $obj_data->getRefId() . ']'
1324 );
1325 }
1326
1327 // CHECK IF OBJECT IS ALLOWED TO CONTAIN PASTED OBJECT AS SUBOBJECT
1328 if (!array_key_exists(
1329 $obj_data->getType(),
1330 $folder_objects_cache[$folder_ref_id]->getPossibleSubObjects()
1331 )) {
1332 $not_allowed_subobject[] = sprintf(
1333 $this->lng->txt('msg_obj_may_not_contain_objects_of_type'),
1334 $folder_objects_cache[$folder_ref_id]->getTitle(
1335 ) . ' [' . $folder_objects_cache[$folder_ref_id]->getRefId() . ']',
1336 $lng->txt('obj_' . $obj_data->getType())
1337 );
1338 }
1339 }
1340 }
1341
1343 // process checking results
1344 $error = "";
1345 if ($command !== "copy" && count($exists)) {
1346 $error .= implode('<br />', $exists);
1347 }
1348
1349 if (count($is_child)) {
1350 $error .= $error !== '' ? '<br />' : '';
1351 $error .= implode('<br />', $is_child);
1352 }
1353
1354 if (count($not_allowed_subobject)) {
1355 $error .= $error !== '' ? '<br />' : '';
1356 $error .= implode('<br />', $not_allowed_subobject);
1357 }
1358
1359 if (count($no_paste)) {
1360 $error .= $error !== '' ? '<br />' : '';
1361 $error .= implode('<br />', $no_paste);
1362 }
1363
1364 if ($error !== '') {
1365 $this->tpl->setOnScreenMessage('failure', $error);
1366 switch ($command) {
1367 case 'link':
1368 case 'copy':
1369 case 'cut':
1370 $this->showPasteTreeObject();
1371 break;
1372 }
1373 return;
1374 }
1375
1376 // log pasteObject call
1377 $ilLog->write(__METHOD__ . ", cmd: " . $command);
1378
1380 // everything ok: now paste the objects to new location
1381
1382 // to prevent multiple actions via back/reload button
1383 $ref_ids = $this->clipboard->getRefIds();
1384 $this->clipboard->clear();
1385
1386
1387 // process COPY command
1388 if ($command === 'copy') {
1389 foreach ($nodes as $folder_ref_id) {
1390 foreach ($ref_ids as $ref_id) {
1391 $revIdMapping = [];
1392
1393 $oldNode_data = $tree->getNodeData($ref_id);
1394 if ($oldNode_data['parent'] == $folder_ref_id) {
1395 $newTitle = ilObjFileAccess::_appendNumberOfCopyToFilename($oldNode_data['title'], null);
1396 $newRef = $this->cloneNodes($ref_id, $folder_ref_id, $refIdMapping, $newTitle);
1397 } else {
1398 $newRef = $this->cloneNodes($ref_id, $folder_ref_id, $refIdMapping, null);
1399 }
1400
1401 // BEGIN ChangeEvent: Record copy event.
1402 $old_parent_data = $tree->getParentNodeData($ref_id);
1403 $newNode_data = $tree->getNodeData($newRef);
1405 $oldNode_data['type'],
1406 $ref_id,
1407 $oldNode_data['obj_id'],
1408 $ilUser->getId()
1409 );
1411 $newNode_data['obj_id'],
1412 $ilUser->getId(),
1413 'add',
1414 $ilObjDataCache->lookupObjId((int) $folder_ref_id)
1415 );
1416 // END PATCH ChangeEvent: Record cut event.
1417 }
1418 }
1419
1420 $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_cloned'), true);
1421 } // END COPY
1422
1423 // process CUT command
1424 if ($command === 'cut') {
1425 foreach ($nodes as $folder_ref_id) {
1426 foreach ($ref_ids as $ref_id) {
1427 // Store old parent
1428 $old_parent = $tree->getParentId($ref_id);
1429 $tree->moveTree($ref_id, $folder_ref_id);
1430 $rbacadmin->adjustMovedObjectPermissions($ref_id, $old_parent);
1431
1433 $availability = new ilObjectActivation();
1434 $availability->read($ref_id);
1435 $availability->update($ref_id, $folder_ref_id);
1436
1437 // BEGIN ChangeEvent: Record cut event.
1438 $node_data = $tree->getNodeData($ref_id);
1439 $old_parent_data = $tree->getNodeData($old_parent);
1441 $node_data['obj_id'],
1442 $ilUser->getId(),
1443 'remove',
1444 $old_parent_data['obj_id']
1445 );
1447 $node_data['obj_id'],
1448 $ilUser->getId(),
1449 'add',
1450 $ilObjDataCache->lookupObjId((int) $folder_ref_id)
1451 );
1452 // END PATCH ChangeEvent: Record cut event.
1453 }
1454
1455 // prevent multiple iterations for cut cmommand
1456 break;
1457 }
1458
1459 $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_cut_copied'), true);
1460 } // END CUT
1461
1462 // process LINK command
1463 if ($command === 'link') {
1464 $subnodes = [];
1465 $linked_to_folders = [];
1466
1467 $rbac_log_active = ilRbacLog::isActive();
1468
1469 foreach ($nodes as $folder_ref_id) {
1470 $linked_to_folders[$folder_ref_id] = $ilObjDataCache->lookupTitle(
1471 $ilObjDataCache->lookupObjId((int) $folder_ref_id)
1472 );
1473
1474 foreach ($ref_ids as $ref_id) {
1475 // get node data
1476 $top_node = $tree->getNodeData($ref_id);
1477
1478 // get subnodes of top nodes
1479 $subnodes[$ref_id] = $tree->getSubTree($top_node);
1480 }
1481
1482 // now move all subtrees to new location
1483 foreach ($subnodes as $key => $subnode) {
1484 // first paste top_node....
1485 $obj_data = ilObjectFactory::getInstanceByRefId($key);
1486 $new_ref_id = $obj_data->createReference();
1487 $obj_data->putInTree($folder_ref_id);
1488 $obj_data->setPermissions($folder_ref_id);
1489
1490 // rbac log
1491 if ($rbac_log_active) {
1492 $rbac_log_roles = $rbacreview->getParentRoleIds($new_ref_id, false);
1493 $rbac_log = ilRbacLog::gatherFaPa($new_ref_id, array_keys($rbac_log_roles), true);
1494 ilRbacLog::add(ilRbacLog::LINK_OBJECT, $new_ref_id, $rbac_log, $key);
1495 }
1496
1497 // BEGIN ChangeEvent: Record link event.
1498 $node_data = $tree->getNodeData($new_ref_id);
1500 $node_data['obj_id'],
1501 $ilUser->getId(),
1502 'add',
1503 $ilObjDataCache->lookupObjId((int) $folder_ref_id)
1504 );
1505 // END PATCH ChangeEvent: Record link event.
1506 }
1507
1508 $ilLog->write(__METHOD__ . ', link finished');
1509 }
1510
1511 $links = [];
1512 if (count($linked_to_folders)) {
1513 foreach ($linked_to_folders as $ref_id => $title) {
1514 $links[] = $ui->factory()->link()->standard($title, ilLink::_getLink($ref_id));
1515 }
1516 }
1517
1518 $suffix = 'p';
1519 if (count($ref_ids) === 1) {
1520 $suffix = 's';
1521 }
1522
1523 $mbox = $ui->factory()->messageBox()->success(
1524 $this->lng->txt('mgs_objects_linked_to_the_following_folders_' . $suffix)
1525 )
1526 ->withLinks($links);
1527
1528 $this->tpl->setOnScreenMessage('success', $ui->renderer()->render($mbox), true);
1529 } // END LINK
1530
1531 // clear clipboard
1532 $this->clearObject();
1533
1534 $this->ctrl->returnToParent($this);
1535 }
1536
1538 {
1539 $this->showPasteTreeObject();
1540 }
1541
1542 public function showPasteTreeObject(): void
1543 {
1544 $ilTabs = $this->tabs;
1545 $ilErr = $this->error;
1546
1547 $ilTabs->setTabActive('view_content');
1548
1549 if (!in_array($this->clipboard->getCmd(), ['link', 'copy', 'cut'])) {
1550 $message = __METHOD__ . ": Unknown action.";
1551 $ilErr->raiseError($message, $ilErr->WARNING);
1552 }
1553 $cmd = $this->clipboard->getCmd();
1554
1555 //
1556 $exp = $this->getTreeSelectorGUI($cmd);
1557 if ($exp->handleCommand()) {
1558 return;
1559 }
1560 $output = $exp->getHTML();
1561
1562 $txt_var = ($cmd === "copy")
1563 ? "copy"
1564 : "paste";
1565
1566 // toolbars
1567 $t = new ilToolbarGUI();
1568 $t->setFormAction($this->ctrl->getFormAction($this, "performPasteIntoMultipleObjects"));
1569
1570 $this->gui->button(
1571 $this->lng->txt($txt_var),
1572 "performPasteIntoMultipleObjects"
1573 )->submit()->toToolbar(true, $t);
1574
1575 $t->addSeparator();
1576 $this->lng->loadLanguageModule('obj');
1577 $t->addFormButton($this->lng->txt("obj_insert_into_clipboard"), "keepObjectsInClipboard");
1578
1579 $t->addFormButton($this->lng->txt("cancel"), "cancelMoveLink");
1580 $t->setCloseFormTag(false);
1581 $t->setLeadingImage(ilUtil::getImagePath("nav/arrow_upright.svg"), " ");
1582 $output = $t->getHTML() . $output;
1583 $t->setLeadingImage(ilUtil::getImagePath("nav/arrow_downright.svg"), " ");
1584 $t->setCloseFormTag(true);
1585 $t->setOpenFormTag(false);
1586 $output .= "<br />" . $t->getHTML();
1587
1588 $this->tpl->setContent($output);
1589 }
1590
1595 public function cancelMoveLinkObject(): void
1596 {
1597 $ilCtrl = $this->ctrl;
1598
1599 $this->clipboard->clear();
1600 $ilCtrl->returnToParent($this);
1601 }
1602
1603 public function keepObjectsInClipboardObject(): void
1604 {
1605 $ilCtrl = $this->ctrl;
1606
1607 $this->tpl->setOnScreenMessage('success', $this->lng->txt("obj_inserted_clipboard"), true);
1608 $ilCtrl->returnToParent($this);
1609 }
1610
1612 {
1613 $this->showPasteTreeObject();
1614 }
1615
1617 {
1618 $this->showPasteTreeObject();
1619 }
1620
1625 public function pasteObject(): void
1626 {
1627 $rbacsystem = $this->rbacsystem;
1628 $rbacadmin = $this->rbacadmin;
1629 $ilLog = $this->log;
1630 $tree = $this->tree;
1631 $ilUser = $this->user;
1632 $ilCtrl = $this->ctrl;
1633 $ilErr = $this->error;
1634
1635 $exists = [];
1636 $no_paste = [];
1637 $is_child = [];
1638 $not_allowed_subobject = [];
1639
1640
1641 if (!in_array($this->clipboard->getCmd(), ["cut", "link", "copy"])) {
1642 $message = get_class(
1643 $this
1644 ) . "::pasteObject(): cmd was neither 'cut','link' or 'copy'; may be a hack attempt!";
1645 $ilErr->raiseError($message, $ilErr->WARNING);
1646 }
1647
1648 // this loop does all checks
1649 foreach ($this->clipboard->getRefIds() as $ref_id) {
1651
1652 // CHECK ACCESS
1653 if (!$rbacsystem->checkAccess('create', $this->object->getRefId(), $obj_data->getType())) {
1654 $no_paste[] = $ref_id;
1655 $no_paste_titles[] = $obj_data->getTitle();
1656 }
1657
1658 // CHECK IF REFERENCE ALREADY EXISTS
1659 if ($this->object->getRefId() === $this->tree->getParentId($obj_data->getRefId())) {
1660 $exists[] = $ref_id;
1661 break;
1662 }
1663
1664 // CHECK IF PASTE OBJECT SHALL BE CHILD OF ITSELF
1665 if ($this->tree->isGrandChild($ref_id, $this->object->getRefId())) {
1667 }
1668
1669 if ($ref_id == $this->object->getRefId()) {
1671 }
1672
1673 // CHECK IF OBJECT IS ALLOWED TO CONTAIN PASTED OBJECT AS SUBOBJECT
1674 $obj_type = $obj_data->getType();
1675
1676 if (!array_key_exists($obj_type, $this->object->getPossibleSubObjects())) {
1677 $not_allowed_subobject[] = $obj_data->getType();
1678 }
1679 }
1680
1682 // process checking results
1683 // BEGIN WebDAV: Copying an object into the same container is allowed
1684 if (count($exists) > 0 && $this->clipboard->getCmd() !== "copy") {
1685 // END WebDAV: Copying an object into the same container is allowed
1686 $ilErr->raiseError($this->lng->txt("msg_obj_exists"), $ilErr->MESSAGE);
1687 }
1688
1689 if (count($is_child) > 0) {
1690 $ilErr->raiseError(
1691 $this->lng->txt("msg_not_in_itself") . " " . implode(',', $is_child),
1692 $ilErr->MESSAGE
1693 );
1694 }
1695
1696 if (count($not_allowed_subobject) > 0) {
1697 $ilErr->raiseError(
1698 $this->lng->txt("msg_may_not_contain") . " " . implode(',', $not_allowed_subobject),
1699 $ilErr->MESSAGE
1700 );
1701 }
1702
1703 if (count($no_paste) > 0) {
1704 $ilErr->raiseError(
1705 $this->lng->txt("msg_no_perm_paste") . " " .
1706 implode(',', $no_paste),
1707 $ilErr->MESSAGE
1708 );
1709 }
1710
1711 // log pasteObject call
1712 $ilLog->write("ilObjectGUI::pasteObject(), cmd: " . $this->clipboard->getCmd());
1713
1715 // everything ok: now paste the objects to new location
1716
1717 // to prevent multiple actions via back/reload button
1718 $ref_ids = $this->clipboard->getRefIds();
1719
1720 // save cmd for correct message output after clearing the clipboard
1721 $last_cmd = $this->clipboard->getCmd();
1722
1723 // BEGIN WebDAV: Support a copy command in the repository
1724 // process COPY command
1725 if ($this->clipboard->getCmd() === "copy") {
1726 $this->clipboard->clear();
1727
1728 // new implementation, redirects to ilObjectCopyGUI
1729 $ilCtrl->setParameterByClass("ilobjectcopygui", "target", $this->object->getRefId());
1730 if (count($ref_ids) === 1) {
1731 $ilCtrl->setParameterByClass("ilobjectcopygui", "source_id", $ref_ids[0]);
1732 } else {
1733 $ilCtrl->setParameterByClass("ilobjectcopygui", "source_ids", implode("_", $ref_ids));
1734 }
1735 $ilCtrl->redirectByClass("ilobjectcopygui", "saveTarget");
1736
1737 $ilLog->write("ilObjectGUI::pasteObject(), copy finished");
1738 }
1739 // END WebDAV: Support a Copy command in the repository
1740
1741 // process CUT command
1742 if ($this->clipboard->getCmd() === "cut") {
1743 foreach ($ref_ids as $ref_id) {
1744 // Store old parent
1745 $old_parent = $tree->getParentId($ref_id);
1746 $this->tree->moveTree($ref_id, $this->object->getRefId());
1747 $rbacadmin->adjustMovedObjectPermissions($ref_id, $old_parent);
1748
1750 $availability = new ilObjectActivation();
1751 $availability->read($ref_id);
1752 $availability->update($ref_id, $this->object->getRefId());
1753
1754 // BEGIN ChangeEvent: Record cut event.
1755 $node_data = $tree->getNodeData($ref_id);
1756 $old_parent_data = $tree->getNodeData($old_parent);
1758 $node_data['obj_id'],
1759 $ilUser->getId(),
1760 'remove',
1761 $old_parent_data['obj_id']
1762 );
1764 $node_data['obj_id'],
1765 $ilUser->getId(),
1766 'add',
1767 $this->object->getId()
1768 );
1769 // END PATCH ChangeEvent: Record cut event.
1770 }
1771 } // END CUT
1772
1773 // process LINK command
1774 $ref_id = 0;
1775 $subnodes = [];
1776 if ($this->clipboard->getCmd() === "link") {
1777 foreach ($ref_ids as $ref_id) {
1778 // get node data
1779 $top_node = $this->tree->getNodeData($ref_id);
1780
1781 // get subnodes of top nodes
1782 $subnodes[$ref_id] = $this->tree->getSubTree($top_node);
1783 }
1784 // now move all subtrees to new location
1785 foreach ($subnodes as $key => $subnode) {
1786 // first paste top_node....
1787 $obj_data = ilObjectFactory::getInstanceByRefId($key);
1788 $new_ref_id = $obj_data->createReference();
1789 $obj_data->putInTree($this->requested_ref_id);
1790 $obj_data->setPermissions($this->requested_ref_id);
1791
1792 // BEGIN ChangeEvent: Record link event.
1793 $node_data = $tree->getNodeData($new_ref_id);
1795 $node_data['obj_id'],
1796 $ilUser->getId(),
1797 'add',
1798 $this->object->getId()
1799 );
1800 // END PATCH ChangeEvent: Record link event.
1801 }
1802
1803 $ilLog->write("ilObjectGUI::pasteObject(), link finished");
1804 } // END LINK
1805
1806
1807 // clear clipboard
1808 $this->clearObject();
1809
1810 if ($last_cmd === "cut") {
1811 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_cut_copied"), true);
1812 } // BEGIN WebDAV: Support a copy command in repository
1813 elseif ($last_cmd === "copy") {
1814 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_cloned"), true);
1815 } elseif ($last_cmd === 'link') {
1816 // END WebDAV: Support copy command in repository
1817 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_linked"), true);
1818 }
1819
1820 $this->ctrl->returnToParent($this);
1821 }
1822
1823 // show clipboard
1824 public function clipboardObject(): void
1825 {
1826 $ilErr = $this->error;
1827 $ilLog = $this->log;
1828 $ilTabs = $this->tabs;
1829 $tpl = $this->tpl;
1830 $ilToolbar = $this->toolbar;
1831 $ilCtrl = $this->ctrl;
1832 $lng = $this->lng;
1833
1834 $ilTabs->activateTab("clipboard");
1835
1836 // function should not be called if clipboard is empty
1837 if (!$this->clipboard->hasEntries()) {
1838 $message = sprintf('%s::clipboardObject(): Illegal access. Clipboard variable is empty!', get_class($this));
1839 $ilLog->write($message, $ilLog->FATAL);
1840 $ilErr->raiseError($this->lng->txt("permission_denied"), $ilErr->WARNING);
1841 }
1842
1843 $data = [];
1844 foreach ($this->clipboard->getRefIds() as $ref_id) {
1845 if (!$tmp_obj = ilObjectFactory::getInstanceByRefId($ref_id, false)) {
1846 continue;
1847 }
1848
1849 $data[] = [
1850 "type" => $tmp_obj->getType(),
1851 "type_txt" => $this->lng->txt("obj_" . $tmp_obj->getType()),
1852 "title" => $tmp_obj->getTitle(),
1853 "cmd" => ($this->clipboard->getCmd() === "cut") ? $this->lng->txt("move") : $this->lng->txt(
1854 $this->clipboard->getCmd()
1855 ),
1856 "ref_id" => $ref_id,
1857 "obj_id" => $tmp_obj->getId()
1858 ];
1859
1860 unset($tmp_obj);
1861 }
1862
1863 $tab = new ilObjClipboardTableGUI($this, "clipboard");
1864 $tab->setData($data);
1865 $tpl->setContent($tab->getHTML());
1866
1867 if (count($data) > 0) {
1868 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
1869 $ilToolbar->addFormButton(
1870 $lng->txt("insert_object_here"),
1871 "paste"
1872 );
1873 $ilToolbar->addFormButton(
1874 $lng->txt("clear_clipboard"),
1875 "clear"
1876 );
1877 }
1878 }
1879
1880 public function isActiveAdministrationPanel(): bool
1881 {
1882 // #10081
1883 if ($this->object->getRefId() &&
1884 !$this->rbacsystem->checkAccess("visible,read", $this->object->getRefId())) {
1885 return false;
1886 }
1887
1888 return $this->getModeManager()->isAdminMode();
1889 }
1890
1891 public function setColumnSettings(ilColumnGUI $column_gui): void
1892 {
1893 $ilAccess = $this->access;
1894 parent::setColumnSettings($column_gui);
1895
1896 $column_gui->setItemPresentationManager(
1897 $this->item_presentation
1898 );
1899
1900 //if ($ilAccess->checkAccess("write", "", $this->object->getRefId())
1901 // && $this->allowBlocksConfigure())
1902 if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
1903 $column_gui->setBlockProperty("news", "settings", '1');
1904 //$column_gui->setBlockProperty("news", "public_notifications_option", true);
1905 $column_gui->setBlockProperty("news", "default_visibility_option", '1');
1906 $column_gui->setBlockProperty("news", "hide_news_block_option", '1');
1907 }
1908
1909 if ($this->isActiveAdministrationPanel()) {
1910 $column_gui->setAdminCommands(true);
1911 }
1912 }
1913
1917 public function allowBlocksMoving(): bool
1918 {
1919 return true;
1920 }
1921
1925 public function allowBlocksConfigure(): bool
1926 {
1927 return true;
1928 }
1929
1930
1935 public function cloneAllObject(): void
1936 {
1937 $ilCtrl = $this->ctrl;
1938
1939 $ilAccess = $this->access;
1940 $ilErr = $this->error;
1941 $rbacsystem = $this->rbacsystem;
1942
1943 $new_type = $this->std_request->getNewType();
1945 $clone_source = $this->std_request->getCloneSource();
1946
1947 if (!$rbacsystem->checkAccess('create', $ref_id, $new_type)) {
1948 $ilErr->raiseError($this->lng->txt('permission_denied'));
1949 }
1950 if (!$clone_source) {
1951 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'));
1952 $this->createObject();
1953 return;
1954 }
1955 if (!$ilAccess->checkAccess('write', '', $clone_source, $new_type)) {
1956 $ilErr->raiseError($this->lng->txt('permission_denied'));
1957 }
1958
1959 $options = $this->std_request->getCopyOptions();
1960 $orig = ilObjectFactory::getInstanceByRefId($clone_source);
1961 $result = $orig->cloneAllObject(
1962 $_COOKIE[session_name()],
1963 $_COOKIE['ilClientId'],
1964 $new_type,
1965 $ref_id,
1966 $clone_source,
1967 $options
1968 );
1969
1970 if (ilCopyWizardOptions::_isFinished($result['copy_id'])) {
1971 $this->tpl->setOnScreenMessage('success', $this->lng->txt("object_duplicated"), true);
1972 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $result['ref_id']);
1973 } else {
1974 $this->tpl->setOnScreenMessage('info', $this->lng->txt("object_copy_in_progress"), true);
1975 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $ref_id);
1976 }
1977 $ilCtrl->redirectByClass("ilrepositorygui", "");
1978 }
1979
1980 public function saveSortingObject(): void
1981 {
1982 $sorting = ilContainerSorting::_getInstance($this->object->getId());
1983
1984 // Allow comma
1985 $positions = $this->std_request->getPositions();
1986 $sorting->savePost($positions);
1987 $this->tpl->setOnScreenMessage('success', $this->lng->txt('cntr_saved_sorting'), true);
1988 $this->ctrl->redirect($this, "editOrder");
1989 }
1990
1991 // BEGIN WebDAV: Support a copy command in the repository
1992
1996 public function cloneNodes(
1997 int $srcRef,
1998 int $dstRef,
1999 array &$mapping,
2000 ?string $newName = null
2001 ): int {
2002 $tree = $this->tree;
2003
2004 // clone the source node
2005 $srcObj = ilObjectFactory::getInstanceByRefId($srcRef);
2006 $newRef = $srcObj->cloneObject($dstRef)->getRefId();
2007
2008 // We must immediately apply a new name to the object, to
2009 // prevent confusion of WebDAV clients about having two objects with identical
2010 // name in the repository.
2011 if (!is_null($newName)) {
2012 $newObj = ilObjectFactory::getInstanceByRefId($newRef);
2013 $newObj->setTitle($newName);
2014 $newObj->update();
2015 unset($newObj);
2016 }
2017 unset($srcObj);
2018 $mapping[$newRef] = $srcRef;
2019
2020 // clone all children of the source node
2021 $children = $tree->getChilds($srcRef);
2022 foreach ($tree->getChilds($srcRef) as $child) {
2023 // Don't clone role folders, because it does not make sense to clone local roles
2024 // FIXME - Maybe it does make sense (?)
2025 if ($child["type"] !== 'rolf') {
2026 $this->cloneNodes($child["ref_id"], $newRef, $mapping);
2027 } elseif (count($rolf = $tree->getChildsByType($newRef, "rolf"))) {
2028 $mapping[$rolf[0]["ref_id"]] = $child["ref_id"];
2029 }
2030 }
2031 return $newRef;
2032 }
2033 // END PATCH WebDAV: Support a copy command in the repository
2034
2035 // Modify list gui for presentation in container
2036 public function modifyItemGUI(
2037 ilObjectListGUI $a_item_list_gui,
2038 array $a_item_data
2039 ): void {
2040 /* not really implemented buildPath does not exist
2041 $lng = $this->lng;
2042
2043 if ($a_show_path) {
2044 $a_item_list_gui->addCustomProperty(
2045 $lng->txt('path'),
2046 ilContainer::buildPath($a_item_data['ref_id'], $this->object->getRefId()),
2047 false,
2048 true
2049 );
2050 }
2051 */
2052 }
2053
2057 public static function _buildPath(
2058 int $a_ref_id,
2059 int $a_course_ref_id
2060 ): string {
2061 global $DIC;
2062
2063 $tree = $DIC->repositoryTree();
2064 $path = "";
2065
2066 $path_arr = $tree->getPathFull($a_ref_id, $a_course_ref_id);
2067 $counter = 0;
2068 foreach ($path_arr as $data) {
2069 if ($counter++) {
2070 $path .= " > ";
2071 }
2072 $path .= $data['title'];
2073 }
2074
2075 return $path;
2076 }
2077
2078
2079 public function editStylePropertiesObject(): void
2080 {
2081 $this->content_style_gui
2082 ->redirectToObjectSettings();
2083 }
2084
2085 protected function showContainerPageTabs(): void
2086 {
2087 $ctrl = $this->ctrl;
2088 $tabs = $this->tabs;
2089 $tabs->clearTargets();
2090 $page_gui = new ilContainerPageGUI($this->object->getId());
2091 $tabs->setBackTarget($this->lng->txt('back'), $this->ctrl->getLinkTarget($page_gui, "edit"));
2092 }
2093
2095 bool $a_init = true
2096 ): void {
2097 global $DIC;
2098 $tpl = $this->tpl;
2099 $ilToolbar = $this->toolbar;
2100
2101 if ($a_init) {
2102 $this->tpl->setOnScreenMessage('info', $this->lng->txt('webdav_pwd_instruction'));
2103 $this->initFormPasswordInstruction();
2104 }
2105
2106 $uri_builder = new ilWebDAVUriBuilder($DIC->http()->request());
2107 $href = $uri_builder->getUriToMountInstructionModalByRef($this->object->getRefId());
2108
2109 $this->gui->button(
2110 $this->lng->txt("mount_webfolder"),
2111 "#"
2112 )->onClick("triggerWebDAVModal('$href'); return false;")->toToolbar();
2113
2114 $tpl->setContent($this->form->getHTML());
2115 }
2116
2121 {
2122 $this->form = new ilPropertyFormGUI();
2123 $this->form->setFormAction($this->ctrl->getFormAction($this));
2124
2125 // new password
2126 $ipass = new ilPasswordInputGUI($this->lng->txt("desired_password"), "new_password");
2127 $ipass->setRequired(true);
2128
2129 $this->form->addItem($ipass);
2130 $this->form->addCommandButton("savePassword", $this->lng->txt("save"));
2131 $this->form->addCommandButton('cancel', $this->lng->txt('cancel'));
2132
2133 $this->form->setTitle($this->lng->txt("chg_ilias_and_webfolder_password"));
2134 $this->form->setFormAction($this->ctrl->getFormAction($this));
2135
2136 return $this->form;
2137 }
2138
2139 protected function savePasswordObject(): void
2140 {
2141 $ilUser = $this->user;
2142
2143 $form = $this->initFormPasswordInstruction();
2144 if ($form->checkInput()) {
2145 $ilUser->resetPassword($this->form->getInput('new_password'));
2146 $this->tpl->setOnScreenMessage('success', $this->lng->txt('webdav_pwd_instruction_success'), true);
2147 $this->showPasswordInstructionObject(false);
2148 return;
2149 }
2150 $form->setValuesByPost();
2151 $this->showPasswordInstructionObject();
2152 }
2153
2157 public function redrawListItemObject(): void
2158 {
2159 $tpl = $this->tpl;
2160
2161 $html = null;
2162
2163 $child_ref_id = $this->std_request->getChildRefId();
2164 $parent_ref_id = $this->std_request->getParentRefId();
2165
2166 $item_data = $this->object->getSubItems(false, false, $child_ref_id);
2167 $container_view = $this->getContentGUI();
2168
2169 // see #41377 (material not redrawn, when not a direct child)
2170 $sess_data = [];
2171 if (isset($this->object->items["sess"])) {
2172 $sess_data = $this->object->items["sess"]; // before #41377
2173 } elseif (ilObject::_lookupType($parent_ref_id, true) === "sess") {
2174 $sess_data[] = [
2175 "obj_id" => ilObject::_lookupObjectId($parent_ref_id)
2176 ]; // added with #41377
2177 }
2178
2179 // list item is session material (not part of "_all"-items - see below)
2180 $event_items = ilEventItems::_getItemsOfContainer($this->object->getRefId());
2181 if (in_array($child_ref_id, $event_items)) {
2182 foreach (($sess_data) as $id) {
2183 $items = ilObjectActivation::getItemsByEvent($id['obj_id']);
2184 foreach ($items as $event_item) {
2185 if ($event_item["child"] == $child_ref_id) {
2186 // sessions
2187 if ($parent_ref_id > 0) {
2188 $event_item["parent"] = $parent_ref_id;
2189 }
2190 $html = $container_view->renderItem($event_item);
2191 }
2192 }
2193 }
2194 }
2195
2196 // "normal" list item
2197 if (!$html) {
2198 foreach (($this->object->items["_all"] ?? []) as $id) {
2199 if ($id["child"] == $child_ref_id) {
2200 $html = $container_view->renderItem($id);
2201 }
2202 }
2203 }
2204
2205 if ($html) {
2206 echo $html;
2207
2208 // we need to add onload code manually (rating, comments, etc.)
2209 echo $tpl->getOnLoadCodeForAsynch();
2210 }
2211
2212 exit;
2213 }
2214
2215 protected function initEditForm(): ilPropertyFormGUI
2216 {
2217 $lng = $this->lng;
2218 $lng->loadLanguageModule($this->object->getType());
2219
2220 $form = new ilPropertyFormGUI();
2221 $form->setFormAction($this->ctrl->getFormAction($this, "update"));
2222 $form->setTitle($this->lng->txt($this->object->getType() . "_edit"));
2223
2224 $this->initFormTitleDescription($form);
2225
2226 $this->initEditCustomForm($form);
2227
2228 $form->addCommandButton("update", $this->lng->txt("save"));
2229
2230 return $form;
2231 }
2232
2236 public function initFormTitleDescription(ilPropertyFormGUI $form): void
2237 {
2238 $trans = null;
2239 if ($this->getCreationMode() === false) {
2241 $trans = $this->object->getObjectTranslation();
2242 }
2243 $title = new ilTextInputGUI($this->lng->txt("title"), "title");
2244 $title->setRequired(true);
2245 $title->setSize(min(40, ilObject::TITLE_LENGTH));
2246 $title->setMaxLength(ilObject::TITLE_LENGTH);
2247 $form->addItem($title);
2248
2249 if ($this->getCreationMode() === false && count($trans->getLanguages()) > 1) {
2250 $languages = $this->domain->metadata()->getLOMLanguagesForSelectInputs();
2251 $title->setInfo(
2252 $this->lng->txt("language") . ": " . $languages[$trans->getDefaultLanguage()] .
2253 ' <a href="' . $this->ctrl->getLinkTargetByClass(TranslationGUI::class, "") .
2254 '">&raquo; ' . $this->lng->txt("obj_more_translations") . '</a>'
2255 );
2256
2257 unset($languages);
2258 }
2259 $desc = new ilTextAreaInputGUI($this->lng->txt("description"), "desc");
2260 $desc->setRows(2);
2261 $desc->setCols(40);
2262 $desc->setMaxNumOfChars(ilObject::LONG_DESC_LENGTH);
2263 $form->addItem($desc);
2264
2265 if ($this->getCreationMode() === false) {
2266 $title->setValue($trans->getDefaultTitle());
2267 $desc->setValue($trans->getDefaultDescription());
2268 }
2269 }
2270
2274 protected function initSortingForm(
2275 ilPropertyFormGUI $form,
2276 array $a_sorting_settings
2278 $settings = new ilContainerSortingSettings($this->object->getId());
2279 $sort = new ilRadioGroupInputGUI($this->lng->txt('sorting_header'), "sorting");
2280
2281 if (in_array(ilContainer::SORT_INHERIT, $a_sorting_settings)) {
2282 $sort_inherit = new ilRadioOption();
2283 $sort_inherit->setTitle(
2284 $this->lng->txt('sort_inherit_prefix') .
2287 $this->object->getId()
2288 )
2289 ) . ') '
2290 );
2291 $sort_inherit->setValue((string) ilContainer::SORT_INHERIT);
2292 $sort_inherit->setInfo($this->lng->txt('sorting_info_inherit'));
2293 $sort->addOption($sort_inherit);
2294 }
2295 if (in_array(ilContainer::SORT_TITLE, $a_sorting_settings)) {
2296 $sort_title = new ilRadioOption(
2297 $this->lng->txt('sorting_title_header'),
2299 );
2300 $sort_title->setInfo($this->lng->txt('sorting_info_title'));
2301
2302 $this->initSortingDirectionForm($settings, $sort_title, 'title');
2303 $sort->addOption($sort_title);
2304 }
2305 if (in_array(ilContainer::SORT_CREATION, $a_sorting_settings)) {
2306 $sort_activation = new ilRadioOption(
2307 $this->lng->txt('sorting_creation_header'),
2309 );
2310 $sort_activation->setInfo($this->lng->txt('sorting_creation_info'));
2311 $this->initSortingDirectionForm($settings, $sort_activation, 'creation');
2312 $sort->addOption($sort_activation);
2313 }
2314 if (in_array(ilContainer::SORT_ACTIVATION, $a_sorting_settings)) {
2315 $sort_activation = new ilRadioOption($this->lng->txt('crs_sort_activation'), (string) ilContainer::SORT_ACTIVATION);
2316 $sort_activation->setInfo($this->lng->txt('crs_sort_timing_info'));
2317 $this->initSortingDirectionForm($settings, $sort_activation, 'activation');
2318 $sort->addOption($sort_activation);
2319 }
2320 if (in_array(ilContainer::SORT_MANUAL, $a_sorting_settings)) {
2321 $sort_manual = new ilRadioOption(
2322 $this->lng->txt('sorting_manual_header'),
2324 );
2325 $sort_manual->setInfo($this->lng->txt('sorting_info_manual'));
2326 $this->initManualSortingOptionForm($settings, $sort_manual, "manual", $a_sorting_settings);
2327 $sort->addOption($sort_manual);
2328 }
2329
2330 // Handle moved containers and there possibly invalid values
2331 if (in_array($settings->getSortMode(), $a_sorting_settings)) {
2332 $sort->setValue((string) $settings->getSortMode());
2333 } else {
2334 $sort->setValue((string) ilContainer::SORT_TITLE);
2335 }
2336 $form->addItem($sort);
2337
2338 return $form;
2339 }
2340
2345 {
2346 $lpres = new ilRadioGroupInputGUI($this->lng->txt('cont_list_presentation'), "list_presentation");
2347
2348 $item_list = new ilRadioOption($this->lng->txt('cont_item_list'), "");
2349 $item_list->setInfo($this->lng->txt('cont_item_list_info'));
2350 $lpres->addOption($item_list);
2351
2352 $tile_view = new ilRadioOption($this->lng->txt('cont_tile_view'), "tile");
2353 $tile_view->setInfo($this->lng->txt('cont_tile_view_info'));
2354 $lpres->addOption($tile_view);
2355
2356 // tile size
2357
2358 $si = new ilRadioGroupInputGUI($this->lng->txt("cont_tile_size"), "tile_size");
2359 foreach ($this->object->getTileSizes() as $key => $txt) {
2360 $op = new ilRadioOption($txt, $key);
2361 $si->addOption($op);
2362 }
2363 $tile_view->addSubItem($si);
2364 $si->setValue(
2365 (string) ((int) ilContainer::_lookupContainerSetting($this->object->getId(), "tile_size"))
2366 );
2367
2368 $lpres->setValue(
2369 ilContainer::_lookupContainerSetting($this->object->getId(), "list_presentation")
2370 );
2371
2372 $form->addItem($lpres);
2373
2374 return $form;
2375 }
2376
2377 protected function saveListPresentation(ilPropertyFormGUI $form): void
2378 {
2379 $val = ($form->getInput('list_presentation') === "tile")
2380 ? "tile"
2381 : "";
2382 ilContainer::_writeContainerSetting($this->object->getId(), "list_presentation", $val);
2384 $this->object->getId(),
2385 "tile_size",
2386 (string) ((int) $form->getInput('tile_size'))
2387 );
2388 }
2389
2393 protected function initSortingDirectionForm(
2394 ilContainerSortingSettings $sorting_settings,
2395 ilRadioOption $element,
2396 string $a_prefix
2397 ): ilRadioOption {
2398 if ($a_prefix === 'manual') {
2399 $txt = $this->lng->txt('sorting_new_items_direction');
2400 } else {
2401 $txt = $this->lng->txt('sorting_direction');
2402 }
2403
2404 $direction = new ilRadioGroupInputGUI($txt, $a_prefix . '_sorting_direction');
2405 $direction->setValue((string) $sorting_settings->getSortDirection());
2406 $direction->setRequired(true);
2407
2408 // asc
2409 $asc = new ilRadioOption(
2410 $this->lng->txt('sorting_asc'),
2412 );
2413 $direction->addOption($asc);
2414
2415 // desc
2416 $desc = new ilRadioOption(
2417 $this->lng->txt('sorting_desc'),
2419 );
2420 $direction->addOption($desc);
2421
2422 $element->addSubItem($direction);
2423
2424 return $element;
2425 }
2426
2432 ilRadioOption $element,
2433 string $a_prefix,
2434 array $a_sorting_settings
2435 ): ilRadioOption {
2436 $position = new ilRadioGroupInputGUI(
2437 $this->lng->txt('sorting_new_items_position'),
2438 $a_prefix . '_new_items_position'
2439 );
2440 $position->setValue((string) $settings->getSortNewItemsPosition());
2441 $position->setRequired(true);
2442
2443 //new items insert on top
2444 $new_top = new ilRadioOption(
2445 $this->lng->txt('sorting_new_items_at_top'),
2447 );
2448
2449 $position->addOption($new_top);
2450
2451 //new items insert at bottom
2452 $new_bottom = new ilRadioOption(
2453 $this->lng->txt('sorting_new_items_at_bottom'),
2455 );
2456
2457 $position->addOption($new_bottom);
2458
2459 $element->addSubItem($position);
2460
2461 $order = new ilRadioGroupInputGUI($this->lng->txt('sorting_new_items_order'), $a_prefix . '_new_items_order');
2462 $order->setValue((string) $settings->getSortNewItemsOrder());
2463 $order->setRequired(true);
2464
2465 if (in_array(ilContainer::SORT_TITLE, $a_sorting_settings)) {
2466 //new items sort in alphabetical order
2467 $new_title = new ilRadioOption(
2468 $this->lng->txt('sorting_title_header'),
2470 );
2471
2472 $order->addOption($new_title);
2473 }
2474
2475 if (in_array(ilContainer::SORT_CREATION, $a_sorting_settings)) {
2476 //new items sort by creation date
2477 $new_creation = new ilRadioOption(
2478 $this->lng->txt('sorting_creation_header'),
2480 );
2481
2482 $order->addOption($new_creation);
2483 }
2484
2485 if (in_array(ilContainer::SORT_ACTIVATION, $a_sorting_settings)) {
2486 //new items by activation
2487 $new_activation = new ilRadioOption(
2488 $this->lng->txt('crs_sort_activation'),
2490 );
2491
2492 $order->addOption($new_activation);
2493 }
2494
2495 $element->addSubItem($order);
2496
2497 $this->initSortingDirectionForm($settings, $element, 'manual');
2498
2499 return $element;
2500 }
2501
2502 protected function saveSortingSettings(ilPropertyFormGUI $form): void
2503 {
2504 $settings = new ilContainerSortingSettings($this->object->getId());
2505 $settings->setSortMode((int) $form->getInput("sorting"));
2506
2507 switch ($form->getInput('sorting')) {
2509 $settings->setSortDirection((int) $form->getInput('title_sorting_direction'));
2510 break;
2512 $settings->setSortDirection((int) $form->getInput('activation_sorting_direction'));
2513 break;
2515 $settings->setSortDirection((int) $form->getInput('creation_sorting_direction'));
2516 break;
2518 $settings->setSortNewItemsPosition($form->getInput('manual_new_items_position'));
2519 $settings->setSortNewItemsOrder($form->getInput('manual_new_items_order'));
2520 $settings->setSortDirection((int) $form->getInput('manual_sorting_direction'));
2521 break;
2522 }
2523
2524 $settings->update();
2525 }
2526
2530 public function trashObject(): void
2531 {
2532 $this->checkPermission("write");
2533 $tpl = $this->tpl;
2534
2535 $this->tabs_gui->activateTab('trash');
2536
2537 $this->lng->loadLanguageModule('cont');
2538 $tpl->setOnScreenMessage('info', $this->lng->txt('cont_trash_general_usage'));
2539
2540 $trash_table = new ilTrashTableGUI($this, 'trash', $this->object->getRefId());
2541 $trash_table->init();
2542 $trash_table->parse();
2543
2544 $trash_table->setFilterCommand('trashApplyFilter');
2545 $trash_table->setResetCommand('trashResetFilter');
2546
2547 $tpl->setContent($trash_table->getHTML());
2548 }
2549
2550 public function trashApplyFilterObject(): void
2551 {
2552 $this->trashHandleFilter(true, false);
2553 }
2554
2555 public function trashResetFilterObject(): void
2556 {
2557 $this->trashHandleFilter(false, true);
2558 }
2559
2560 protected function trashHandleFilter(bool $action_apply, bool $action_reset): void
2561 {
2562 $trash_table = new ilTrashTableGUI($this, 'trash', $this->object->getRefId());
2563 $trash_table->init();
2564 $trash_table->resetOffset();
2565 if ($action_reset) {
2566 $trash_table->resetFilter();
2567 }
2568 if ($action_apply) {
2569 $trash_table->writeFilterToSession();
2570 }
2571 $this->trashObject();
2572 }
2573
2574 public function removeFromSystemObject(): void
2575 {
2576 $this->checkPermission("write");
2577 $ru = new ilRepositoryTrashGUI($this);
2578 $ru->removeObjectsFromSystem($this->std_request->getTrashIds());
2579 $this->ctrl->redirect($this, "trash");
2580 }
2581
2582 protected function restoreToNewLocationObject(?ilPropertyFormGUI $form = null): void
2583 {
2584 $this->tabs_gui->activateTab('trash');
2585
2586 $ru = new ilRepositoryTrashGUI($this);
2587 $ru->restoreToNewLocation();
2588 }
2589
2593 public function undeleteObject(): void
2594 {
2595 $ru = new ilRepositoryTrashGUI($this);
2596 $ru->restoreObjects(
2597 $this->requested_ref_id,
2598 $this->std_request->getTrashIds()
2599 );
2600 $this->ctrl->redirect($this, "trash");
2601 }
2602
2603 public function confirmRemoveFromSystemObject(): void
2604 {
2605 $lng = $this->lng;
2606 $this->checkPermission("write");
2607 if (count($this->std_request->getTrashIds()) == 0) {
2608 $this->tpl->setOnScreenMessage('failure', $lng->txt("no_checkbox"), true);
2609 $this->ctrl->redirect($this, "trash");
2610 }
2611
2612 $ru = new ilRepositoryTrashGUI($this);
2613 $ru->confirmRemoveFromSystemObject($this->std_request->getTrashIds());
2614 }
2615
2616 protected function getTreeSelectorGUI(string $cmd): ilTreeExplorerGUI
2617 {
2618 $exp = new ilRepositorySelectorExplorerGUI($this, "showPasteTree");
2619 // TODO: The study programme 'prg' is not included here, as the
2620 // ilRepositorySelectorExplorerGUI only handles static rules for
2621 // parent-child-relations and not the dynamic relationsships
2622 // required for the SP (see #16909).
2623 $exp->setTypeWhiteList(["root", "cat", "grp", "crs", "fold"]);
2624
2625 // Not all types are allowed in the LearningSequence
2626 // Extend whitelist, if all selected types are possible subojects of LSO
2627 if (in_array($this->clipboard->getCmd(), ["link", "cut"])) {
2628 $lso_types = array_keys($this->obj_definition->getSubObjects('lso'));
2629 $refs = $this->clipboard->getRefIds();
2630 $allow_lso = true;
2631 foreach ($refs as $item_ref_id) {
2632 $type = ilObject::_lookupType($item_ref_id, true);
2633 if (!in_array($type, $lso_types)) {
2634 $allow_lso = false;
2635 }
2636 }
2637 if ($allow_lso) {
2638 $whitelist = $exp->getTypeWhiteList();
2639 $whitelist[] = 'lso';
2640 $exp->setTypeWhiteList($whitelist);
2641 }
2642 }
2643
2644 if ($cmd === "link") {
2645 $exp->setSelectMode("nodes", true);
2646 } else {
2647 $exp->setSelectMode("nodes[]", false);
2648 }
2649 return $exp;
2650 }
2651
2652 public function setSideColumnReturn(): void
2653 {
2654 $this->ctrl->setReturn($this, "");
2655 }
2656
2657 protected function initFilter(): void
2658 {
2659 global $DIC;
2660
2661 if (!$this->object || !ilContainer::_lookupContainerSetting($this->object->getId(), "filter", '0')) {
2662 return;
2663 }
2664
2665 if ($this->isActiveOrdering() || $this->ctrl->getCmd() === "editOrder") {
2666 return;
2667 }
2668
2669 $filter_service = $this->container_filter_service;
2670 $request = $DIC->http()->request();
2671
2672 $filter = $filter_service->util()->getFilterForRefId(
2673 $this->ref_id,
2674 $DIC->ctrl()->getLinkTarget($this, "render", "", true),
2675 $this->isActiveAdministrationPanel()
2676 );
2677
2678 $filter_data = $DIC->uiService()->filter()->getData($filter);
2679
2680 $this->container_user_filter = $filter_service->userFilter($filter_data);
2681 $this->ui_filter = $filter;
2682 }
2683
2684 protected function showContainerFilter(): void
2685 {
2686 global $DIC;
2687 if (!is_null($this->ui_filter)) {
2688 $renderer = $DIC->ui()->renderer();
2689
2690 $main_tpl = $this->tpl;
2691 $main_tpl->setFilter($renderer->render($this->ui_filter));
2692 if ($this->container_user_filter->isEmpty() && !ilContainer::_lookupContainerSetting(
2693 $this->object->getId(),
2694 "filter_show_empty",
2695 '0'
2696 )) {
2697 $this->tpl->setOnScreenMessage('info', $this->lng->txt("cont_filter_empty"));
2698 }
2699 }
2700 }
2701
2702 public function getAdminTabs(): void
2703 {
2704 if ($this->checkPermissionBool("visible,read")) {
2705 $this->tabs_gui->addTab(
2706 'view',
2707 $this->lng->txt('view'),
2708 $this->ctrl->getLinkTarget($this, 'view')
2709 );
2710 }
2711
2712 if ($this->checkPermissionBool("write")) {
2713 $this->tabs_gui->addTab(
2714 'trash',
2715 $this->lng->txt('trash'),
2716 $this->ctrl->getLinkTarget($this, 'trash')
2717 );
2718 }
2719
2720 if ($this->checkPermissionBool("edit_permission")) {
2721 $this->tabs_gui->addTab(
2722 'perm_settings',
2723 $this->lng->txt('perm_settings'),
2724 $this->ctrl->getLinkTargetByClass(
2725 [
2726 get_class($this),
2727 'ilpermissiongui'
2728 ],
2729 'perm'
2730 )
2731 );
2732 }
2733 }
2734
2735 public function competencesObject(): void
2736 {
2737 $ctrl = $this->ctrl;
2738
2739 $ctrl->redirectByClass(["ilContainerSkillGUI", "ilContSkillPresentationGUI"]);
2740 }
2741}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
$renderer
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:544
Provides fluid interface to RBAC services.
Definition: UIServices.php:25
Render add new item selector.
Manages items in repository clipboard.
error(string $a_errmsg)
Global event handler.
static _recordReadEvent(string $a_type, int $a_ref_id, int $obj_id, int $usr_id, $a_ext_rc=null, $a_ext_time=null)
static _recordWriteEvent(int $obj_id, int $usr_id, string $action, ?int $parent_obj_id=null)
Records a write event.
Column user interface class.
setAdminCommands(bool $a_admincommands)
setItemPresentationManager(ItemPresentationManager $item_presentation)
setBlockProperty(string $a_block_type, string $a_property, string $a_value)
This function is supposed to be used for block type specific properties, that should be passed to ilB...
static _adjustMovedObjectConditions(int $a_ref_id)
In the moment it is not allowed to create preconditions on objects that are located outside of a cour...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Parent class of all container content GUIs.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilContainerGUI This is a base GUI class for all container objects in ILIAS: root folder,...
clearObject()
clear clipboard and go back to last object
ILIAS Container InternalGUIService $gui
ilRbacSystem $rbacsystem
afterUpdate()
Post (successful) object update hook.
ilAppEventHandler $app_event_handler
StandardGUIRequest $std_request
ModeManager $mode_manager
ilObjectDefinition $obj_definition
restoreToNewLocationObject(?ilPropertyFormGUI $form=null)
addStandardContainerSubTabs(bool $a_include_view=true)
Add standard container subtabs for view, manage, oderdering and text/media editor link.
ilComponentFactory $component_factory
initFormPasswordInstruction()
Init password form.
ILIAS Container InternalDomainService $domain
modifyItemGUI(ilObjectListGUI $a_item_list_gui, array $a_item_data)
ILIAS Style Content DomainService $content_style_domain
initManualSortingOptionForm(ilContainerSortingSettings $settings, ilRadioOption $element, string $a_prefix, array $a_sorting_settings)
Add manual sorting options.
trashObject()
Show trash content of object.
cutObject()
cut object(s) out from a container and write the information to clipboard @access public
getItemPresentation( $include_empty_blocks=true, ?string $lang=null)
initSortingForm(ilPropertyFormGUI $form, array $a_sorting_settings)
Append sorting settings to property form.
initSortingDirectionForm(ilContainerSortingSettings $sorting_settings, ilRadioOption $element, string $a_prefix)
Add sorting direction.
ilContainerUserFilter $container_user_filter
cancelMoveLinkObject()
Cancel move|link empty clipboard and return to parent.
allowBlocksConfigure()
Standard is to allow blocks configuration.
ilPropertyFormGUI $form
trashHandleFilter(bool $action_apply, bool $action_reset)
renderBlockAsynchObject()
render the object
ILIAS Container Content ItemPresentationManager $item_presentation
redrawListItemObject()
Redraw a list item (ajax)
undeleteObject()
Get objects back from trash.
showPasswordInstructionObject(bool $a_init=true)
ilRbacReview $rbacreview
pasteObject()
paste object from clipboard to current place Depending on the chosen command the object(s) are linked...
ilContainerFilterService $container_filter_service
ilErrorHandling $error
ClipboardManager $clipboard
saveListPresentation(ilPropertyFormGUI $form)
getTreeSelectorGUI(string $cmd)
addHeaderRow(ilTemplate $a_tpl, string $a_type, bool $a_show_image=true)
getAdminTabs()
administration tabs show only permissions and trash folder
initListPresentationForm(ilPropertyFormGUI $form)
Add list presentation settings to form.
allowBlocksMoving()
Standard is to allow blocks moving.
copyObject()
Copy object(s) out from a container and write the information to clipboard It is not possible to copy...
setColumnSettings(ilColumnGUI $column_gui)
showPossibleSubObjects()
show possible sub objects (pull down menu)
linkObject()
create an new reference of an object in tree it's like a hard link of unix
ILIAS Style Content GUIService $content_style_gui
cloneNodes(int $srcRef, int $dstRef, array &$mapping, ?string $newName=null)
Recursively clones all nodes of the RBAC tree.
saveSortingSettings(ilPropertyFormGUI $form)
ilObjectDataCache $obj_data_cache
addMessageRow(ilTemplate $a_tpl, string $a_message, string $a_type)
cloneAllObject()
Clone all object Overwritten method for copying container objects.
getTabs()
@abstract overwrite in derived GUI class of your object type
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Container page GUI class.
Container page object.
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 lookupSortModeFromParentContainer(int $a_obj_id)
static sortModeToString(int $a_sort_mode)
Get string representation of sort mode.
static _getInstance(int $a_obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _writeContainerSetting(int $a_id, string $a_keyword, string $a_value)
const SORT_DIRECTION_DESC
const SORT_NEW_ITEMS_ORDER_ACTIVATION
const SORT_NEW_ITEMS_ORDER_TITLE
const SORT_NEW_ITEMS_ORDER_CREATION
const SORT_NEW_ITEMS_POSITION_BOTTOM
const SORT_NEW_ITEMS_POSITION_TOP
const SORT_DIRECTION_ASC
static _lookupContainerSetting(int $a_id, string $a_keyword, ?string $a_default_value=null)
static _isFinished(int $a_copy_id)
Error Handling & global info handling.
static _getItemsOfContainer(int $a_ref_id)
static getASCIIFilename(string $a_filename)
special template class to simplify handling of ITX/PEAR
loadLanguageModule(string $a_module)
Load language module.
Component logger with individual log levels by component id.
static showMemberViewSwitch(int $a_ref_id)
static _appendNumberOfCopyToFilename($a_file_name, $nth_copy=null)
Appends the text " - Copy" to a filename in the language of the current user.
Class ilObjectActivation.
static getItemsByEvent(int $event_id)
Get session material / event items.
class ilObjectDataCache
parses the objects.xml it handles the xml-description of all ilias objects
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
Class ilObjectGUI Basic methods of all Output classes.
ilLanguage $lng
static _lookupObjectId(int $ref_id)
static _lookupType(int $id, bool $reference=false)
const TITLE_LENGTH
const LONG_DESC_LENGTH
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
static _exists(string $a_parent_type, int $a_id, string $a_lang="", bool $a_no_cache=false)
Checks whether page exists.
static _existsAndNotEmpty(string $a_parent_type, int $a_id, string $a_lang="-")
checks whether page exists and is not empty (may return true on some empty pages)
This class represents a password property in a property form.
This class represents a property form user interface.
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...
This class represents a property in a property form.
This class represents an option in a radio group.
Class ilRbacAdmin Core functions for role based access control.
static add(int $action, int $ref_id, array $diff, bool $source_ref_id=false)
static gatherFaPa(int $ref_id, array $role_ids, bool $add_action=false)
const LINK_OBJECT
static isActive()
class ilRbacReview Contains Review functions of core Rbac.
class ilRbacSystem system function like checkAccess, addActiveRole ... Supporting system functions ar...
Explorer for selecting repository items.
Repository GUI Utilities.
ILIAS Setting Class.
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
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
touchBlock(string $block)
This class represents a text area property in a property form.
This class represents a text property in a property form.
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...
Explorer class that works on tree objects (Services/Tree)
Util class various functions, usage as namespace.
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static getStyleSheetLocation(string $mode="output", string $a_css_name="")
get full style sheet file name (path inclusive) of current user
const ANONYMOUS_USER_ID
Definition: constants.php:27
exit
$requested_ref_id
Definition: feed.php:40
This describes a standard filter.
Definition: Standard.php:27
$ref_id
Definition: ltiauth.php:66
$log
Definition: ltiresult.php:34
$path
Definition: ltiservices.php:30
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
form(?array $class_path, string $cmd, string $submit_caption="")
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
global $lng
Definition: privfeed.php:31
global $ilSetting
Definition: privfeed.php:31
$ilErr
Definition: raiseError.php:33
if(!file_exists('../ilias.ini.php'))
global $DIC
Definition: shib_login.php:26
$counter
$GLOBALS["DIC"]
Definition: wac.php:54
$_COOKIE[session_name()]
Definition: xapitoken.php:52