ILIAS  release_8 Revision v8.24
class.ilObjOrgUnitGUI.php
Go to the documentation of this file.
1<?php
2
20
42{
43 public const TAB_POSITIONS = 'positions';
44 public const TAB_ORGU_TYPES = 'orgu_types';
45 public const TAB_SETTINGS = "settings";
46 public const TAB_STAFF = 'orgu_staff';
47 public const TAB_GLOBAL_SETTINGS = 'global_settings';
48 public const TAB_EXPORT = 'export';
49 public const TAB_VIEW_CONTENT = 'view_content';
50
51 public const CMD_EDIT_SETTINGS = 'editSettings';
52
53 public ilCtrl $ctrl;
58 public ilTree $tree;
60 protected \ILIAS\DI\LoggingServices $ilLog;
61 public Ilias $ilias;
62
63 public function __construct()
64 {
65 global $DIC;
66 $this->ctrl = $DIC->ctrl();
67 $this->ilAccess = $DIC->access();
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
75 parent::__construct(array(), $_GET["ref_id"], true, false);
76
77 $lng = $DIC->language();
78 $lng->loadLanguageModule("orgu");
79
80 $DIC->globalScreen()->tool()->context()->current()->addAdditionalData(
81 OrgUnitToolProvider::SHOW_ORGU_TREE,
82 true
83 );
84 }
85
91 public function executeCommand(): void
92 {
93 $cmd = $this->ctrl->getCmd();
94 $next_class = $this->ctrl->getNextClass($this);
95 parent::prepareOutput();
96
97 switch ($next_class) {
98 case 'ilorgunitglobalsettingsgui':
99 $this->tabs_gui->activateTab(self::TAB_GLOBAL_SETTINGS);
100 $global_settings = new ilOrgUnitGlobalSettingsGUI();
101 $this->ctrl->forwardCommand($global_settings);
102 break;
103 case "illocalusergui":
105 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("permission_denied"), true);
106 $this->ctrl->redirect($this);
107 }
108 $this->tabs_gui->activateTab('administrate_users');
109 $ilLocalUserGUI = new ilLocalUserGUI($this);
110 $this->ctrl->forwardCommand($ilLocalUserGUI);
111 break;
112 case "ilorgunitsimpleimportgui":
113 $this->tabs_gui->activateTab("view");
114 $this->setContentSubTabs();
115 $this->tabs_gui->setSubTabActive('import');
116 $ilOrgUnitSimpleImportGUI = new ilOrgUnitSimpleImportGUI($this);
117 $this->ctrl->forwardCommand($ilOrgUnitSimpleImportGUI);
118 break;
119 case "ilorgunitsimpleuserimportgui":
120 $ilOrgUnitSimpleUserImportGUI = new ilOrgUnitSimpleUserImportGUI($this);
121 $this->ctrl->forwardCommand($ilOrgUnitSimpleUserImportGUI);
122 break;
123 case "ilorgunitstaffgui":
124 case "ilrepositorysearchgui":
125 $this->tabs_gui->activateTab(self::TAB_STAFF);
126 $ilOrgUnitStaffGUI = new ilOrgUnitStaffGUI($this);
127 $this->ctrl->forwardCommand($ilOrgUnitStaffGUI);
128 break;
129 case "ilobjusergui":
130 switch ($cmd) {
131 case "create":
132 $ilObjUserGUI = new ilObjUserGUI("", (int) $_GET['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("", $_GET['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("", (int) $_GET['ref_id'], true, false);
173 $ilObjUserFolderGUI->setUserOwnerId((int) $_GET['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 $_GET['obj_id']
227 )) {
228 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("permission_denied"), true);
229 $this->ctrl->redirectByClass("ilOrgUnitStaffGUI", "showStaff");
230 }
231 $this->ctrl->saveParameterByClass("illearningprogressgui", "obj_id");
232 $this->ctrl->saveParameterByClass("illearningprogressgui", "recursive");
233 $new_gui = new ilLearningProgressGUI(
235 $_GET["ref_id"],
236 $_GET['obj_id']
237 );
238 $this->ctrl->forwardCommand($new_gui);
239 break;
240 case 'ilorgunitexportgui':
241 if (!ilObjOrgUnitAccess::_checkAccessExport((int) $_GET['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(ilTranslationGUI::class):
251 $this->tabs_gui->activateTab(self::TAB_SETTINGS);
252 $this->setSubTabsSettings('edit_translations');
253 $ilTranslationGui = new ilTranslationGUI($this);
254 $this->ctrl->forwardCommand($ilTranslationGui);
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 */
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;
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", $_GET["ref_id"])) {
380 if ($this->rbacsystem->checkAccess("visible", $_GET["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 $container_view->setOutput();
398
399 $this->adminCommands = $container_view->adminCommands;
400
401 // it is important not to show the subobjects/admin panel here, since
402 // we will create nested forms in case, e.g. a news/calendar item is added
403 if (! $this->ctrl->isAsynch()) {
405 $this->showPossibleSubObjects();
406 }
407 $this->showPermanentLink();
408 $this->tabs_gui->activateTab(self::TAB_VIEW_CONTENT);
409 $this->tabs_gui->removeSubTab("page_editor");
410 $this->tabs_gui->removeSubTab("ordering"); // Mantis 0014728
411 }
412
418 protected function initCreationForms(string $new_type): array
419 {
420 $forms = array(
421 self::CFORM_NEW => $this->initCreateForm($new_type),
422 self::CFORM_IMPORT => $this->initImportForm($new_type),
423 );
424
425 return $forms;
426 }
427
428 public function showPossibleSubObjects(): void
429 {
430 $gui = new ilObjectAddNewItemGUI($this->object->getRefId());
432 //$gui->setCreationUrl("ilias.php?ref_id=" . $_GET["ref_id"] . "&admin_mode=settings&cmd=create&baseClass=ilAdministrationGUI&cmdClass=ilobjorgunitgui");
433 $gui->setCreationUrl($this->ctrl->getLinkTarget($this, 'create'));
434 $gui->render();
435 }
436
440 public function setTitleAndDescription(): void
441 {
442 # all possible create permissions
443 parent::setTitleAndDescription();
444 if ($this->object->getTitle() === "__OrgUnitAdministration") {
445 $this->tpl->setTitle($this->lng->txt("objs_orgu"));
446 $this->tpl->setDescription($this->lng->txt("objs_orgu"));
447 }
448
449 // Check for custom icon of type
450 if ($this->ilias->getSetting('custom_icons')) {
451 $icons_cache = ilObjOrgUnit::getIconsCache();
452 $icon_file = (isset($icons_cache[$this->object->getId()])) ? $icons_cache[$this->object->getId()] : '';
453 if ($icon_file) {
454 $this->tpl->setTitleIcon($icon_file, $this->lng->txt("obj_" . $this->object->getType()));
455 }
456 }
457 }
458
459 protected function addAdminLocatorItems(bool $do_not_add_object = false): void
460 {
461 $path = $this->tree->getPathFull($_GET["ref_id"], ilObjOrgUnit::getRootOrgRefId());
462 // add item for each node on path
463 foreach ((array) $path as $key => $row) {
464 if ($row["title"] === "__OrgUnitAdministration") {
465 $row["title"] = $this->lng->txt("objs_orgu");
466 }
467 $this->ctrl->setParameterByClass("ilobjorgunitgui", "ref_id", $row["child"]);
468 $this->ilLocator->addItem(
469 $row["title"],
470 $this->ctrl->getLinkTargetByClass("ilobjorgunitgui", "view"),
471 ilFrameTargetInfo::_getFrame("MainContent"),
472 $row["child"]
473 );
474 $this->ctrl->setParameterByClass("ilobjorgunitgui", "ref_id", $_GET["ref_id"]);
475 }
476 }
477
478 protected function redirectToRefId(int $ref_id, string $cmd = ""): void
479 {
480 $obj_type = ilObject::_lookupType($ref_id, true);
481 if ($obj_type !== "orgu") {
482 parent::redirectToRefId($ref_id, $cmd);
483 } else {
484 $this->ctrl->setParameterByClass("ilObjOrgUnitGUI", "ref_id", $ref_id);
485 $this->ctrl->redirectByClass("ilObjOrgUnitGUI", $cmd);
486 }
487 }
488
489 public function getTabs(): void
490 {
491 $read_access_ref_id = $this->rbacsystem->checkAccess('visible, 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('legacy_staff', 'legacy_staff', $this->ctrl->getLinkTargetByClass("ilOrgUnitStaffGUI", "showStaff"));
509 $this->tabs_gui->addTab(
510 self::TAB_STAFF,
511 $this->lng->txt(self::TAB_STAFF),
512 $this->ctrl->getLinkTargetByClass(
513 ilOrgUnitUserAssignmentGUI::class,
515 )
516 );
517 }
518 if (ilObjOrgUnitAccess::_checkAccessSettings($this->object->getRefId())) {
519 $this->tabs_gui->addTab(
520 self::TAB_SETTINGS,
521 $this->lng->txt(self::TAB_SETTINGS),
522 $this->ctrl->getLinkTarget($this, self::CMD_EDIT_SETTINGS)
523 );
524 }
526 $this->tabs_gui->addTab(
527 "administrate_users",
528 $this->lng->txt("administrate_users"),
529 $this->ctrl->getLinkTargetByClass("ilLocalUserGUI", "index")
530 );
531 }
532 }
533
534 if (ilObjOrgUnitAccess::_checkAccessSettings($this->object->getRefId())) {
535 if ($this->object->getRefId() == ilObjOrgUnit::getRootOrgRefId()) {
536 $this->tabs_gui->addTab(
537 self::TAB_GLOBAL_SETTINGS,
538 $this->lng->txt('settings'),
539 $this->ctrl->getLinkTargetByClass(ilOrgUnitGlobalSettingsGUI::class)
540 );
541 }
542 $this->tabs_gui->addTab(
543 self::TAB_EXPORT,
544 $this->lng->txt(self::TAB_EXPORT),
545 $this->ctrl->getLinkTargetByClass(ilOrgUnitExportGUI::class)
546 );
547
548 // Add OrgUnit types and positions tabs
549 if ($this->object->getRefId() == ilObjOrgUnit::getRootOrgRefId()) {
550 $this->tabs_gui->addTab(
551 self::TAB_ORGU_TYPES,
552 $this->lng->txt(self::TAB_ORGU_TYPES),
553 $this->ctrl->getLinkTargetByClass(ilOrgUnitTypeGUI::class)
554 );
555 $this->tabs_gui->addTab(
556 self::TAB_POSITIONS,
557 $this->lng->txt(self::TAB_POSITIONS),
558 $this->ctrl->getLinkTargetByClass(ilOrgUnitPositionGUI::class)
559 );
560 }
561 }
562 parent::getTabs();
563 }
564
565 protected function setSubTabsSettings(string $active_tab_id): void
566 {
567 $next_class = $this->ctrl->getNextClass($this);
568 $cmd = $this->ctrl->getCmd();
569 $this->tabs_gui->addSubTab(
570 'edit_settings',
571 $this->lng->txt(self::TAB_SETTINGS),
572 $this->ctrl->getLinkTarget($this, self::CMD_EDIT_SETTINGS)
573 );
574 $this->tabs_gui->addSubTab(
575 "edit_translations",
576 $this->lng->txt("obj_multilinguality"),
577 $this->ctrl->getLinkTargetByClass("iltranslationgui", "editTranslations")
578 );
579
580 $ilOrgUnitType = $this->object->getOrgUnitType();
581 if ($ilOrgUnitType instanceof ilOrgUnitType) {
582 if (count($ilOrgUnitType->getAssignedAdvancedMDRecords(true))) {
583 $this->tabs_gui->addSubTab(
584 'edit_advanced_settings',
585 $this->lng->txt('orgu_adv_settings'),
586 $this->ctrl->getLinkTarget($this, 'editAdvancedSettings')
587 );
588 }
589 }
590
591 $this->tabs_gui->setSubTabActive($active_tab_id);
592 switch ($next_class) {
593 case 'iltranslationgui':
594 $this->tabs_gui->setSubTabActive("edit_translations");
595 break;
596 case '':
597 switch ($cmd) {
599 $this->tabs_gui->setSubTabActive('edit_settings');
600 break;
601 case 'editAdvancedSettings':
602 case 'updateAdvancedSettings':
603 $this->tabs_gui->setSubTabActive('edit_advanced_settings');
604 break;
605 }
606 break;
607 }
608 }
609
610 public function setContentSubTabs(): void
611 {
613
614 $ref_id = $this->object->getRefId();
615 $may_create_orgus = $this->ilAccess->checkAccess("create_orgu", "", $ref_id, 'orgu');
616
617 if ($ref_id === ilObjOrgUnit::getRootOrgRefId() //only display the import tab at the first level
618 && $may_create_orgus
619 ) {
620 $this->tabs_gui->addSubTab(
621 "import",
622 $this->lng->txt("import"),
623 $this->ctrl->getLinkTargetByClass("ilOrgUnitSimpleImportGUI", "chooseImport")
624 );
625 }
626 }
627
632 {
633 $form = new ilPropertyFormGUI();
634 $form->setFormAction($this->ctrl->getFormAction($this));
635 $form->addCommandButton('updateAdvancedSettings', $this->lng->txt('save'));
636 $form->addCommandButton(self::CMD_EDIT_SETTINGS, $this->lng->txt('cancel'));
637
638 return $form;
639 }
640
644 protected function editAdvancedSettings(): void
645 {
646 if ($this->ilAccess->checkAccess("write", "", $this->ref_id) === false) {
647 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("permission_denied"), true);
648 $this->ctrl->redirect($this);
649 }
651 $gui = new ilAdvancedMDRecordGUI(
653 'orgu',
654 $this->object->getId(),
655 'orgu_type',
656 $this->object->getOrgUnitTypeId()
657 );
658 $gui->setPropertyForm($form);
659 $gui->parse();
660 $this->tpl->setContent($form->getHTML());
661 }
662
666 protected function updateAdvancedSettings(): void
667 {
668 if (!$this->ilAccess->checkAccess('write', '', $this->ref_id)) {
669 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
670 $this->ctrl->redirect($this);
671 }
673 $gui = new ilAdvancedMDRecordGUI(
675 'orgu',
676 $this->object->getId(),
677 'orgu_type',
678 $this->object->getOrgUnitTypeId()
679 );
680 $gui->setPropertyForm($form);
681 $form->checkInput();
682 $gui->parse();
683 if ($gui->importEditFormPostValues()) {
684 $gui->writeEditForm();
685 $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
686 $this->ctrl->redirect($this, 'editAdvancedSettings');
687 } else {
688 $this->tpl->setContent($form->getHTML());
689 }
690 }
691
692 public function editSettings(): void
693 {
694 if (!$this->ilAccess->checkAccess('write', "", $this->ref_id)) {
695 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
696 $this->ctrl->redirect($this);
697 }
698 $form = new ilObjOrgUnitSettingsFormGUI($this, $this->object);
699 $this->tpl->setContent($form->getHTML());
700 }
701
702 public function updateSettings(): void
703 {
704 if (!$this->ilAccess->checkAccess('write', '', $this->ref_id)) {
705 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
706 $this->ctrl->redirect($this);
707 }
708 $form = new ilObjOrgUnitSettingsFormGUI($this, $this->object);
709 if ($form->saveObject()) {
710 $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_obj_modified'), true);
711 $this->ctrl->redirect($this, self::CMD_EDIT_SETTINGS);
712 } else {
713 $this->tpl->setContent($form->getHTML());
714 }
715 }
716
717 public function showAdministrationPanel(): void
718 {
719 parent::showAdministrationPanel();
720 //an ugly encapsulation violation in order to remove the "verknüpfen"/"link" and copy button.
721 if (empty($this->toolbar->items) === false) {
722 foreach ($this->toolbar->items as $key => $item) {
723 if ($item["cmd"] == "link" || $item["cmd"] == "copy"
724 || $item["cmd"] == "download"
725 ) {
726 unset($this->toolbar->items[$key]);
727 }
728 }
729 }
730 }
731
732 public static function _goto(int $ref_id): void
733 {
734 global $DIC;
735 $ilCtrl = $DIC['ilCtrl'];
736 $ilCtrl->setTargetScript('ilias.php');
737 $ilCtrl->setParameterByClass("ilObjOrgUnitGUI", "ref_id", $ref_id);
738 $ilCtrl->setParameterByClass("ilObjOrgUnitGUI", "admin_mode", self::TAB_SETTINGS);
739 $ilCtrl->setParameterByClass("IlObjPluginDispatchGUI", "admin_mode", self::TAB_SETTINGS);
740 $ilCtrl->redirectByClass(array("ilAdministrationGUI", "ilObjOrgUnitGUI"), "view");
741 }
742
743 protected function getTreeSelectorGUI(string $cmd): ilTreeExplorerGUI
744 {
745 $explorer = new ilOrgUnitExplorerGUI("rep_exp_sel", $this, "showPasteTree", $this->tree);
746 $explorer->setAjax(false);
747 $explorer->setSelectMode('nodes[]', false);
748
749 return $explorer;
750 }
751
752 public function getAdminTabs(): void
753 {
754 $this->getTabs();
755 }
756
760 public function performPaste(): void
761 {
762 if ($this->clipboard->getCmd() != 'cut') {
763 $message = __METHOD__ . ": cmd was not 'cut' ; may be a hack attempt!";
764 $this->ilias->raiseError($message, $this->ilias->error_obj->WARNING);
765 } else {
766 if ($this->clipboard->hasEntries()) {
767 $this->pasteObject();
768 }
769 }
770 $this->ctrl->returnToParent($this);
771 }
772
773 public function doUserAutoCompleteObject(): void
774 {
775 }
776
777 //
778 // METHODS for local user administration.
779 //
780
785 public function confirmedDeleteObject(): void
786 {
787 $ids = filter_input(INPUT_POST, 'id', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY);
788 if (count($ids) > 0) {
790 $this->tpl->setOnScreenMessage('success', $this->lng->txt("info_deleted"), true);
791 }
792 $this->ctrl->returnToParent($this);
793 }
794
799 public function deleteObject(bool $error = false): void
800 {
801 $ilCtrl = $this->ctrl;
802 $ru = new ilRepositoryTrashGUI($this);
803
804 $arr_ref_ids = [];
805 //Delete via Manage (more than one)
806 if (isset($_POST["id"]) && is_array($_POST['id']) && count($_POST['id']) > 0) {
807 $arr_ref_ids = $_POST['id'];
808 } elseif (isset($_GET['item_ref_id']) && (int) $_GET['item_ref_id'] > 0) {
809 $arr_ref_ids = [(int) $_GET['item_ref_id']];
810 }
811
812 if (!$ru->showDeleteConfirmation($arr_ref_ids, false)) {
813 $ilCtrl->returnToParent($this);
814 }
815 }
816}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
checkAccess(string $a_permission, string $a_cmd, int $a_ref_id, string $a_type="", ?int $a_obj_id=null, ?int $a_tree_id=null)
check access for an object (provide $a_type and $a_obj_id if available for better performance)
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
Class ilContainerGUI This is a base GUI class for all container objects in ILIAS: root folder,...
addStandardContainerSubTabs(bool $a_include_view=true)
Add standard container subtabs for view, manage, oderdering and text/media editor link.
cancelMoveLinkObject()
Cancel move|link empty clipboard and return to parent.
ilPropertyFormGUI $form
pasteObject()
paste object from clipboard to current place Depending on the chosen command the object(s) are linked...
ilErrorHandling $error
Class ilCtrl provides processing control methods.
setFormAction(string $a_formaction)
static _getFrame(string $a_class)
Class ilInfoScreenGUI.
loadLanguageModule(string $a_module)
Load language module.
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...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: class.ilLog.php:31
static _checkAccessToUserLearningProgress(int $ref_id, int $usr_id)
static _checkAccessAdministrateUsers(int $ref_id)
static _checkAccessExport(int $ref_id)
static _checkAccessSettings(int $ref_id)
static _checkAccessStaff(int $ref_id)
Class ilObjOrgUnit GUI class.
confirmedDeleteObject()
confirmed deletion of org units -> org units are deleted immediately, without putting them to the tra...
ilAccessHandler $ilAccess
initCreationForms(string $new_type)
initCreationForms We override the method of class.ilObjectGUI because we have no copy functionality a...
getTabs()
@abstract overwrite in derived GUI class of your object type
afterSave(ilObject $new_object)
Post (successful) object creation hook.
updateAdvancedSettings()
Update Advanced Metadata.
redirectToRefId(int $ref_id, string $cmd="")
redirects to (repository) view per ref id usually to a container and usually used at the end of a sav...
getAdminTabs()
administration tabs show only permissions and trash folder
setTitleAndDescription()
called by prepare output
addAdminLocatorItems(bool $do_not_add_object=false)
should be overwritten to add object specific items (repository items are preloaded)
deleteObject(bool $error=false)
Display deletion confirmation screen for Org Units.
editAdvancedSettings()
Edit Advanced Metadata.
static _goto(int $ref_id)
ILIAS DI LoggingServices $ilLog
showPossibleSubObjects()
show possible sub objects (pull down menu)
getTreeSelectorGUI(string $cmd)
performPaste()
@description Prepare $_POST for the generic method performPasteIntoMultipleObjectsObject
setSubTabsSettings(string $active_tab_id)
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...
static getIconsCache()
Returns an array that maps from OrgUnit object IDs to its icon defined by the assigned OrgUnit type.
static getRootOrgRefId()
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...
initImportForm(string $new_type)
importFileObject(int $parent_id=null)
getReturnLocation(string $cmd, string $default_location="")
Get return location for command (command is method name without "Object", e.g.
ilLanguage $lng
initCreateForm(string $new_type)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupType(int $id, bool $reference=false)
Class ilOrgUnitExplorerGUI.
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...
Class ilOrgUnitPositionGUI.
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...
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...
Class ilOrgUnitUserAssignmentGUI.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
This class represents a property form user interface.
addCommandButton(string $a_cmd, string $a_text, string $a_id="")
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() ...
Repository GUI Utilities.
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...
Explorer class that works on tree objects (Services/Tree)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static redirect(string $a_script)
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$path
Definition: ltiservices.php:32
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
string $key
Consumer key/client ID value.
Definition: System.php:193
header include for all ilias files.
$_GET['client_id']
Definition: saml1-acs.php:21
$message
Definition: xapiexit.php:32