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