ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
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  $this->lng->loadLanguageModule("content");
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(ilObjectTranslationGUI::class):
251  $this->tabs_gui->activateTab(self::TAB_SETTINGS);
252  $this->setSubTabsSettings('edit_translations');
253  $translations_gui = new ilObjectTranslationGUI($this);
254  $translations_gui->supportContentTranslation(false);
255  $this->ctrl->forwardCommand($translations_gui);
256  break;
257  case strtolower(ilOrgUnitTypeGUI::class):
258  $this->tabs_gui->activateTab(self::TAB_ORGU_TYPES);
259  $types_gui = new ilOrgUnitTypeGUI($this);
260  $this->ctrl->forwardCommand($types_gui);
261  break;
262  case strtolower(ilOrgUnitPositionGUI::class):
263  $this->tabs_gui->activateTab(self::TAB_POSITIONS);
264  $types_gui = new ilOrgUnitPositionGUI($this);
265  $this->ctrl->forwardCommand($types_gui);
266  break;
267  case strtolower(ilOrgUnitUserAssignmentGUI::class):
268  $this->tabs_gui->activateTab(self::TAB_STAFF);
269  $ilOrgUnitUserAssignmentGUI = new ilOrgUnitUserAssignmentGUI();
270  $this->ctrl->forwardCommand($ilOrgUnitUserAssignmentGUI);
271  break;
272  case strtolower(ilPropertyFormGUI::class):
273  /*
274  * Only used for async loading of the repository tree in custom md
275  * internal links (see #24875). This is necessary since OrgUnits don't
276  * use ilObjectMetaDataGUI.
277  */
278  $form = $this->initAdvancedSettingsForm();
279  $gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_EDITOR, 'orgu', $this->object->getId(), 'orgu_type', $this->object->getOrgUnitTypeId());
280  $gui->setPropertyForm($form);
281  $gui->parse();
282  $this->ctrl->forwardCommand($form);
283  break;
284  default:
285  $this->tabs_gui->activateTab(self::TAB_VIEW_CONTENT);
286  switch ($cmd) {
287  case '':
288  case 'view':
289  case 'render':
290  case 'cancel':
291  case 'cancelDelete':
292  case 'return':
293  $this->view();
294  break;
295  case 'performPaste':
296  case 'paste':
297  $this->performPaste();
298  break;
299  case 'performPasteIntoMultipleObjects':
301  break;
302  case 'keepObjectsInClipboard':
304  break;
305  case 'create':
306  parent::createObject();
307  break;
308  case 'save':
309  parent::saveObject();
310  break;
311  case 'delete':
312  $this->tabs_gui->clearTargets();
313  $this->tabs_gui->setBackTarget($this->lng->txt("back"), $this->ctrl->getLinkTarget($this));
314  $this->deleteObject();
315  break;
316  case 'confirmedDelete':
317  $this->confirmedDeleteObject();
318  break;
319  case 'cut':
320  $this->tabs_gui->clearTargets();
321  $this->tabs_gui->setBackTarget($this->lng->txt("back"), $this->ctrl->getLinkTarget($this));
322  parent::cutObject();
323  break;
324  case 'clear':
325  parent::clearObject();
326  break;
327  case 'enableAdministrationPanel':
328  parent::enableAdministrationPanelObject();
329  break;
330  case 'disableAdministrationPanel':
331  parent::disableAdministrationPanelObject();
332  break;
333  case self::CMD_EDIT_SETTINGS:
334  $this->tabs_gui->activateTab(self::TAB_SETTINGS);
335  $this->setSubTabsSettings('edit_settings');
336  $this->editSettings();
337  break;
338  case 'updateSettings':
339  $this->tabs_gui->activateTab(self::TAB_SETTINGS);
340  $this->setSubTabsSettings('edit_settings');
341  $this->updateSettings();
342  break;
343  case 'editAdvancedSettings':
344  $this->tabs_gui->activateTab(self::TAB_SETTINGS);
345  $this->setSubTabsSettings('edit_advanced_settings');
346  $this->editAdvancedSettings();
347  break;
348  case 'updateAdvancedSettings':
349  $this->tabs_gui->activateTab(self::TAB_SETTINGS);
350  $this->setSubTabsSettings('edit_advanced_settings');
351  $this->updateAdvancedSettings();
352  break;
353  case 'routeImportCmd':
354  $this->routeImportCmdObject();
355  break;
356  case 'cancelMoveLink':
357  $this->cancelMoveLinkObject();
358  break;
359  case 'copy':
360  case 'link':
361  case 'editAvailabilityPeriod':
362  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("cont_operation_not_allowed"), true);
363  $this->view();
364  break;
365  }
366  break;
367  }
368  }
369 
370  protected function afterSave(ilObject $new_object): void
371  {
372  $new_object->writePath();
373  $this->tpl->setOnScreenMessage('success', $this->lng->txt("object_added"), true);
374  $this->ctrl->setParameter($this, "ref_id", $new_object->getRefId());
375 
377  "save",
378  $this->ctrl->getLinkTarget($this, self::CMD_EDIT_SETTINGS, "")
379  ));
380  }
381 
382  public function view(): void
383  {
384  if (!$this->rbacsystem->checkAccess("read", $this->ref_id)) {
385  if ($this->rbacsystem->checkAccess("visible", $this->ref_id)) {
386  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("msg_no_perm_read"));
387  $this->ctrl->redirectByClass('ilinfoscreengui', '');
388  }
389 
390  $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"), $this->ilias->error_obj->WARNING);
391  }
392 
393  $container_view = $this->getContentGUI();
394 
395  $this->setContentSubTabs();
396  if ($this->isActiveAdministrationPanel()) {
397  $this->tabs->activateSubTab("manage");
398  } else {
399  $this->tabs->activateSubTab("view_content");
400  }
401 
402  $container_view->setOutput();
403 
404  // it is important not to show the subobjects/admin panel here, since
405  // we will create nested forms in case, e.g. a news/calendar item is added
406  if (! $this->ctrl->isAsynch()) {
407  $this->showAdministrationPanel();
408  $this->showPossibleSubObjects();
409  }
410 
411  $container_view->setOutput();
412 
413  $this->showPermanentLink();
414  $this->tabs_gui->activateTab(self::TAB_VIEW_CONTENT);
415  $this->tabs_gui->removeSubTab("page_editor");
416  $this->tabs_gui->removeSubTab("ordering"); // Mantis 0014728
417  }
418 
419  protected function showPossibleSubObjects(): void
420  {
421  $subtypes = $this->getCreatableObjectTypes();
422  if ($subtypes === []) {
423  return;
424  }
426  [$this->buildGroup(
427  self::class,
428  array_keys($subtypes),
429  $this->lng->txt('other'),
430  $subtypes
431  )]
432  );
433  $gui->render();
434  }
435 
436  public function getCreatableObjectTypes(): array
437  {
438  $subtypes = $this->obj_definition->getCreatableSubObjects(
439  $this->object->getType(),
441  $this->object->getRefId()
442  );
443  unset($subtypes[ilObjEmployeeTalkSeries::TYPE]);
444  return array_filter(
445  $subtypes,
446  fn($key) => $this->access->checkAccess('create_' . $key, '', $this->ref_id, $this->type),
447  ARRAY_FILTER_USE_KEY
448  );
449  }
450 
454  public function setTitleAndDescription(): void
455  {
456  # all possible create permissions
457  parent::setTitleAndDescription();
458  if ($this->object->getTitle() === "__OrgUnitAdministration") {
459  $this->tpl->setTitle($this->lng->txt("objs_orgu"));
460  $this->tpl->setDescription($this->lng->txt("objs_orgu"));
461  }
462 
463  // Check for custom icon of type
464  if ($this->ilias->getSetting('custom_icons')) {
465  $icons_cache = ilObjOrgUnit::getIconsCache();
466  $icon_file = (isset($icons_cache[$this->object->getId()])) ? $icons_cache[$this->object->getId()] : '';
467  if ($icon_file) {
468  $this->tpl->setTitleIcon($icon_file, $this->lng->txt("obj_" . $this->object->getType()));
469  }
470  }
471  }
472 
473  protected function addAdminLocatorItems(bool $do_not_add_object = false): void
474  {
475  $path = $this->tree->getPathFull($this->ref_id, ilObjOrgUnit::getRootOrgRefId());
476  // add item for each node on path
477  foreach ((array) $path as $key => $row) {
478  if ($row["title"] === "__OrgUnitAdministration") {
479  $row["title"] = $this->lng->txt("objs_orgu");
480  }
481  $this->ctrl->setParameterByClass("ilobjorgunitgui", "ref_id", $row["child"]);
482  $this->ilLocator->addItem(
483  $row["title"],
484  $this->ctrl->getLinkTargetByClass("ilobjorgunitgui", "view"),
485  ilFrameTargetInfo::_getFrame("MainContent"),
486  $row["child"]
487  );
488  $this->ctrl->setParameterByClass("ilobjorgunitgui", "ref_id", $this->ref_id);
489  }
490  }
491 
492  protected function redirectToRefId(int $ref_id, string $cmd = ""): void
493  {
494  $obj_type = ilObject::_lookupType($ref_id, true);
495  if ($obj_type !== "orgu") {
496  parent::redirectToRefId($ref_id, $cmd);
497  } else {
498  $this->ctrl->setParameterByClass("ilObjOrgUnitGUI", "ref_id", $ref_id);
499  $this->ctrl->redirectByClass("ilObjOrgUnitGUI", $cmd);
500  }
501  }
502 
503  public function getTabs(): void
504  {
505  $read_access_ref_id = $this->rbacsystem->checkAccess('visible', $this->object->getRefId())
506  && $this->rbacsystem->checkAccess('read', $this->object->getRefId());
507  if ($read_access_ref_id) {
508  $this->tabs_gui->addTab(
509  self::TAB_VIEW_CONTENT,
510  $this->lng->txt("content"),
511  $this->ctrl->getLinkTarget($this, "")
512  );
513  $this->tabs_gui->addTab(
514  "info_short",
515  "Info",
516  $this->ctrl->getLinkTargetByClass([self::class, ilInfoScreenGUI::class], "showSummary")
517  );
518  }
519 
520  // Tabs for OrgUnits exclusive root!
521  if ($this->object->getRefId() != ilObjOrgUnit::getRootOrgRefId()) {
522  if (ilObjOrgUnitAccess::_checkAccessStaff($this->object->getRefId())) {
523  $this->tabs_gui->addTab(
524  self::TAB_STAFF,
525  $this->lng->txt(self::TAB_STAFF),
526  $this->ctrl->getLinkTargetByClass(
527  [self::class, ilOrgUnitUserAssignmentGUI::class],
529  )
530  );
531  }
532  if (ilObjOrgUnitAccess::_checkAccessSettings($this->object->getRefId())) {
533  $this->tabs_gui->addTab(
534  self::TAB_SETTINGS,
535  $this->lng->txt(self::TAB_SETTINGS),
536  $this->ctrl->getLinkTarget($this, self::CMD_EDIT_SETTINGS)
537  );
538  }
540  $this->tabs_gui->addTab(
541  "administrate_users",
542  $this->lng->txt("administrate_users"),
543  $this->ctrl->getLinkTargetByClass(
544  [self::class, ilLocalUserGUI::class],
545  'index'
546  )
547  );
548  }
549  }
550 
551  if (ilObjOrgUnitAccess::_checkAccessSettings($this->object->getRefId())) {
552  if ($this->object->getRefId() == ilObjOrgUnit::getRootOrgRefId()) {
553  $this->tabs_gui->addTab(
554  self::TAB_GLOBAL_SETTINGS,
555  $this->lng->txt('settings'),
556  $this->ctrl->getLinkTargetByClass(
557  [self::class, ilOrgUnitGlobalSettingsGUI::class]
558  )
559  );
560  }
561  $this->tabs_gui->addTab(
562  self::TAB_EXPORT,
563  $this->lng->txt(self::TAB_EXPORT),
564  $this->ctrl->getLinkTargetByClass(
565  [self::class, ilOrgUnitExportGUI::class]
566  )
567  );
568 
569  // Add OrgUnit types and positions tabs
570  if ($this->object->getRefId() == ilObjOrgUnit::getRootOrgRefId()) {
571  $this->tabs_gui->addTab(
572  self::TAB_ORGU_TYPES,
573  $this->lng->txt(self::TAB_ORGU_TYPES),
574  $this->ctrl->getLinkTargetByClass(
575  [self::class, ilOrgUnitTypeGUI::class]
576  )
577  );
578  $this->tabs_gui->addTab(
579  self::TAB_POSITIONS,
580  $this->lng->txt(self::TAB_POSITIONS),
581  $this->ctrl->getLinkTargetByClass(
582  [self::class, ilOrgUnitPositionGUI::class]
583  )
584  );
585  }
586  }
587  parent::getTabs();
588  }
589 
590  protected function setSubTabsSettings(string $active_tab_id): void
591  {
592  $next_class = $this->ctrl->getNextClass($this);
593  $cmd = $this->ctrl->getCmd();
594  $this->tabs_gui->addSubTab(
595  'edit_settings',
596  $this->lng->txt(self::TAB_SETTINGS),
597  $this->ctrl->getLinkTarget($this, self::CMD_EDIT_SETTINGS)
598  );
599  $this->tabs_gui->addSubTab(
600  "edit_translations",
601  $this->lng->txt("obj_multilinguality"),
602  $this->ctrl->getLinkTargetByClass("ilobjecttranslationgui", "listTranslations")
603  );
604 
605  $ilOrgUnitType = $this->object->getOrgUnitType();
606  if ($ilOrgUnitType instanceof ilOrgUnitType) {
607  if (count($ilOrgUnitType->getAssignedAdvancedMDRecords(true))) {
608  $this->tabs_gui->addSubTab(
609  'edit_advanced_settings',
610  $this->lng->txt('orgu_adv_settings'),
611  $this->ctrl->getLinkTarget($this, 'editAdvancedSettings')
612  );
613  }
614  }
615 
616  $this->tabs_gui->setSubTabActive($active_tab_id);
617  switch ($next_class) {
618  case 'iltranslationgui':
619  $this->tabs_gui->setSubTabActive("edit_translations");
620  break;
621  case '':
622  switch ($cmd) {
623  case self::CMD_EDIT_SETTINGS:
624  $this->tabs_gui->setSubTabActive('edit_settings');
625  break;
626  case 'editAdvancedSettings':
627  case 'updateAdvancedSettings':
628  $this->tabs_gui->setSubTabActive('edit_advanced_settings');
629  break;
630  }
631  break;
632  }
633  }
634 
635  public function setContentSubTabs(): void
636  {
638 
639  $ref_id = $this->object->getRefId();
640  $may_create_orgus = $this->ilAccess->checkAccess("create_orgu", "", $ref_id, 'orgu');
641 
642  if ($ref_id === ilObjOrgUnit::getRootOrgRefId() //only display the import tab at the first level
643  && $may_create_orgus
644  ) {
645  $this->tabs_gui->addSubTab(
646  "import",
647  $this->lng->txt("import"),
648  $this->ctrl->getLinkTargetByClass([self::class, ilOrgUnitSimpleImportGUI::class], "chooseImport")
649  );
650  }
651  }
652 
657  {
658  $form = new ilPropertyFormGUI();
659  $form->setFormAction($this->ctrl->getFormAction($this));
660  $form->addCommandButton('updateAdvancedSettings', $this->lng->txt('save'));
661  $form->addCommandButton(self::CMD_EDIT_SETTINGS, $this->lng->txt('cancel'));
662 
663  return $form;
664  }
665 
669  protected function editAdvancedSettings(): void
670  {
671  if ($this->ilAccess->checkAccess("write", "", $this->ref_id) === false) {
672  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("permission_denied"), true);
673  $this->ctrl->redirect($this);
674  }
675  $form = $this->initAdvancedSettingsForm();
678  'orgu',
679  $this->object->getId(),
680  'orgu_type',
681  $this->object->getOrgUnitTypeId()
682  );
683  $gui->setPropertyForm($form);
684  $gui->parse();
685  $this->tpl->setContent($form->getHTML());
686  }
687 
691  protected function updateAdvancedSettings(): 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 = $this->initAdvancedSettingsForm();
700  'orgu',
701  $this->object->getId(),
702  'orgu_type',
703  $this->object->getOrgUnitTypeId()
704  );
705  $gui->setPropertyForm($form);
706  $gui->parse();
707  if ($form->checkInput() && $gui->importEditFormPostValues()) {
708  $gui->writeEditForm();
709  $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
710  $this->ctrl->redirect($this, 'editAdvancedSettings');
711  } else {
712  $this->tpl->setContent($form->getHTML());
713  }
714  }
715 
716  public function editSettings(): void
717  {
718  if (!$this->ilAccess->checkAccess('write', "", $this->ref_id)) {
719  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
720  $this->ctrl->redirect($this);
721  }
722  $form = new ilObjOrgUnitSettingsFormGUI($this, $this->object);
723  $this->tpl->setContent($form->getHTML());
724  }
725 
726  public function updateSettings(): void
727  {
728  if (!$this->ilAccess->checkAccess('write', '', $this->ref_id)) {
729  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
730  $this->ctrl->redirect($this);
731  }
732  $form = new ilObjOrgUnitSettingsFormGUI($this, $this->object);
733  if ($form->saveObject()) {
734  $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_obj_modified'), true);
735  $this->ctrl->redirect($this, self::CMD_EDIT_SETTINGS);
736  } else {
737  $this->tpl->setContent($form->getHTML());
738  }
739  }
740 
741  public function showAdministrationPanel(): void
742  {
743  parent::showAdministrationPanel();
744  //an ugly encapsulation violation in order to remove the "verknüpfen"/"link" and copy button.
745  if (empty($this->toolbar->items) === false) {
746  foreach ($this->toolbar->items as $key => $item) {
747  if ($item["cmd"] == "link" || $item["cmd"] == "copy"
748  || $item["cmd"] == "download"
749  ) {
750  unset($this->toolbar->items[$key]);
751  }
752  }
753  }
754  }
755 
756  public static function _goto(string $ref_id): void
757  {
758  global $DIC;
759  $ilCtrl = $DIC['ilCtrl'];
760  $ilCtrl->setTargetScript('ilias.php');
761  $ilCtrl->setParameterByClass("ilObjOrgUnitGUI", "ref_id", $ref_id);
762  $ilCtrl->setParameterByClass("ilObjOrgUnitGUI", "admin_mode", self::TAB_SETTINGS);
763  $ilCtrl->setParameterByClass("IlObjPluginDispatchGUI", "admin_mode", self::TAB_SETTINGS);
764  $ilCtrl->redirectByClass(array("ilAdministrationGUI", "ilObjOrgUnitGUI"), "view");
765  }
766 
767  protected function getTreeSelectorGUI(string $cmd): ilTreeExplorerGUI
768  {
769  $explorer = new ilOrgUnitExplorerGUI("rep_exp_sel", $this, "showPasteTree", $this->tree);
770  $explorer->setAjax(false);
771  $explorer->setSelectMode('nodes[]', false);
772 
773  return $explorer;
774  }
775 
776  public function getAdminTabs(): void
777  {
778  $this->getTabs();
779  }
780 
784  public function performPaste(): void
785  {
786  if ($this->clipboard->getCmd() != 'cut') {
787  $message = __METHOD__ . ": cmd was not 'cut' ; may be a hack attempt!";
788  $this->ilias->raiseError($message, $this->ilias->error_obj->WARNING);
789  } else {
790  if ($this->clipboard->hasEntries()) {
791  $this->pasteObject();
792  }
793  }
794  $this->ctrl->returnToParent($this);
795  }
796 
797  public function doUserAutoCompleteObject(): void
798  {
799  }
800 
801  //
802  // METHODS for local user administration.
803  //
804 
809  public function confirmedDeleteObject(): void
810  {
811  $ids = filter_input(INPUT_POST, 'id', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY);
812  if (count($ids) > 0) {
814  $this->tpl->setOnScreenMessage('success', $this->lng->txt("info_deleted"), true);
815  }
816  $this->ctrl->returnToParent($this);
817  }
818 
823  public function deleteObject(bool $error = false): void
824  {
825  $ilCtrl = $this->ctrl;
826  $ru = new ilRepositoryTrashGUI($this);
827 
828  $arr_ref_ids = [];
829  //Delete via Manage (more than one)
830  if (isset($_POST["id"]) && is_array($_POST['id']) && count($_POST['id']) > 0) {
831  $arr_ref_ids = $_POST['id'];
832  } elseif (isset($_GET['item_ref_id']) && (int) $_GET['item_ref_id'] > 0) {
833  $arr_ref_ids = [(int) $_GET['item_ref_id']];
834  }
835 
836  if (!$ru->showDeleteConfirmation($arr_ref_ids, false)) {
837  $ilCtrl->returnToParent($this);
838  }
839  }
840 }
static getIconsCache()
Returns an array that maps from OrgUnit object IDs to its icon defined by the assigned OrgUnit 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.
$_POST['cmd']
Definition: lti.php:27
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:30
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...
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:25
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="")
$_GET['cmd']
Definition: lti.php:26
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...
Class ilContainerGUI This is a base GUI class for all container objects in ILIAS: root folder...
$dic
Definition: ltiresult.php:33
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)
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)