ILIAS  trunk Revision v12.0_alpha-33-ge186251a14d
class.ilObjGeneralSettingsGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
25
31{
32 public function getType(): string
33 {
35 }
36
38 {
39 return new HeaderTitleGUI(
40 $this->ctrl,
41 $this->tpl,
42 $this->lng,
43 $this->http->request(),
44 new HeaderTitleRepo(),
45 $this->checkPermissionBool('write')
46 );
47 }
48
50 {
51 return new ContactInformationGUI(
52 $this->ctrl,
53 $this->tpl,
54 $this->lng,
55 $this->settings,
56 $this->checkPermissionBool('write')
57 );
58 }
59
60 public function executeCommand(): void
61 {
62 $this->checkPermission('read');
63
64 $this->lng->loadLanguageModule('adm');
65 $this->prepareOutput();
66
67 switch ($this->ctrl->getNextClass($this)) {
68 case strtolower(ilPermissionGUI::class):
69 $this->tabs_gui->activateTab('perm_settings');
70 $this->ctrl->forwardCommand(new ilPermissionGUI($this));
71 break;
72
73 case strtolower(HeaderTitleGUI::class):
74 $this->tabs_gui->activateTab('header_title');
75 $this->ctrl->forwardCommand($this->getHeaderTitleGUI());
76 break;
77
78 case strtolower(ContactInformationGUI::class):
79 $this->tabs_gui->activateTab('contact_data');
80 $this->ctrl->forwardCommand($this->getContactInformationGUI());
81 break;
82
83 default:
84 $this->tabs_gui->activateTab('basic_settings');
85
86 $cmd = $this->ctrl->getCmd("view");
87 switch ($cmd) {
88 case 'view':
89 $this->view();
90 break;
91
92 case 'update':
93 $this->checkPermission('write');
94 $this->update();
95 break;
96 }
97 }
98 }
99
100 public function getAdminTabs(): void
101 {
102 $this->tabs_gui->addTab(
103 'basic_settings',
104 $this->lng->txt('basic_settings'),
105 $this->ctrl->getLinkTarget($this)
106 );
107
108 $this->tabs_gui->addTab(
109 'header_title',
110 $this->lng->txt('header_title'),
111 $this->ctrl->getLinkTargetByClass([HeaderTitleGUI::class]),
112 );
113
114 $this->tabs_gui->addTab(
115 'contact_data',
116 $this->lng->txt('contact_data'),
117 $this->ctrl->getLinkTargetByClass([ContactInformationGUI::class]),
118 );
119
120 if ($this->checkPermissionBool('edit_permission')) {
121 $this->tabs_gui->addTab(
122 'perm_settings',
123 $this->lng->txt('perm_settings'),
124 $this->ctrl->getLinkTargetByClass([self::class, ilPermissionGUI::class], 'perm')
125 );
126 }
127 }
128
129 private function setSubTabs(): void
130 {
131 }
132
133 public function view(): void
134 {
135 $this->tpl->setContent($this->buildForm()->getHTML());
136 }
137
138 public function update(): void
139 {
140 $form = $this->buildForm();
141 if ($form->checkInput()) {
142 $this->settings->set("short_inst_name", $form->getInput("short_inst_name"));
143
144 $public_section = ilPublicSectionSettings::getInstance();
145 $public_section->setEnabled((bool) $form->getInput('pub_section'));
146
147 $domains = [];
148 foreach ((array) $form->getInput('public_section_domains') as $domain) {
149 if (strlen(trim($domain)) !== 0) {
150 $domains[] = $domain;
151 }
152 }
153 $public_section->setDomains($domains);
154 $public_section->save();
155
156 $global_profiles = ($form->getInput("pub_section"))
157 ? (int) $form->getInput('enable_global_profiles')
158 : 0;
159 $this->settings->set('enable_global_profiles', (string) $global_profiles);
160
161 $this->settings->set("open_google", $form->getInput("open_google"));
162 $this->settings->set("locale", $form->getInput("locale"));
163
164 $this->tpl->setOnScreenMessage(GlobalTemplate::MESSAGE_TYPE_SUCCESS, $this->lng->txt("msg_obj_modified"), true);
165 $this->ctrl->redirect($this);
166 }
167
168 $form->setValuesByPost();
169 $this->tpl->setContent($form->getHtml());
170 }
171
172 private function buildForm(): ilPropertyFormGUI
173 {
174 $form = new ilPropertyFormGUI();
175 $this->lng->loadLanguageModule("pd");
176
177 // installation short title
178 $ti = new ilTextInputGUI($this->lng->txt("short_inst_name"), "short_inst_name");
179 $ti->setMaxLength(200);
180 $ti->setSize(40);
181 $ti->setValue($this->settings->get("short_inst_name"));
182 $ti->setInfo($this->lng->txt("short_inst_name_info"));
183 $form->addItem($ti);
184
185 $cb = new ilCheckboxInputGUI($this->lng->txt("pub_section"), "pub_section");
186 $cb->setInfo($this->lng->txt("pub_section_info"));
187 if (ilPublicSectionSettings::getInstance()->isEnabled()) {
188 $cb->setChecked(true);
189 }
190 $form->addItem($cb);
191
192 $this->lng->loadLanguageModule('administration');
193 $domains = new ilTextInputGUI($this->lng->txt('adm_pub_section_domain_filter'), 'public_section_domains');
194 $domains->setInfo($this->lng->txt('adm_pub_section_domain_filter_info'));
195 $domains->setMulti(true);
196 $domains->setValue(current(ilPublicSectionSettings::getInstance()->getDomains()));
197 $domains->setMultiValues(ilPublicSectionSettings::getInstance()->getDomains());
198
199 $cb->addSubItem($domains);
200
201 // Enable Global Profiles
202 $cb_prop = new ilCheckboxInputGUI($this->lng->txt('pd_enable_user_publish'), 'enable_global_profiles');
203 $cb_prop->setInfo($this->lng->txt('pd_enable_user_publish_info'));
204 $cb_prop->setChecked((bool) $this->settings->get('enable_global_profiles'));
205 $cb->addSubItem($cb_prop);
206
207 // search engine
208 $robot_settings = ilRobotSettings::getInstance();
209 $cb2 = new ilCheckboxInputGUI($this->lng->txt("search_engine"), "open_google");
210 $cb2->setInfo($this->lng->txt("enable_search_engine"));
211 $form->addItem($cb2);
212
213 if (!$robot_settings->checkRewrite()) {
214 $cb2->setAlert($this->lng->txt("allow_override_alert"));
215 $cb2->setChecked(false);
216 $cb2->setDisabled(true);
217 } elseif ($this->settings->get("open_google")) {
218 $cb2->setChecked(true);
219 }
220
221 // locale
222 $ti = new ilTextInputGUI($this->lng->txt("adm_locale"), "locale");
223 $ti->setMaxLength(80);
224 $ti->setSize(40);
225 $ti->setInfo($this->lng->txt("adm_locale_info"));
226 $ti->setValue($this->settings->get("locale"));
227 $form->addItem($ti);
228
229 // save and cancel commands
230 if ($this->checkPermissionBool('write')) {
231 $form->addCommandButton("update", $this->lng->txt("save"));
232 }
233
234 $form->setTitle($this->lng->txt("basic_settings"));
235 $form->setFormAction($this->ctrl->getFormAction($this));
236
237 return $form;
238 }
239
240}
GUI to change the header title of the installation.
GUI to change the header title of the installation.
This class represents a checkbox property in a property form.
@ilCtrl_isCalledBy ilObjGeneralSettingsGUI: ilAdministrationGUI @ilCtrl_Calls ilObjGeneralSettingsGUI...
getType()
Functions that must be overwritten.
getAdminTabs()
administration tabs show only permissions and trash folder
view()
view object content (repository/workspace switch)
New implementation of ilObjectGUI.
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $node_id=null)
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
prepareOutput(bool $show_sub_objects=true)
This class represents a property form user interface.
static getInstance()
get singleton instance
This class represents a text property in a property form.
static http()
Fetches the global http state from ILIAS.