ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
class.ilObjOrgUnitGUI.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
23 
45 {
46  public const TAB_POSITIONS = 'positions';
47  public const TAB_ORGU_TYPES = 'orgu_types';
48  public const TAB_SETTINGS = "settings";
49  public const TAB_STAFF = 'orgu_staff';
50  public const TAB_GLOBAL_SETTINGS = 'global_settings';
51  public const TAB_EXPORT = 'export';
52  public const TAB_VIEW_CONTENT = 'view_content';
53  public const CMD_EDIT_SETTINGS = 'editSettings';
54 
55  public ilCtrl $ctrl;
60  public ilTree $tree;
61  public ?ilObject $object;
62  protected \ILIAS\DI\LoggingServices $ilLog;
63  public Ilias $ilias;
64 
65  public function __construct()
66  {
67  global $DIC;
68  $this->ilLocator = $DIC['ilLocator'];
69  $this->tree = $DIC->repositoryTree();
70  $this->toolbar = $DIC->toolbar();
71  $this->ilLog = $DIC->logger();
72  $this->ilias = $DIC['ilias'];
73  $this->type = 'orgu';
74 
76  $this->ctrl = $dic['ctrl'];
77  $this->ilAccess = $dic['access'];
78  $to_int = $dic['refinery']->kindlyTo()->int();
79  $this->ref_id = $dic['query']->retrieve('ref_id', $to_int);
80 
81  parent::__construct(array(), $this->ref_id, true, false);
82 
83  $this->lng = $dic['lng'];
84  $this->lng->loadLanguageModule("orgu");
85 
86  $DIC->globalScreen()->tool()->context()->current()->addAdditionalData(
87  OrgUnitToolProvider::SHOW_ORGU_TREE,
88  true
89  );
90  }
91 
97  public function executeCommand(): void
98  {
99  $cmd = $this->ctrl->getCmd();
100  $next_class = $this->ctrl->getNextClass($this);
101  parent::prepareOutput();
102 
103  switch ($next_class) {
104  case 'ilorgunitglobalsettingsgui':
105  $this->tabs_gui->activateTab(self::TAB_GLOBAL_SETTINGS);
106  $global_settings = new ilOrgUnitGlobalSettingsGUI();
107  $this->ctrl->forwardCommand($global_settings);
108  break;
109  case "illocalusergui":
111  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("permission_denied"), true);
112  $this->ctrl->redirect($this);
113  }
114  $this->tabs_gui->activateTab('administrate_users');
115  $ilLocalUserGUI = new ilLocalUserGUI($this);
116  $this->ctrl->forwardCommand($ilLocalUserGUI);
117  break;
118  case "ilorgunitsimpleimportgui":
119  $this->tabs_gui->activateTab("view");
120  $this->setContentSubTabs();
121  $this->tabs_gui->setSubTabActive('import');
122  $ilOrgUnitSimpleImportGUI = new ilOrgUnitSimpleImportGUI($this);
123  $this->ctrl->forwardCommand($ilOrgUnitSimpleImportGUI);
124  break;
125  case "ilorgunitsimpleuserimportgui":
126  $ilOrgUnitSimpleUserImportGUI = new ilOrgUnitSimpleUserImportGUI($this);
127  $this->ctrl->forwardCommand($ilOrgUnitSimpleUserImportGUI);
128  break;
129  case "ilobjusergui":
130  switch ($cmd) {
131  case "create":
132  $ilObjUserGUI = new ilObjUserGUI("", $this->ref_id, true, false);
133  $ilObjUserGUI->setCreationMode(true);
134  $this->ctrl->forwardCommand($ilObjUserGUI);
135  $this->tabs_gui->setBackTarget(
136  $this->lng->txt("back"),
137  $this->ctrl->getLinkTargetByClass("illocalusergui", 'index')
138  );
139  break;
140  case "save":
141  $ilObjUserGUI = new ilObjUserGUI("", $this->ref_id, true, false);
142  $ilObjUserGUI->setCreationMode(true);
143  $this->ctrl->forwardCommand($ilObjUserGUI);
144  $this->tabs_gui->clearTargets();
145  $this->tabs_gui->setBackTarget(
146  $this->lng->txt("back"),
147  $this->ctrl->getLinkTargetByClass("illocalusergui", 'index')
148  );
149  break;
150  case "view":
151  case "update":
152  $ilObjUserGUI = new ilObjUserGUI("", (int) $_GET['obj_id'], false, false);
153  $ilObjUserGUI->setCreationMode(false);
154  $this->ctrl->forwardCommand($ilObjUserGUI);
155  $this->tabs_gui->clearTargets();
156  $this->tabs_gui->setBackTarget(
157  $this->lng->txt("back"),
158  $this->ctrl->getLinkTargetByClass("illocalusergui", 'index')
159  );
160  break;
161  case "cancel":
162  $this->ctrl->redirectByClass("illocalusergui", "index");
163  break;
164  }
165  break;
166  case "ilobjuserfoldergui":
167  switch ($cmd) {
168  case "view":
169  $this->ctrl->redirectByClass("illocalusergui", "index");
170  break;
171  default:
172  $ilObjUserFolderGUI = new ilObjUserFolderGUI("", $this->ref_id, true, false);
173  $ilObjUserFolderGUI->setUserOwnerId($this->ref_id);
174  $ilObjUserFolderGUI->setCreationMode(true);
175  $this->ctrl->forwardCommand($ilObjUserFolderGUI);
176  $this->tabs_gui->clearTargets();
177  $this->tabs_gui->setBackTarget(
178  $this->lng->txt("back"),
179  $this->ctrl->getLinkTargetByClass("illocalusergui", 'index')
180  );
181  break;
182  }
183  break;
184  case "ilinfoscreengui":
185  $this->tabs_gui->activateTab("info_short");
186  if (!$this->ilAccess->checkAccess(
187  "read",
188  "",
189  $this->ref_id
190  ) and !$this->ilAccess->checkAccess("visible", "", $this->ref_id)) {
191  $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"), $this->ilias->error_obj->MESSAGE);
192  }
193  $info = new ilInfoScreenGUI($this);
194  $amd_gui = new ilAdvancedMDRecordGUI(
196  'orgu',
197  $this->object->getId(),
198  'orgu_type',
199  $this->object->getOrgUnitTypeId()
200  );
201  $amd_gui->setInfoObject($info);
202  $amd_gui->parse();
203  $this->ctrl->forwardCommand($info);
204  break;
205  case 'ilpermissiongui':
206  $this->tabs_gui->activateTab('perm_settings');
207  $ilPermissionGUI = new ilPermissionGUI($this);
208  $this->ctrl->forwardCommand($ilPermissionGUI);
209  break;
210  case "ilcommonactiondispatchergui":
212  $this->ctrl->forwardCommand($gui);
213  break;
214  case 'illearningprogressgui':
215  case 'illplistofprogressgui':
216  $this->tabs_gui->clearTargets();
217  $this->tabs_gui->setBackTarget(
218  $this->lng->txt('backto_staff'),
219  $this->ctrl->getLinkTargetByClass(
220  ilOrgUnitUserAssignmentGUI::class,
222  )
223  );
225  $this->object->getRefid(),
226  (int) $_GET['obj_id']
227  )) {
228  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("permission_denied"), true);
229  $this->ctrl->redirectByClass("ilOrgUnitUserAssignmentGUI", "index");
230  }
231  $this->ctrl->saveParameterByClass("illearningprogressgui", "obj_id");
232  $this->ctrl->saveParameterByClass("illearningprogressgui", "recursive");
233  $new_gui = new ilLearningProgressGUI(
235  $this->ref_id,
236  (int) $_GET['obj_id']
237  );
238  $this->ctrl->forwardCommand($new_gui);
239  break;
240  case 'ilorgunitexportgui':
241  if (!ilObjOrgUnitAccess::_checkAccessExport($this->ref_id)) {
242  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("permission_denied"), true);
243  $this->ctrl->redirect($this);
244  }
245  $this->tabs_gui->activateTab(self::TAB_EXPORT);
246  $ilOrgUnitExportGUI = new ilOrgUnitExportGUI($this);
247  $ilOrgUnitExportGUI->addFormat('xml');
248  $this->ctrl->forwardCommand($ilOrgUnitExportGUI);
249  break;
250  case strtolower(TranslationGUI::class):
251  $this->tabs_gui->activateTab(self::TAB_SETTINGS);
252  $this->setSubTabsSettings('edit_translations');
253  $translations_gui = new TranslationGUI(
254  $this->getObject(),
255  $this->lng,
256  $this->access,
257  $this->user,
258  $this->ctrl,
259  $this->tpl,
260  $this->ui_factory,
261  $this->ui_renderer,
262  $this->http,
263  $this->refinery,
264  $this->toolbar
265  );
266  $translations_gui->supportContentTranslation(false);
267  $this->ctrl->forwardCommand($translations_gui);
268  break;
269  case strtolower(ilOrgUnitTypeGUI::class):
270  $this->tabs_gui->activateTab(self::TAB_ORGU_TYPES);
271  $types_gui = new ilOrgUnitTypeGUI($this);
272  $this->ctrl->forwardCommand($types_gui);
273  break;
274  case strtolower(ilOrgUnitPositionGUI::class):
275  $this->tabs_gui->activateTab(self::TAB_POSITIONS);
276  $types_gui = new ilOrgUnitPositionGUI($this);
277  $this->ctrl->forwardCommand($types_gui);
278  break;
279  case strtolower(ilOrgUnitUserAssignmentGUI::class):
280  $this->tabs_gui->activateTab(self::TAB_STAFF);
281  $ilOrgUnitUserAssignmentGUI = new ilOrgUnitUserAssignmentGUI();
282  $this->ctrl->forwardCommand($ilOrgUnitUserAssignmentGUI);
283  break;
284  case strtolower(ilPropertyFormGUI::class):
285  /*
286  * Only used for async loading of the repository tree in custom md
287  * internal links (see #24875). This is necessary since OrgUnits don't
288  * use ilObjectMetaDataGUI.
289  */
290  $form = $this->initAdvancedSettingsForm();
291  $gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_EDITOR, 'orgu', $this->object->getId(), 'orgu_type', $this->object->getOrgUnitTypeId());
292  $gui->setPropertyForm($form);
293  $gui->parse();
294  $this->ctrl->forwardCommand($form);
295  break;
296  default:
297  $this->tabs_gui->activateTab(self::TAB_VIEW_CONTENT);
298  switch ($cmd) {
299  case '':
300  case 'view':
301  case 'render':
302  case 'cancel':
303  case 'cancelDelete':
304  case 'return':
305  $this->view();
306  break;
307  case 'performPaste':
308  case 'paste':
309  $this->performPaste();
310  break;
311  case 'performPasteIntoMultipleObjects':
313  break;
314  case 'keepObjectsInClipboard':
316  break;
317  case 'create':
318  parent::createObject();
319  break;
320  case 'save':
321  parent::saveObject();
322  break;
323  case 'delete':
324  $this->tabs_gui->clearTargets();
325  $this->tabs_gui->setBackTarget($this->lng->txt("back"), $this->ctrl->getLinkTarget($this));
326  $this->deleteObject();
327  break;
328  case 'confirmedDelete':
329  $this->confirmedDeleteObject();
330  break;
331  case 'cut':
332  $this->tabs_gui->clearTargets();
333  $this->tabs_gui->setBackTarget($this->lng->txt("back"), $this->ctrl->getLinkTarget($this));
334  parent::cutObject();
335  break;
336  case 'clear':
337  parent::clearObject();
338  break;
339  case 'enableAdministrationPanel':
340  parent::enableAdministrationPanelObject();
341  break;
342  case 'disableAdministrationPanel':
343  parent::disableAdministrationPanelObject();
344  break;
345  case self::CMD_EDIT_SETTINGS:
346  $this->tabs_gui->activateTab(self::TAB_SETTINGS);
347  $this->setSubTabsSettings('edit_settings');
348  $this->editSettings();
349  break;
350  case 'updateSettings':
351  $this->tabs_gui->activateTab(self::TAB_SETTINGS);
352  $this->setSubTabsSettings('edit_settings');
353  $this->updateSettings();
354  break;
355  case 'editAdvancedSettings':
356  $this->tabs_gui->activateTab(self::TAB_SETTINGS);
357  $this->setSubTabsSettings('edit_advanced_settings');
358  $this->editAdvancedSettings();
359  break;
360  case 'updateAdvancedSettings':
361  $this->tabs_gui->activateTab(self::TAB_SETTINGS);
362  $this->setSubTabsSettings('edit_advanced_settings');
363  $this->updateAdvancedSettings();
364  break;
365  case 'routeImportCmd':
366  $this->routeImportCmdObject();
367  break;
368  case 'cancelMoveLink':
369  $this->cancelMoveLinkObject();
370  break;
371  }
372  break;
373  }
374  }
375 
376  protected function afterSave(ilObject $new_object): void
377  {
378  $new_object->writePath();
379  $this->tpl->setOnScreenMessage('success', $this->lng->txt("object_added"), true);
380  $this->ctrl->setParameter($this, "ref_id", $new_object->getRefId());
381 
383  "save",
384  $this->ctrl->getLinkTarget($this, self::CMD_EDIT_SETTINGS, "")
385  ));
386  }
387 
388  public function view(): void
389  {
390  if (!$this->rbacsystem->checkAccess("read", $this->ref_id)) {
391  if ($this->rbacsystem->checkAccess("visible", $this->ref_id)) {
392  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("msg_no_perm_read"));
393  $this->ctrl->redirectByClass('ilinfoscreengui', '');
394  }
395 
396  $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"), $this->ilias->error_obj->WARNING);
397  }
398 
399  $container_view = $this->getContentGUI();
400 
401  $this->setContentSubTabs();
402  if ($this->isActiveAdministrationPanel()) {
403  $this->tabs->activateSubTab("manage");
404  } else {
405  $this->tabs->activateSubTab("view_content");
406  }
407 
408  $container_view->setOutput();
409 
410  // it is important not to show the subobjects/admin panel here, since
411  // we will create nested forms in case, e.g. a news/calendar item is added
412  if (! $this->ctrl->isAsynch()) {
413  $this->showAdministrationPanel();
414  $this->showPossibleSubObjects();
415  }
416 
417  $container_view->setOutput();
418 
419  $this->showPermanentLink();
420  $this->tabs_gui->activateTab(self::TAB_VIEW_CONTENT);
421  $this->tabs_gui->removeSubTab("page_editor");
422  $this->tabs_gui->removeSubTab("ordering"); // Mantis 0014728
423  }
424 
425  protected function showPossibleSubObjects(): void
426  {
427  $subtypes = $this->getCreatableObjectTypes();
428  if ($subtypes === []) {
429  return;
430  }
432  [$this->buildGroup(
433  self::class,
434  array_keys($subtypes),
435  $this->lng->txt('other'),
436  $subtypes
437  )]
438  );
439  $gui->render();
440  }
441 
442  public function getCreatableObjectTypes(): array
443  {
444  $subtypes = $this->obj_definition->getCreatableSubObjects(
445  $this->object->getType(),
447  $this->object->getRefId()
448  );
449  unset($subtypes[ilObjEmployeeTalkSeries::TYPE]);
450  return array_filter(
451  $subtypes,
452  fn($key) => $this->access->checkAccess('create_' . $key, '', $this->ref_id, $this->type),
453  ARRAY_FILTER_USE_KEY
454  );
455  }
456 
460  public function setTitleAndDescription(): void
461  {
462  # all possible create permissions
463  parent::setTitleAndDescription();
464  if ($this->object->getTitle() === "__OrgUnitAdministration") {
465  $this->tpl->setTitle($this->lng->txt("objs_orgu"));
466  $this->tpl->setDescription($this->lng->txt("objs_orgu"));
467  }
468 
469  // Check for custom icon of type
470  if ($this->ilias->getSetting('custom_icons')) {
471  $icons_cache = ilObjOrgUnit::getIconsCache();
472  $icon_file = (isset($icons_cache[$this->object->getId()])) ? $icons_cache[$this->object->getId()] : '';
473  if ($icon_file) {
474  $this->tpl->setTitleIcon($icon_file, $this->lng->txt("obj_" . $this->object->getType()));
475  }
476  }
477  }
478 
479  protected function addAdminLocatorItems(bool $do_not_add_object = false): void
480  {
481  $path = $this->tree->getPathFull($this->ref_id, ilObjOrgUnit::getRootOrgRefId());
482  // add item for each node on path
483  foreach ((array) $path as $key => $row) {
484  if ($row["title"] === "__OrgUnitAdministration") {
485  $row["title"] = $this->lng->txt("objs_orgu");
486  }
487  $this->ctrl->setParameterByClass("ilobjorgunitgui", "ref_id", $row["child"]);
488  $this->ilLocator->addItem(
489  $row["title"],
490  $this->ctrl->getLinkTargetByClass("ilobjorgunitgui", "view"),
491  ilFrameTargetInfo::_getFrame("MainContent"),
492  $row["child"]
493  );
494  $this->ctrl->setParameterByClass("ilobjorgunitgui", "ref_id", $this->ref_id);
495  }
496  }
497 
498  protected function redirectToRefId(int $ref_id, string $cmd = ""): void
499  {
500  $obj_type = ilObject::_lookupType($ref_id, true);
501  if ($obj_type !== "orgu") {
502  parent::redirectToRefId($ref_id, $cmd);
503  } else {
504  $this->ctrl->setParameterByClass("ilObjOrgUnitGUI", "ref_id", $ref_id);
505  $this->ctrl->redirectByClass("ilObjOrgUnitGUI", $cmd);
506  }
507  }
508 
509  public function getTabs(): void
510  {
511  $read_access_ref_id = $this->rbacsystem->checkAccess('visible', $this->object->getRefId())
512  && $this->rbacsystem->checkAccess('read', $this->object->getRefId());
513  if ($read_access_ref_id) {
514  $this->tabs_gui->addTab(
515  self::TAB_VIEW_CONTENT,
516  $this->lng->txt("content"),
517  $this->ctrl->getLinkTarget($this, "")
518  );
519  $this->tabs_gui->addTab(
520  "info_short",
521  "Info",
522  $this->ctrl->getLinkTargetByClass([self::class, ilInfoScreenGUI::class], "showSummary")
523  );
524  }
525 
526  // Tabs for OrgUnits exclusive root!
527  if ($this->object->getRefId() != ilObjOrgUnit::getRootOrgRefId()) {
528  if (ilObjOrgUnitAccess::_checkAccessStaff($this->object->getRefId())) {
529  $this->tabs_gui->addTab(
530  self::TAB_STAFF,
531  $this->lng->txt(self::TAB_STAFF),
532  $this->ctrl->getLinkTargetByClass(
533  [self::class, ilOrgUnitUserAssignmentGUI::class],
535  )
536  );
537  }
538  if (ilObjOrgUnitAccess::_checkAccessSettings($this->object->getRefId())) {
539  $this->tabs_gui->addTab(
540  self::TAB_SETTINGS,
541  $this->lng->txt(self::TAB_SETTINGS),
542  $this->ctrl->getLinkTarget($this, self::CMD_EDIT_SETTINGS)
543  );
544  }
546  $this->tabs_gui->addTab(
547  "administrate_users",
548  $this->lng->txt("administrate_users"),
549  $this->ctrl->getLinkTargetByClass(
550  [self::class, ilLocalUserGUI::class],
551  'index'
552  )
553  );
554  }
555  }
556 
557  if (ilObjOrgUnitAccess::_checkAccessSettings($this->object->getRefId())) {
558  if ($this->object->getRefId() == ilObjOrgUnit::getRootOrgRefId()) {
559  $this->tabs_gui->addTab(
560  self::TAB_GLOBAL_SETTINGS,
561  $this->lng->txt('settings'),
562  $this->ctrl->getLinkTargetByClass(
563  [self::class, ilOrgUnitGlobalSettingsGUI::class]
564  )
565  );
566  }
567  $this->tabs_gui->addTab(
568  self::TAB_EXPORT,
569  $this->lng->txt(self::TAB_EXPORT),
570  $this->ctrl->getLinkTargetByClass(
571  [self::class, ilOrgUnitExportGUI::class]
572  )
573  );
574 
575  // Add OrgUnit types and positions tabs
576  if ($this->object->getRefId() == ilObjOrgUnit::getRootOrgRefId()) {
577  $this->tabs_gui->addTab(
578  self::TAB_ORGU_TYPES,
579  $this->lng->txt(self::TAB_ORGU_TYPES),
580  $this->ctrl->getLinkTargetByClass(
581  [self::class, ilOrgUnitTypeGUI::class]
582  )
583  );
584  $this->tabs_gui->addTab(
585  self::TAB_POSITIONS,
586  $this->lng->txt(self::TAB_POSITIONS),
587  $this->ctrl->getLinkTargetByClass(
588  [self::class, ilOrgUnitPositionGUI::class]
589  )
590  );
591  }
592  }
593  parent::getTabs();
594  }
595 
596  protected function setSubTabsSettings(string $active_tab_id): void
597  {
598  $next_class = $this->ctrl->getNextClass($this);
599  $cmd = $this->ctrl->getCmd();
600  $this->tabs_gui->addSubTab(
601  'edit_settings',
602  $this->lng->txt(self::TAB_SETTINGS),
603  $this->ctrl->getLinkTarget($this, self::CMD_EDIT_SETTINGS)
604  );
605  $this->tabs_gui->addSubTab(
606  "edit_translations",
607  $this->lng->txt("obj_multilinguality"),
608  $this->ctrl->getLinkTargetByClass(TranslationGUI::class, "listTranslations")
609  );
610 
611  $ilOrgUnitType = $this->object->getOrgUnitType();
612  if ($ilOrgUnitType instanceof ilOrgUnitType) {
613  if (count($ilOrgUnitType->getAssignedAdvancedMDRecords(true))) {
614  $this->tabs_gui->addSubTab(
615  'edit_advanced_settings',
616  $this->lng->txt('orgu_adv_settings'),
617  $this->ctrl->getLinkTarget($this, 'editAdvancedSettings')
618  );
619  }
620  }
621 
622  $this->tabs_gui->setSubTabActive($active_tab_id);
623  switch ($next_class) {
624  case strtolower(TranslationGUI::class):
625  $this->tabs_gui->setSubTabActive("edit_translations");
626  break;
627  case '':
628  switch ($cmd) {
629  case self::CMD_EDIT_SETTINGS:
630  $this->tabs_gui->setSubTabActive('edit_settings');
631  break;
632  case 'editAdvancedSettings':
633  case 'updateAdvancedSettings':
634  $this->tabs_gui->setSubTabActive('edit_advanced_settings');
635  break;
636  }
637  break;
638  }
639  }
640 
641  public function setContentSubTabs(): void
642  {
644 
645  $ref_id = $this->object->getRefId();
646  $may_create_orgus = $this->ilAccess->checkAccess("create_orgu", "", $ref_id, 'orgu');
647 
648  if ($ref_id === ilObjOrgUnit::getRootOrgRefId() //only display the import tab at the first level
649  && $may_create_orgus
650  ) {
651  $this->tabs_gui->addSubTab(
652  "import",
653  $this->lng->txt("import"),
654  $this->ctrl->getLinkTargetByClass([self::class, ilOrgUnitSimpleImportGUI::class], "chooseImport")
655  );
656  }
657  }
658 
663  {
664  $form = new ilPropertyFormGUI();
665  $form->setFormAction($this->ctrl->getFormAction($this));
666  $form->addCommandButton('updateAdvancedSettings', $this->lng->txt('save'));
667  $form->addCommandButton(self::CMD_EDIT_SETTINGS, $this->lng->txt('cancel'));
668 
669  return $form;
670  }
671 
675  protected function editAdvancedSettings(): void
676  {
677  if ($this->ilAccess->checkAccess("write", "", $this->ref_id) === false) {
678  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("permission_denied"), true);
679  $this->ctrl->redirect($this);
680  }
681  $form = $this->initAdvancedSettingsForm();
684  'orgu',
685  $this->object->getId(),
686  'orgu_type',
687  $this->object->getOrgUnitTypeId()
688  );
689  $gui->setPropertyForm($form);
690  $gui->parse();
691  $this->tpl->setContent($form->getHTML());
692  }
693 
697  protected function updateAdvancedSettings(): void
698  {
699  if (!$this->ilAccess->checkAccess('write', '', $this->ref_id)) {
700  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
701  $this->ctrl->redirect($this);
702  }
703  $form = $this->initAdvancedSettingsForm();
706  'orgu',
707  $this->object->getId(),
708  'orgu_type',
709  $this->object->getOrgUnitTypeId()
710  );
711  $gui->setPropertyForm($form);
712  $form->checkInput();
713  $gui->parse();
714  if ($gui->importEditFormPostValues()) {
715  $gui->writeEditForm();
716  $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
717  $this->ctrl->redirect($this, 'editAdvancedSettings');
718  } else {
719  $this->tpl->setContent($form->getHTML());
720  }
721  }
722 
723  public function editSettings(): void
724  {
725  if (!$this->ilAccess->checkAccess('write', "", $this->ref_id)) {
726  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
727  $this->ctrl->redirect($this);
728  }
729  $form = new ilObjOrgUnitSettingsFormGUI($this, $this->object);
730  $this->tpl->setContent($form->getHTML());
731  }
732 
733  public function updateSettings(): void
734  {
735  if (!$this->ilAccess->checkAccess('write', '', $this->ref_id)) {
736  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
737  $this->ctrl->redirect($this);
738  }
739  $form = new ilObjOrgUnitSettingsFormGUI($this, $this->object);
740  if ($form->saveObject()) {
741  $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_obj_modified'), true);
742  $this->ctrl->redirect($this, self::CMD_EDIT_SETTINGS);
743  } else {
744  $this->tpl->setContent($form->getHTML());
745  }
746  }
747 
748  public function showAdministrationPanel(): void
749  {
750  parent::showAdministrationPanel();
751  //an ugly encapsulation violation in order to remove the "verknüpfen"/"link" and copy button.
752  if (empty($this->toolbar->items) === false) {
753  foreach ($this->toolbar->items as $key => $item) {
754  if ($item["cmd"] == "link" || $item["cmd"] == "copy"
755  || $item["cmd"] == "download"
756  ) {
757  unset($this->toolbar->items[$key]);
758  }
759  }
760  }
761  }
762 
763  public static function _goto(string $ref_id): void
764  {
765  global $DIC;
766  $ilCtrl = $DIC['ilCtrl'];
767  $ilCtrl->setTargetScript('ilias.php');
768  $ilCtrl->setParameterByClass("ilObjOrgUnitGUI", "ref_id", $ref_id);
769  $ilCtrl->setParameterByClass("ilObjOrgUnitGUI", "admin_mode", self::TAB_SETTINGS);
770  $ilCtrl->setParameterByClass("IlObjPluginDispatchGUI", "admin_mode", self::TAB_SETTINGS);
771  $ilCtrl->redirectByClass(array("ilAdministrationGUI", "ilObjOrgUnitGUI"), "view");
772  }
773 
774  protected function getTreeSelectorGUI(string $cmd): ilTreeExplorerGUI
775  {
776  $explorer = new ilOrgUnitExplorerGUI("rep_exp_sel", $this, "showPasteTree", $this->tree);
777  $explorer->setAjax(false);
778  $explorer->setSelectMode('nodes[]', false);
779 
780  return $explorer;
781  }
782 
783  public function getAdminTabs(): void
784  {
785  $this->getTabs();
786  }
787 
791  public function performPaste(): void
792  {
793  if ($this->clipboard->getCmd() != 'cut') {
794  $message = __METHOD__ . ": cmd was not 'cut' ; may be a hack attempt!";
795  $this->ilias->raiseError($message, $this->ilias->error_obj->WARNING);
796  } else {
797  if ($this->clipboard->hasEntries()) {
798  $this->pasteObject();
799  }
800  }
801  $this->ctrl->returnToParent($this);
802  }
803 
804  public function doUserAutoCompleteObject(): void
805  {
806  }
807 
808  //
809  // METHODS for local user administration.
810  //
811 
816  public function confirmedDeleteObject(): void
817  {
818  $ids = filter_input(INPUT_POST, 'id', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY);
819  if (count($ids) > 0) {
821  $this->tpl->setOnScreenMessage('success', $this->lng->txt("info_deleted"), true);
822  }
823  $this->ctrl->returnToParent($this);
824  }
825 
830  public function deleteObject(bool $error = false): void
831  {
832  $ilCtrl = $this->ctrl;
833  $ru = new ilRepositoryTrashGUI($this);
834 
835  $arr_ref_ids = [];
836  //Delete via Manage (more than one)
837  if (isset($_POST["id"]) && is_array($_POST['id']) && count($_POST['id']) > 0) {
838  $arr_ref_ids = $_POST['id'];
839  } elseif (isset($_GET['item_ref_id']) && (int) $_GET['item_ref_id'] > 0) {
840  $arr_ref_ids = [(int) $_GET['item_ref_id']];
841  }
842 
843  if (!$ru->showDeleteConfirmation($arr_ref_ids, false)) {
844  $ilCtrl->returnToParent($this);
845  }
846  }
847 }
static getIconsCache()
Returns an array that maps from OrgUnit object IDs to its icon defined by the assigned OrgUnit type...
$_GET["client_id"]
Definition: webdav.php:30
confirmedDeleteObject()
confirmed deletion of org units -> org units are deleted immediately, without putting them to the tra...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _checkAccessSettings(int $ref_id)
Class ilLocalUserGUI.
Class ilOrgUnitUserAssignmentGUI.
Class ilOrgUnitPositionGUI.
setSubTabsSettings(string $active_tab_id)
static _checkAccessExport(int $ref_id)
static _checkAccessAdministrateUsers(int $ref_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: class.ilLog.php:30
Class ilOrgUnitSimpleImportGUI.
initAdvancedSettingsForm()
Initialize the form for editing advanced meta data.
Class ilOrgUnitExportGUI.
afterSave(ilObject $new_object)
$path
Definition: ltiservices.php:29
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
pasteObject()
paste object from clipboard to current place Depending on the chosen command the object(s) are linked...
static http()
Fetches the global http state from ILIAS.
setFormAction(string $a_formaction)
addStandardContainerSubTabs(bool $a_include_view=true)
Add standard container subtabs for view, manage, oderdering and text/media editor link...
addAdminLocatorItems(bool $do_not_add_object=false)
updateAdvancedSettings()
Update Advanced Metadata.
ilAccessHandler $ilAccess
global $DIC
Definition: shib_login.php:26
setTitleAndDescription()
called by prepare output
Repository GUI Utilities.
deleteObject(bool $error=false)
Display deletion confirmation screen for Org Units.
Class ilObjForumAdministration.
cancelMoveLinkObject()
Cancel move|link empty clipboard and return to parent.
Class ilOrgUnitTypeGUI.
editAdvancedSettings()
Edit Advanced Metadata.
static removeObjectsFromSystem(array $a_ref_ids, bool $a_from_recovery_folder=false)
remove objects from trash bin and all entries therefore every object needs a specific deleteObject() ...
addCommandButton(string $a_cmd, string $a_text, string $a_id="")
ilErrorHandling $error
static _checkAccessStaff(int $ref_id)
static _goto(string $ref_id)
static getRootOrgRefId()
ilPropertyFormGUI $form
static redirect(string $a_script)
performPaste()
Prepare $_POST for the generic method performPasteIntoMultipleObjectsObject
static _checkAccessToUserLearningProgress(int $ref_id, int $usr_id)
Render add new item selector.
Explorer class that works on tree objects (Services/Tree)
__construct(Container $dic, ilPlugin $plugin)
getReturnLocation(string $cmd, string $default_location="")
Get return location for command (command is method name without "Object", e.g.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setInfoObject(ilInfoScreenGUI $info)
get info sections
ILIAS Container InternalGUIService $gui
ILIAS DI LoggingServices $ilLog
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$dic
Definition: result.php:31
$message
Definition: xapiexit.php:31
$info
Definition: entry_point.php:21
redirectToRefId(int $ref_id, string $cmd="")
static _getFrame(string $a_class)
Class ilObjUserGUI.
static _lookupType(int $id, bool $reference=false)
buildGroup(string $create_target_class, array $obj_types_in_group, string $title, array $subtypes)
Class ilObjUserTrackingGUI.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
getTreeSelectorGUI(string $cmd)