157 : StandardForm
158 {
160 $field_factory = $this->
factory->input()->field();
161
162
163 $user_search = $field_factory->checkbox(
164 $this->
lng->txt(
'search_user_search_form'),
165 $this->lng->txt('search_user_search_info_form')
166 )->withValue($settings->isLuceneUserSearchEnabled());
167
168
169 $filter = $settings->getLuceneMimeFilter();
170 $checks = [];
172 $checks[$mime] = $field_factory->checkbox(
173 $this->
lng->txt($def[
'trans'])
174 )->withValue(isset($filter[$mime]) && $filter[$mime]);
175 }
176
177 $item_filter = $field_factory->optionalGroup(
178 $checks,
179 $this->
lng->txt(
'search_mime_filter_form'),
180 $this->lng->txt('search_mime_filter_form_info')
181 );
182 if (!$settings->isLuceneMimeFilterEnabled()) {
183 $item_filter = $item_filter->withValue(null);
184 }
185
186
187 $prefix = $field_factory->checkbox(
188 $this->
lng->txt(
'lucene_prefix_wildcard'),
189 $this->lng->txt('lucene_prefix_wildcard_info')
190 )->withValue($settings->isPrefixWildcardQueryEnabled());
191
192
193 $frag_count = $field_factory->numeric(
194 $this->
lng->txt(
'lucene_num_fragments'),
195 $this->lng->txt('lucene_num_frag_info')
196 )->withValue($settings->getFragmentCount())
197 ->withRequired(true)
198 ->withAdditionalTransformation(
199 $this->
refinery->int()->isLessThanOrEqual(10)
200 )->withAdditionalTransformation(
201 $this->
refinery->int()->isGreaterThanOrEqual(1)
202 );
203
204
205 $frag_size = $field_factory->numeric(
206 $this->
lng->txt(
'lucene_size_fragments'),
207 $this->lng->txt('lucene_size_frag_info')
208 )->withValue($settings->getFragmentSize())
209 ->withRequired(true)
210 ->withAdditionalTransformation(
211 $this->
refinery->int()->isLessThanOrEqual(1000)
212 )->withAdditionalTransformation(
213 $this->
refinery->int()->isGreaterThanOrEqual(10)
214 );
215
216
217 $timezone = $this->
user->getTimeZone();
219 '@' . $settings->getLastIndexTime()->get(
IL_CAL_UNIX)
220 );
221 $datetime->setTimezone(
new DateTimeZone($timezone));
222 $last_index = $field_factory->dateTime(
223 $this->
lng->txt(
'lucene_last_index_time'),
224 $this->lng->txt('lucene_last_index_time_info')
225 )->withRequired(true)
226 ->withUseTime(true)
227 ->withTimezone($timezone);
228 $last_index = $last_index->withValue(
229 $datetime->format($last_index->getFormat()->toString() .
' H:i')
230 );
231
232 $section = $this->
factory->input()->field()->section(
233 [
234 'user_search_enabled' => $user_search,
235 'mime' => $item_filter,
236 'prefix' => $prefix
237 ],
238 $this->
lng->txt(
'lucene_settings_title')
239 )->withDisabled($read_only);
240
241 $text_section = $this->
factory->input()->field()->section(
242 [
243 'fragmentCount' => $frag_count,
244 'fragmentSize' => $frag_size
245 ],
246 $this->
lng->txt(
'lucene_settings_text_section')
247 )->withDisabled($read_only);
248
249 $index_section = $this->
factory->input()->field()->section(
250 [
251 'last_index' => $last_index
252 ],
253 $this->
lng->txt(
'lucene_settings_index_section')
254 )->withDisabled($read_only);
255
256 if ($read_only) {
257 $action = $this->
ctrl->getFormAction($this,
'permDenied');
258 } else {
259 $action = $this->
ctrl->getFormAction($this,
'update');
260 }
261
262 return $this->
factory->input()->container()->form()->standard(
263 $action,
264 [
265 'section' => $section,
266 'text_section' => $text_section,
267 'index_section' => $index_section
268 ]
269 );
270 }
static getLuceneMimeFilterDefinitions()