50 $main_tpl = $DIC->ui()->mainTemplate();
52 $this->
ctrl = $DIC->ctrl();
53 $this->
lng = $DIC->language();
54 $this->
lng->loadLanguageModule(
'orgu');
55 $this->tpl = $DIC->ui()->mainTemplate();
56 $this->request = $DIC->http()->request();
57 $to_int = $DIC[
'refinery']->kindlyTo()->int();
58 $ref_id = $DIC[
'http']->wrapper()->query()->retrieve(
'ref_id', $to_int);
61 $main_tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"permission_denied"),
true);
62 $this->
ctrl->redirectByClass(ilObjOrgUnitGUI::class);
66 $this->object_definition = $DIC[
"objDefinition"];
67 $this->ui_factory = $DIC[
'ui.factory'];
68 $this->ui_renderer = $DIC[
'ui.renderer'];
74 $cmd = $this->
ctrl->getCmd(self::CMD_EDIT);
75 $next_class = $this->
ctrl->getNextClass($this);
77 switch ($next_class) {
90 private function edit(): void
93 $this->tpl->setContent(
94 $this->ui_renderer->render($form)
98 private function save(): void
101 $data = $form->getData();
104 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'err_check_input'),
false);
105 $this->tpl->setContent($this->ui_renderer->render($form));
107 $enable_my_staff = current(array_shift(
$data));
108 $obj_settings = array_shift(
$data);
110 $this->
settings->set(
"enable_my_staff", $enable_my_staff);
112 $available_types = $this->object_definition->getOrgUnitPermissionTypes();
113 foreach ($available_types as $object_type) {
118 if (!is_null($obj_settings[$object_type])) {
119 list($active, $changeable, $default) = array_shift($obj_settings[$object_type]);
122 $obj_setting->setActive($active);
123 $obj_setting->setChangeableForObject($changeable);
124 $obj_setting->setActivationDefault((
int) $default);
125 $obj_setting->update();
127 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
128 $this->
ctrl->redirect($this, self::CMD_EDIT);
134 $sections[] = $this->ui_factory->input()->field()->section(
136 $this->ui_factory->input()->field()->checkbox(
137 $this->
lng->txt(
"orgu_enable_my_staff"),
138 $this->
lng->txt(
"orgu_enable_my_staff_info")
142 $this->
lng->txt(
"orgu_enable_my_staff")
147 $available_types = $this->object_definition->getOrgUnitPermissionTypes();
148 foreach ($available_types as $object_type) {
153 if ($this->object_definition->isPlugin($object_type)) {
156 $is_multi = !$this->object_definition->isSystemObject($object_type)
158 $lang_prefix = $is_multi ?
'objs_' :
'obj_';
159 $label = $this->
lng->txt($lang_prefix . $object_type);
164 $changeable[] = $this->ui_factory->input()->field()->switchableGroup(
166 $this->ui_factory->input()->field()->group(
168 $this->ui_factory->input()->field()->checkbox(
169 $this->
lng->txt(
'orgu_global_set_type_default'),
170 $this->
lng->txt(
'orgu_global_set_type_default_info'),
172 ->
withValue((
bool) $setting->getActivationDefault())
174 $this->
lng->txt(
'orgu_global_set_type_changeable_object'),
177 $this->ui_factory->input()->field()->group(
181 $this->
lng->txt(
'orgu_global_set_type_changeable_no'),
184 $this->
lng->txt(
'orgu_global_set_type_changeable')
187 $setting->isChangeableForObject() ? 0 : 1
190 $this->
refinery->custom()->transformation(
193 $changeable = !(bool) array_shift($v);
196 $default = (bool) current(array_shift($v));
198 return [$active, $changeable, $default];
203 $changeable[] = $this->ui_factory->input()->field()->hidden()->withValue(
'true')
204 ->withAdditionalTransformation(
205 $this->
refinery->custom()->transformation(
206 fn($v) => [
true,
false,
false]
211 $groups[$object_type] = $this->ui_factory->input()->field()->optionalGroup(
213 $this->
lng->txt(
'orgu_global_set_positions_type_active') .
' ' . $label
216 if (!$setting->isActive()) {
217 $groups[$object_type] = $groups[$object_type]->withValue(null);
221 $sections[] = $this->ui_factory->input()->field()->section(
223 $this->
lng->txt(
"orgu_global_set_positions")
226 $form_action = $this->
ctrl->getFormAction($this, self::CMD_SAVE);
227 return $this->ui_factory->input()->container()->form()->standard(
static _checkAccessSettings(int $ref_id)
ilGlobalTemplateInterface $tpl
Global orgunit settings GUI.
ilObjectDefinition $object_definition
static lookupTxtById(string $plugin_id, string $lang_var)
ServerRequestInterface $request
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...