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