ILIAS  release_8 Revision v8.24
ilOrgUnitGlobalSettingsGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilOrgUnitGlobalSettingsGUI:

Public Member Functions

 __construct ()
 
 executeCommand ()
 

Protected Attributes

ilCtrl $ctrl
 
ilLanguage $lng
 
ilGlobalTemplateInterface $tpl
 

Private Member Functions

 settings (ilPropertyFormGUI $form=null)
 
 initSettingsForm ()
 
 saveSettings ()
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Global orgunit settings GUI

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e @ilCtrl_IsCalledBy ilOrgUnitGlobalSettingsGUI: ilObjOrgUnitGUI

Definition at line 26 of file class.ilOrgUnitGlobalSettingsGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilOrgUnitGlobalSettingsGUI::__construct ( )

Definition at line 32 of file class.ilOrgUnitGlobalSettingsGUI.php.

33 {
34 global $DIC;
35 $main_tpl = $DIC->ui()->mainTemplate();
36
37 $this->ctrl = $DIC->ctrl();
38 $this->lng = $DIC->language();
39 $this->lng->loadLanguageModule('orgu');
40 $this->tpl = $DIC->ui()->mainTemplate();
41
42 if (!ilObjOrgUnitAccess::_checkAccessSettings((int) $_GET['ref_id'])) {
43 $main_tpl->setOnScreenMessage('failure', $this->lng->txt("permission_denied"), true);
44 $this->ctrl->redirectByClass(ilObjOrgUnitGUI::class);
45 }
46 }
static _checkAccessSettings(int $ref_id)
global $DIC
Definition: feed.php:28
$_GET['client_id']
Definition: saml1-acs.php:21

References $_GET, $DIC, ilObjOrgUnitAccess\_checkAccessSettings(), ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilOrgUnitGlobalSettingsGUI::executeCommand ( )

Definition at line 48 of file class.ilOrgUnitGlobalSettingsGUI.php.

48 : void
49 {
50 $cmd = $this->ctrl->getCmd('settings');
51 $next_class = $this->ctrl->getNextClass($this);
52
53 switch ($next_class) {
54 default:
55 $this->$cmd();
56 break;
57 }
58 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ initSettingsForm()

ilOrgUnitGlobalSettingsGUI::initSettingsForm ( )
private

Definition at line 68 of file class.ilOrgUnitGlobalSettingsGUI.php.

69 {
70 global $DIC;
71
72 $form = new ilPropertyFormGUI();
73 $form->setFormAction($this->ctrl->getFormAction($this, 'saveSettings'));
74
75 // My Staff
76 $section = new ilFormSectionHeaderGUI();
77 $section->setTitle($this->lng->txt('orgu_enable_my_staff'));
78 $form->addItem($section);
79
80 $item = new ilCheckboxInputGUI($this->lng->txt("orgu_enable_my_staff"), "enable_my_staff");
81 $item->setInfo($this->lng->txt("orgu_enable_my_staff_info"));
82 $item->setValue("1");
83 $item->setChecked(($DIC->settings()->get("enable_my_staff") ? true : false));
84 $form->addItem($item);
85
86 // Positions in Modules
87 $section = new ilFormSectionHeaderGUI();
88 $section->setTitle($this->lng->txt('orgu_global_set_positions'));
89 $form->addItem($section);
90
91 $objDefinition = $DIC['objDefinition'];
92 $available_types = $objDefinition->getOrgUnitPermissionTypes();
93 foreach ($available_types as $object_type) {
94 $setting = new ilOrgUnitObjectTypePositionSetting($object_type);
95 $is_multi = false;
96
97 if ($objDefinition->isPlugin($object_type)) {
98 $label = ilObjectPlugin::lookupTxtById($object_type, 'objs_' . $object_type);
99 } else {
100 $is_multi = !$objDefinition->isSystemObject($object_type) && $object_type != ilOrgUnitOperationContext::CONTEXT_ETAL;
101 $lang_prefix = $is_multi ? 'objs_' : 'obj_';
102 $label = $this->lng->txt($lang_prefix . $object_type);
103 }
104
106 $this->lng->txt('orgu_global_set_positions_type_active') . ' ' . $label,
107 $object_type . '_active'
108 );
109 $type->setValue(1);
110 $type->setChecked($setting->isActive());
111 if ($is_multi) {
113 $this->lng->txt('orgu_global_set_type_changeable'),
114 $object_type . '_changeable'
115 );
116 $scope->setValue((int) $setting->isChangeableForObject());
117
118 $scope_object = new ilRadioOption(
119 $this->lng->txt('orgu_global_set_type_changeable_object'),
120 1
121 );
122 $default = new ilCheckboxInputGUI(
123 $this->lng->txt('orgu_global_set_type_default'),
124 $object_type . '_default'
125 );
126 $default->setInfo($this->lng->txt('orgu_global_set_type_default_info'));
128 $default->setChecked($setting->getActivationDefault());
129
130 $scope_object->addSubItem($default);
131 $scope->addOption($scope_object);
132
133 $scope_global = new ilRadioOption(
134 $this->lng->txt('orgu_global_set_type_changeable_no'),
135 0
136 );
137 $scope->addOption($scope_global);
138
139 $type->addSubItem($scope);
140 }
141 $form->addItem($type);
142 }
143 $form->addCommandButton('saveSettings', $this->lng->txt('save'));
144
145 return $form;
146 }
This class represents a checkbox property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static lookupTxtById(string $plugin_id, string $lang_var)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a property form user interface.
This class represents a property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$scope
Definition: ltiregstart.php:53
$type

References $DIC, $scope, $type, ilOrgUnitOperationContext\CONTEXT_ETAL, ILIAS\Repository\ctrl(), ilOrgUnitObjectTypePositionSetting\DEFAULT_ON, ILIAS\Repository\lng(), and ilObjectPlugin\lookupTxtById().

Referenced by saveSettings(), and settings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveSettings()

ilOrgUnitGlobalSettingsGUI::saveSettings ( )
private

Definition at line 148 of file class.ilOrgUnitGlobalSettingsGUI.php.

148 : void
149 {
150 global $DIC;
151 $objDefinition = $DIC['objDefinition'];
152 $form = $this->initSettingsForm();
153 if ($form->checkInput()) {
154 // Orgu Permissions / Positions in Modules
155 $available_types = $objDefinition->getOrgUnitPermissionTypes();
156 foreach ($available_types as $object_type) {
157 $obj_setting = new ilOrgUnitObjectTypePositionSetting($object_type);
158 $obj_setting->setActive((bool) $form->getInput($object_type . '_active'));
159 $obj_setting->setActivationDefault((int) $form->getInput($object_type . '_default'));
160 $obj_setting->setChangeableForObject((bool) $form->getInput($object_type
161 . '_changeable'));
162 $obj_setting->update();
163 }
164
165 // MyStaff
166 $DIC->settings()->set("enable_my_staff", (int) $form->getInput('enable_my_staff'));
167
168 $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
169 $this->ctrl->redirect($this, 'settings');
170 } else {
171 $form->setValuesByPost();
172 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('err_check_input'), false);
173 $this->settings($form);
174 }
175 }
settings(ilPropertyFormGUI $form=null)

References $DIC, ILIAS\Repository\ctrl(), initSettingsForm(), ILIAS\Repository\lng(), and settings().

+ Here is the call graph for this function:

◆ settings()

ilOrgUnitGlobalSettingsGUI::settings ( ilPropertyFormGUI  $form = null)
private

Definition at line 60 of file class.ilOrgUnitGlobalSettingsGUI.php.

60 : void
61 {
62 if (!$form instanceof ilPropertyFormGUI) {
63 $form = $this->initSettingsForm();
64 }
65 $this->tpl->setContent($form->getHTML());
66 }

References initSettingsForm().

Referenced by saveSettings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

ilCtrl ilOrgUnitGlobalSettingsGUI::$ctrl
protected

Definition at line 28 of file class.ilOrgUnitGlobalSettingsGUI.php.

◆ $lng

ilLanguage ilOrgUnitGlobalSettingsGUI::$lng
protected

Definition at line 29 of file class.ilOrgUnitGlobalSettingsGUI.php.

◆ $tpl

ilGlobalTemplateInterface ilOrgUnitGlobalSettingsGUI::$tpl
protected

Definition at line 30 of file class.ilOrgUnitGlobalSettingsGUI.php.


The documentation for this class was generated from the following file: