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