3 declare(strict_types=1);
51 $this->factory = $ui->
factory();
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'));
107 $data = $form->getData()[
'section'];
111 switch ((
int) $data[
'search_type']) {
119 $settings->setDefaultOperator((
int) $data[
'operator']);
120 $settings->enableLuceneItemFilter(!is_null($data[
'filter']));
121 if (!is_null($data[
'filter'])) {
122 $settings->setLuceneItemFilter((array) $data[
'filter']);
124 $settings->setHideAdvancedSearch((
bool) $data[
'hide_adv_search']);
125 $settings->setAutoCompleteLength((
int) $data[
'auto_complete_length']);
126 $settings->showInactiveUser((
bool) $data[
'inactive_user']);
127 $settings->showLimitedUser((
bool) $data[
'limited_user']);
128 $settings->enableDateFilter((
bool) $data[
'cdate']);
129 $settings->enableLuceneUserSearch((
bool) $data[
'user_search_enabled']);
135 $this->coordinator->refreshLuceneSettings();
137 $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);
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 $user_search = $field_factory->checkbox(
203 $this->
lng->txt(
'search_user_search_form'),
204 $this->
lng->txt(
'search_user_search_info_form')
208 $filter =
$settings->getLuceneItemFilter();
211 $checks[$obj] = $field_factory->checkbox(
212 $this->
lng->txt($def[
'trans'])
213 )->
withValue(isset($filter[$obj]) && $filter[$obj]);
216 $item_filter = $field_factory->optionalGroup(
218 $this->
lng->txt(
'search_item_filter_form'),
219 $this->
lng->txt(
'search_item_filter_form_info')
221 if (!
$settings->isLuceneItemFilterEnabled()) {
222 $item_filter = $item_filter->withValue(null);
226 $cdate = $field_factory->checkbox(
227 $this->
lng->txt(
'search_cdate_filter'),
228 $this->
lng->txt(
'search_cdate_filter_info')
232 $hide_adv = $field_factory->checkbox(
233 $this->
lng->txt(
'search_hide_adv_search')
243 $val = (
$settings->getAutoCompleteLength() > 0)
246 $auto_complete = $field_factory->select(
247 $this->
lng->txt(
'search_auto_complete_length'),
252 $inactive_user = $field_factory->checkbox(
253 $this->
lng->txt(
'search_show_inactive_user'),
254 $this->
lng->txt(
'search_show_inactive_user_info')
258 $limited_user = $field_factory->checkbox(
259 $this->
lng->txt(
'search_show_limited_user'),
260 $this->
lng->txt(
'search_show_limited_user_info')
266 $section = $this->factory->input()->field()->section(
269 'search_type' =>
$type,
270 'operator' => $operator,
271 'user_search_enabled' => $user_search,
272 'filter' => $item_filter,
274 'hide_adv_search' => $hide_adv,
275 'auto_complete_length' => $auto_complete,
276 'inactive_user' => $inactive_user,
277 'limited_user' => $limited_user
279 $this->
lng->txt(
'seas_settings')
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(
290 [
'section' => $section]
Interface GlobalHttpState.
An entity that renders components to a string output.
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.
renderer()
Get a renderer for UI components.
factory()
Get the factory that crafts UI components.
static clear(string $a_var)
mainTemplate()
Get the ILIAS main template.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...