19 declare(strict_types=1);
52 $this->factory = $ui->
factory();
59 $cmd = $this->
ctrl->getCmd();
80 'Invalid command for ilObjSearchSettingsFormGUI: ' . $cmd
87 bool $get_from_post =
false 91 $form = $form->withRequest($this->
http->request());
93 $this->tpl->setContent($this->renderer->render($form));
99 ->withRequest($this->
http->request());
101 if (!$form->getData()) {
102 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'err_check_input'));
109 $main_data = $form->getData()[
'section'];
110 $user_data = $form->getData()[
'user_section'];
112 $settings->setMaxHits((
int) $main_data[
'max_hits']);
114 switch ((
int) $main_data[
'search_type']) {
116 $settings->enableLucene(
false);
119 $settings->enableLucene(
true);
122 $settings->setDefaultOperator((
int) $main_data[
'operator']);
123 $settings->enableLuceneItemFilter(!is_null($main_data[
'filter']));
124 if (!is_null($main_data[
'filter'])) {
125 $settings->setLuceneItemFilter((array) $main_data[
'filter']);
127 $settings->setHideAdvancedSearch((
bool) $main_data[
'hide_adv_search']);
128 $settings->enableDateFilter((
bool) $main_data[
'cdate']);
129 $settings->setAutoCompleteLength((
int) $user_data[
'auto_complete_length']);
130 $settings->showInactiveUser((
bool) $user_data[
'inactive_user']);
131 $settings->showLimitedUser((
bool) $user_data[
'limited_user']);
136 if ($settings->enabledLucene()) {
137 $this->coordinator->refreshLuceneSettings();
139 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
140 $this->
ctrl->redirect($this,
'edit');
142 $this->tpl->setOnScreenMessage(
'failure', $exception->getMessage());
149 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'permission_denied'),
true);
150 $this->
ctrl->redirect($this,
'readOnly');
156 $field_factory = $this->factory->input()->field();
160 for ($value = 5; $value <= 50; $value += 5) {
161 $values[$value] = $value;
163 $hits = $field_factory->select(
164 $this->
lng->txt(
'seas_max_hits'),
166 $this->
lng->txt(
'seas_max_hits_info')
168 ->withRequired(
true);
171 $type = $field_factory->radio(
172 $this->
lng->txt(
'search_type')
175 $this->
lng->txt(
'search_direct'),
176 $this->
lng->txt(
'search_like_info')
179 $this->
lng->txt(
'search_lucene'),
180 $this->
lng->txt(
'java_server_info')
181 )->withRequired(
true);
183 if ($settings->enabledLucene()) {
190 $operator = $field_factory->radio(
191 $this->
lng->txt(
'lucene_default_operator'),
192 $this->
lng->txt(
'lucene_default_operator_info')
195 $this->
lng->txt(
'lucene_and')
198 $this->
lng->txt(
'lucene_or')
199 )->withRequired(
true)
200 ->withValue((
string) $settings->getDefaultOperator());
203 $filter = $settings->getLuceneItemFilter();
206 $checks[$obj] = $field_factory->checkbox(
207 $this->
lng->txt($def[
'trans'])
208 )->
withValue(isset($filter[$obj]) && $filter[$obj]);
211 $item_filter = $field_factory->optionalGroup(
213 $this->
lng->txt(
'search_item_filter_form'),
214 $this->
lng->txt(
'search_item_filter_form_info')
216 if (!$settings->isLuceneItemFilterEnabled()) {
217 $item_filter = $item_filter->withValue(null);
221 $cdate = $field_factory->checkbox(
222 $this->
lng->txt(
'search_cdate_filter'),
223 $this->
lng->txt(
'search_cdate_filter_info')
224 )->
withValue($settings->isDateFilterEnabled());
227 $hide_adv = $field_factory->checkbox(
228 $this->
lng->txt(
'search_hide_adv_search')
229 )->
withValue($settings->getHideAdvancedSearch());
238 $val = ($settings->getAutoCompleteLength() > 0)
239 ? $settings->getAutoCompleteLength()
241 $auto_complete = $field_factory->select(
242 $this->
lng->txt(
'search_auto_complete_length'),
247 $inactive_user = $field_factory->checkbox(
248 $this->
lng->txt(
'search_show_inactive_user'),
249 $this->
lng->txt(
'search_show_inactive_user_info')
250 )->
withValue($settings->isInactiveUserVisible());
253 $limited_user = $field_factory->checkbox(
254 $this->
lng->txt(
'search_show_limited_user'),
255 $this->
lng->txt(
'search_show_limited_user_info')
256 )->
withValue($settings->isLimitedUserVisible());
261 $section = $this->factory->input()->field()->section(
264 'search_type' => $type,
265 'operator' => $operator,
266 'hide_adv_search' => $hide_adv,
267 'filter' => $item_filter,
270 $this->
lng->txt(
'seas_settings')
271 )->withDisabled($read_only);
273 $user_section = $this->factory->input()->field()->section(
275 'auto_complete_length' => $auto_complete,
276 'inactive_user' => $inactive_user,
277 'limited_user' => $limited_user
279 $this->
lng->txt(
'user_search_settings_section')
280 )->withDisabled($read_only);
283 $action = $this->
ctrl->getFormAction($this,
'permDenied');
285 $action = $this->
ctrl->getFormAction($this,
'update');
288 return $this->factory->input()->container()->form()->standard(
291 'section' => $section,
292 'user_section' => $user_section,
static getLuceneItemFilterDefinitions()
Get lucene item filter definitions.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Provides fluid interface to RBAC services.
static http()
Fetches the global http state from ILIAS.
This is how the factory for UI elements looks.
renderer()
Get a renderer for UI components.
factory()
Get the factory that crafts UI components.
mainTemplate()
Get the ILIAS main template.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...