19 declare(strict_types=1);
58 $cmd = $this->
ctrl->getCmd();
79 'Invalid command for ilObjSearchSettingsFormGUI: ' . $cmd
86 bool $get_from_post =
false 90 $form = $form->withRequest($this->
http->request());
92 $this->tpl->setContent($this->
renderer->render($form));
98 ->withRequest($this->
http->request());
100 if (!$form->getData()) {
101 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'err_check_input'));
108 $main_data = $form->getData()[
'section'];
109 $user_data = $form->getData()[
'user_section'];
111 $settings->setMaxHits((
int) $main_data[
'max_hits']);
113 switch ((
int) $main_data[
'search_type']) {
115 $settings->enableLucene(
false);
118 $settings->enableLucene(
true);
121 $settings->setDefaultOperator((
int) $main_data[
'operator']);
122 $settings->enableLuceneItemFilter(!is_null($main_data[
'filter']));
123 if (!is_null($main_data[
'filter'])) {
124 $settings->setLuceneItemFilter((array) $main_data[
'filter']);
126 $settings->setHideAdvancedSearch((
bool) $main_data[
'hide_adv_search']);
127 $settings->enableDateFilter((
bool) $main_data[
'cdate']);
128 $settings->setAutoCompleteLength((
int) $user_data[
'auto_complete_length']);
129 $settings->showInactiveUser((
bool) $user_data[
'inactive_user']);
130 $settings->showLimitedUser((
bool) $user_data[
'limited_user']);
135 if ($settings->enabledLucene()) {
136 $this->coordinator->refreshLuceneSettings();
138 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
139 $this->
ctrl->redirect($this,
'edit');
141 $this->tpl->setOnScreenMessage(
'failure', $exception->getMessage());
148 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'permission_denied'),
true);
149 $this->
ctrl->redirect($this,
'readOnly');
155 $field_factory = $this->
factory->input()->field();
159 for ($value = 5; $value <= 50; $value += 5) {
160 $values[$value] = $value;
162 $hits = $field_factory->select(
163 $this->
lng->txt(
'seas_max_hits'),
165 $this->
lng->txt(
'seas_max_hits_info')
167 ->withRequired(
true);
170 $type = $field_factory->radio(
171 $this->
lng->txt(
'search_type')
174 $this->
lng->txt(
'search_direct'),
175 $this->
lng->txt(
'search_like_info')
178 $this->
lng->txt(
'search_lucene'),
179 $this->
lng->txt(
'java_server_info')
180 )->withRequired(
true);
182 if ($settings->enabledLucene()) {
189 $operator = $field_factory->radio(
190 $this->
lng->txt(
'lucene_default_operator'),
191 $this->
lng->txt(
'lucene_default_operator_info')
194 $this->
lng->txt(
'lucene_and')
197 $this->
lng->txt(
'lucene_or')
198 )->withRequired(
true)
199 ->withValue((
string) $settings->getDefaultOperator());
202 $filter = $settings->getLuceneItemFilter();
205 $checks[$obj] = $field_factory->checkbox(
206 $this->
lng->txt($def[
'trans'])
207 )->
withValue(isset($filter[$obj]) && $filter[$obj]);
210 $item_filter = $field_factory->optionalGroup(
212 $this->
lng->txt(
'search_item_filter_form'),
213 $this->
lng->txt(
'search_item_filter_form_info')
215 if (!$settings->isLuceneItemFilterEnabled()) {
216 $item_filter = $item_filter->withValue(
null);
220 $cdate = $field_factory->checkbox(
221 $this->
lng->txt(
'search_cdate_filter'),
222 $this->
lng->txt(
'search_cdate_filter_info')
223 )->
withValue($settings->isDateFilterEnabled());
226 $hide_adv = $field_factory->checkbox(
227 $this->
lng->txt(
'search_hide_adv_search')
228 )->
withValue($settings->getHideAdvancedSearch());
237 $val = ($settings->getAutoCompleteLength() > 0)
238 ? $settings->getAutoCompleteLength()
240 $auto_complete = $field_factory->select(
241 $this->
lng->txt(
'search_auto_complete_length'),
246 $inactive_user = $field_factory->checkbox(
247 $this->
lng->txt(
'search_show_inactive_user'),
248 $this->
lng->txt(
'search_show_inactive_user_info')
249 )->
withValue($settings->isInactiveUserVisible());
252 $limited_user = $field_factory->checkbox(
253 $this->
lng->txt(
'search_show_limited_user'),
254 $this->
lng->txt(
'search_show_limited_user_info')
255 )->
withValue($settings->isLimitedUserVisible());
260 $section = $this->
factory->input()->field()->section(
263 'search_type' => $type,
264 'operator' => $operator,
265 'hide_adv_search' => $hide_adv,
266 'filter' => $item_filter,
269 $this->
lng->txt(
'seas_settings')
270 )->withDisabled($read_only);
272 $user_section = $this->
factory->input()->field()->section(
274 'auto_complete_length' => $auto_complete,
275 'inactive_user' => $inactive_user,
276 'limited_user' => $limited_user
278 $this->
lng->txt(
'user_search_settings_section')
279 )->withDisabled($read_only);
282 $action = $this->
ctrl->getFormAction($this,
'permDenied');
284 $action = $this->
ctrl->getFormAction($this,
'update');
287 return $this->
factory->input()->container()->form()->standard(
290 'section' => $section,
291 '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...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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.