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