19 declare(strict_types=1);
66 $cmd = $this->
ctrl->getCmd();
87 'Invalid command for ilObjSearchLuceneSettingsFormGUI: ' . $cmd
94 bool $get_from_post =
false 98 $form = $form->withRequest($this->
http->request());
100 $this->tpl->setContent($this->
renderer->render($form));
106 ->withRequest($this->
http->request());
108 if (!$form->getData()) {
109 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'err_check_input'));
115 $data = $form->getData()[
'section'];
117 $settings->enableLuceneUserSearch((
bool)
$data[
'user_search_enabled']);
118 $settings->setFragmentCount((
int) $data[
'fragmentCount']);
119 $settings->setFragmentSize((
int) $data[
'fragmentSize']);
120 $settings->setMaxSubitems((
int) $data[
'maxSubitems']);
121 $settings->enableLuceneMimeFilter(!is_null($data[
'mime']));
122 if (!is_null($data[
'mime'])) {
123 $settings->setLuceneMimeFilter((array) $data[
'mime']);
125 $settings->enablePrefixWildcardQuery((
bool) $data[
'prefix']);
127 $data[
'last_index']->getTimestamp(),
134 if ($settings->enabledLucene()) {
135 $this->coordinator->refreshLuceneSettings();
137 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
138 $this->
ctrl->redirect($this,
'edit');
140 $this->tpl->setOnScreenMessage(
'failure', $exception->getMessage());
147 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'permission_denied'),
true);
148 $this->
ctrl->redirect($this,
'readOnly');
154 $field_factory = $this->
factory->input()->field();
157 $user_search = $field_factory->checkbox(
158 $this->
lng->txt(
'search_user_search_form'),
159 $this->
lng->txt(
'search_user_search_info_form')
160 )->
withValue($settings->isLuceneUserSearchEnabled());
163 $filter = $settings->getLuceneMimeFilter();
166 $checks[$mime] = $field_factory->checkbox(
167 $this->
lng->txt($def[
'trans'])
168 )->
withValue(isset($filter[$mime]) && $filter[$mime]);
171 $item_filter = $field_factory->optionalGroup(
173 $this->
lng->txt(
'search_mime_filter_form'),
174 $this->
lng->txt(
'search_mime_filter_form_info')
176 if (!$settings->isLuceneMimeFilterEnabled()) {
177 $item_filter = $item_filter->withValue(
null);
181 $prefix = $field_factory->checkbox(
182 $this->
lng->txt(
'lucene_prefix_wildcard'),
183 $this->
lng->txt(
'lucene_prefix_wildcard_info')
184 )->
withValue($settings->isPrefixWildcardQueryEnabled());
187 $frag_count = $field_factory->numeric(
188 $this->
lng->txt(
'lucene_num_fragments'),
189 $this->
lng->txt(
'lucene_num_frag_info')
190 )->
withValue($settings->getFragmentCount())
192 ->withAdditionalTransformation(
193 $this->
refinery->int()->isLessThanOrEqual(10)
195 $this->
refinery->int()->isGreaterThanOrEqual(1)
199 $frag_size = $field_factory->numeric(
200 $this->
lng->txt(
'lucene_size_fragments'),
201 $this->
lng->txt(
'lucene_size_frag_info')
202 )->
withValue($settings->getFragmentSize())
204 ->withAdditionalTransformation(
205 $this->
refinery->int()->isLessThanOrEqual(1000)
207 $this->
refinery->int()->isGreaterThanOrEqual(10)
211 $max_sub = $field_factory->numeric(
212 $this->
lng->txt(
'lucene_max_sub'),
213 $this->
lng->txt(
'lucene_max_sub_info')
214 )->
withValue($settings->getMaxSubitems())
216 ->withAdditionalTransformation(
217 $this->
refinery->int()->isLessThanOrEqual(10)
219 $this->
refinery->int()->isGreaterThanOrEqual(1)
223 $timezone = $this->
user->getTimeZone();
225 '@' . $settings->getLastIndexTime()->get(
IL_CAL_UNIX)
228 $last_index = $field_factory->dateTime(
229 $this->
lng->txt(
'lucene_last_index_time'),
230 $this->
lng->txt(
'lucene_last_index_time_info')
231 )->withRequired(
true)
233 ->withTimezone($timezone);
234 $last_index = $last_index->withValue(
235 $datetime->format($last_index->getFormat()->toString() .
' H:i')
241 $section = $this->
factory->input()->field()->section(
243 'user_search_enabled' => $user_search,
244 'mime' => $item_filter,
246 'fragmentCount' => $frag_count,
247 'fragmentSize' => $frag_size,
248 'maxSubitems' => $max_sub,
249 'last_index' => $last_index
251 $this->
lng->txt(
'lucene_settings_title')
252 )->withDisabled($read_only);
255 $action = $this->
ctrl->getFormAction($this,
'permDenied');
257 $action = $this->
ctrl->getFormAction($this,
'update');
260 return $this->
factory->input()->container()->form()->standard(
262 [
'section' => $section]
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.
static getLuceneMimeFilterDefinitions()
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.