19 declare(strict_types=1);
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->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());
232 $val = ($settings->getAutoCompleteLength() > 0)
233 ? $settings->getAutoCompleteLength()
235 $auto_complete = $field_factory->select(
236 $this->
lng->txt(
'search_auto_complete_length'),
241 $inactive_user = $field_factory->checkbox(
242 $this->
lng->txt(
'search_show_inactive_user'),
243 $this->
lng->txt(
'search_show_inactive_user_info')
244 )->
withValue($settings->isInactiveUserVisible());
247 $limited_user = $field_factory->checkbox(
248 $this->
lng->txt(
'search_show_limited_user'),
249 $this->
lng->txt(
'search_show_limited_user_info')
250 )->
withValue($settings->isLimitedUserVisible());
255 $section = $this->
factory->input()->field()->section(
258 'search_type' => $type,
259 'operator' => $operator,
260 'filter' => $item_filter,
263 $this->
lng->txt(
'seas_settings')
264 )->withDisabled($read_only);
266 $user_section = $this->
factory->input()->field()->section(
268 'auto_complete_length' => $auto_complete,
269 'inactive_user' => $inactive_user,
270 'limited_user' => $limited_user
272 $this->
lng->txt(
'user_search_settings_section')
273 )->withDisabled($read_only);
276 $action = $this->
ctrl->getFormAction($this,
'permDenied');
278 $action = $this->
ctrl->getFormAction($this,
'update');
281 return $this->
factory->input()->container()->form()->standard(
284 'section' => $section,
285 '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.