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