4 require_once
"classes/class.ilObjectGUI.php";
26 $this->
ilObjectGUI($a_data,$a_id,$a_call_by_reference,$a_prepare_output);
28 $this->lng->loadLanguageModule(
'search');
33 $next_class = $this->ctrl->getNextClass($this);
34 $cmd = $this->ctrl->getCmd();
39 case 'ilpermissiongui':
40 $this->tabs_gui->setTabActive(
'perm_settings');
41 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
43 $ret =& $this->ctrl->forwardCommand($perm_gui);
62 $this->ctrl->redirect($this,
"settings");
73 if(!$ilAccess->checkAccess(
'read',
'',$this->object->getRefId()))
75 $ilErr->raiseError($this->lng->txt(
'permission_denied'),$ilErr->MESSAGE);
77 $this->tabs_gui->setTabActive(
'settings');
79 $this->tpl->setContent($this->form->getHTML());
89 include_once
'Services/WebServices/RPC/classes/class.ilRPCServerSettings.php';
93 if(!$rbacsystem->checkAccess(
'write',$this->object->getRefId()))
95 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
98 $this->
object->initSettingsObject();
99 $this->
object->settings_obj->setMaxHits((
int)
$_POST[
'max_hits']);
100 $this->
object->settings_obj->enableIndex($_POST[
'search_index']);
101 $this->
object->settings_obj->enableLucene($_POST[
'search_lucene']);
102 $this->
object->settings_obj->setHideAdvancedSearch($_POST[
'hide_adv_search']);
103 $this->
object->settings_obj->setAutoCompleteLength($_POST[
'auto_complete_length']);
106 if($this->object->settings_obj->enabledLucene() and !$rpc_settings->pingServer())
109 $this->ctrl->redirect($this,
'settings');
114 $this->
object->settings_obj->update();
117 $this->ctrl->redirect($this,
'settings');
136 if ($rbacsystem->checkAccess(
"visible,read",$this->object->getRefId()))
138 $tabs_gui->addTarget(
"settings",
139 $this->ctrl->getLinkTarget($this,
"settings"), array(
"settings",
"",
"view"),
"",
"");
142 if($rbacsystem->checkAccess(
'read',$this->object->getRefId()))
144 $tabs_gui->addTarget(
'lucene_advanced_settings',
145 $this->ctrl->getLinkTarget($this,
'advancedLuceneSettings'));
148 if($rbacsystem->checkAccess(
'read',$this->object->getRefId()))
150 $tabs_gui->addTarget(
'lucene_settings_tab',
151 $this->ctrl->getLinkTarget($this,
'luceneSettings'));
155 if ($rbacsystem->checkAccess(
'edit_permission',$this->object->getRefId()))
157 $tabs_gui->addTarget(
"perm_settings",
158 $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
"perm"), array(
"perm",
"info",
"owner"),
'ilpermissiongui');
171 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
172 include_once
'./Services/Search/classes/class.ilSearchSettings.php';
177 $this->form->setFormAction($this->ctrl->getFormAction($this,
'updateSettings'));
178 $this->form->addCommandButton(
'updateSettings',$this->lng->txt(
'save'));
179 $this->form->setTitle($this->lng->txt(
'seas_settings'));
183 $hits->
setValue($settings->getMaxHits());
184 $hits->setRequired(
true);
185 for($value = 5; $value <= 15; $value += 5)
187 $values[$value] = $value;
189 $hits->setOptions($values);
190 $hits->setInfo($this->lng->txt(
'seas_max_hits_info'));
191 $this->form->addItem($hits);
196 if($settings->enabledLucene())
200 elseif($settings->enabledIndex())
208 $type->setRequired(
true);
209 $this->form->addItem(
$type);
213 $cb->
setChecked($settings->getHideAdvancedSearch());
214 $this->form->addItem($cb);
223 $si =
new ilSelectInputGUI($lng->txt(
"search_auto_complete_length"),
"auto_complete_length");
225 $val = ($settings->getAutoCompleteLength() > 0)
226 ? $settings->getAutoCompleteLength()
229 $this->form->addItem($si);
233 $type->addOption($direct);
235 if($ilDB->getDBType() ==
'mysql')
238 $type->addOption($index);
242 $type->addOption($lucene);
255 $this->form->checkInput();
257 if(!$ilAccess->checkAccess(
'write',
'',$this->object->getRefId()))
259 $ilErr->raiseError($this->lng->txt(
'permission_denied'),$ilErr->MESSAGE);
262 include_once
'./Services/Search/classes/class.ilSearchSettings.php';
264 $settings->setMaxHits((
int)
$_POST[
'max_hits']);
266 switch((
int) $_POST[
'search_type'])
269 $settings->enableIndex(
false);
270 $settings->enableLucene(
false);
273 $settings->enableIndex(
true);
274 $settings->enableLucene(
false);
277 $settings->enableIndex(
false);
278 $settings->enableLucene(
true);
282 $settings->setHideAdvancedSearch($_POST[
'hide_adv_search']);
283 $settings->setAutoCompleteLength($_POST[
'auto_complete_length']);
301 $this->tabs_gui->setTabActive(
'lucene_settings_tab');
304 $this->tpl->setContent($this->form->getHTML());
314 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
315 include_once
'./Services/Search/classes/class.ilSearchSettings.php';
320 $this->form->setFormAction($this->ctrl->getFormAction($this,
'cancel'));
322 $this->form->setTitle($this->lng->txt(
'lucene_settings_title'));
323 $this->form->addCommandButton(
'saveLuceneSettings',$this->lng->txt(
'save'));
324 $this->form->addCommandButton(
'cancel',$this->lng->txt(
'cancel'));
328 $operator->setInfo($this->lng->txt(
'lucene_default_operator_info'));
329 $operator->setValue($this->settings->getDefaultOperator());
332 $operator->addOption($and);
335 $operator->addOption($or);
336 $this->form->addItem($operator);
341 $if->setChecked($this->settings->isLuceneItemFilterEnabled());
342 $if->setInfo($this->lng->txt(
'search_item_filter_form_info'));
343 $this->form->addItem($if);
345 $filter = $this->settings->getLuceneItemFilter();
351 $ch->setChecked(
true);
354 $if->addSubItem($ch);
357 $numFrag =
new ilNumberInputGUI($this->lng->txt(
'lucene_num_fragments'),
'fragmentCount');
359 $numFrag->setSize(2);
360 $numFrag->setMaxLength(2);
361 $numFrag->setMinValue(1);
362 $numFrag->setMaxValue(10);
363 $numFrag->setInfo($this->lng->txt(
'lucene_num_frag_info'));
364 $numFrag->setValue($this->settings->getFragmentCount());
365 $this->form->addItem($numFrag);
367 $sizeFrag =
new ilNumberInputGUI($this->lng->txt(
'lucene_size_fragments'),
'fragmentSize');
369 $sizeFrag->setSize(2);
370 $sizeFrag->setMaxLength(4);
371 $sizeFrag->setMinValue(10);
372 $sizeFrag->setMaxValue(1000);
373 $sizeFrag->setInfo($this->lng->txt(
'lucene_size_frag_info'));
374 $sizeFrag->setValue($this->settings->getFragmentSize());
375 $this->form->addItem($sizeFrag);
377 $maxSub =
new ilNumberInputGUI($this->lng->txt(
'lucene_max_sub'),
'maxSubitems');
380 $maxSub->setMaxLength(2);
381 $maxSub->setMinValue(1);
382 $maxSub->setMaxValue(10);
383 $maxSub->setInfo($this->lng->txt(
'lucene_max_sub_info'));
384 $maxSub->setValue($this->settings->getMaxSubitems());
385 $this->form->addItem($maxSub);
388 $relevance->
setOptionTitle($this->lng->txt(
'lucene_show_relevance'));
389 $relevance->setInfo($this->lng->txt(
'lucene_show_relevance_info'));
390 $relevance->setValue(1);
391 $relevance->setChecked($this->settings->isRelevanceVisible());
392 $this->form->addItem($relevance);
394 $last_index =
new ilDateTimeInputGUI($this->lng->txt(
'lucene_last_index_time'),
'last_index');
396 $last_index->setDate($this->settings->getLastIndexTime());
397 $last_index->setInfo($this->lng->txt(
'lucene_last_index_time_info'));
398 $this->form->addItem($last_index);
414 $settings->setDefaultOperator((
int)
$_POST[
'operator']);
415 $settings->setFragmentCount((
int) $_POST[
'fragmentCount']);
416 $settings->setFragmentSize((
int) $_POST[
'fragmentSize']);
417 $settings->setMaxSubitems((
int) $_POST[
'maxSubitems']);
418 $settings->showRelevance((
int) $_POST[
'relevance']);
419 $settings->enableLuceneItemFilter((
int) $_POST[
'if']);
420 $settings->setLuceneItemFilter((array) $_POST[
'filter']);
422 if($this->form->checkInput())
424 $settings->setLastIndexTime($this->form->getItemByPostVar(
'last_index')->getDate());
428 $ilBench->start(
'Lucene',
'LuceneRefreshSettings');
431 include_once
'./Services/WebServices/RPC/classes/class.ilRpcClientFactory.php';
433 CLIENT_ID.
'_'.$ilSetting->get(
'inst_id',0));
441 $ilLog->write(__METHOD__.
': '.$e->getMessage());
456 $this->tabs_gui->setTabActive(
'lucene_advanced_settings');
458 include_once
'./Services/Search/classes/Lucene/class.ilLuceneAdvancedSearchActivationTableGUI.php';
459 include_once
'./Services/Search/classes/Lucene/class.ilLuceneAdvancedSearchSettings.php';
462 $table->setTitle($this->lng->txt(
'lucene_advanced_settings_table'));
465 $this->tpl->setContent($table->getHTML());
470 include_once
'./Services/Search/classes/Lucene/class.ilLuceneAdvancedSearchSettings.php';
475 $settings->setActive($field,in_array($field,(array)
$_POST[
'fid']) ?
true :
false);
490 $this->tabs_gui->addSubTabTarget(
'lucene_general_settings',
491 $this->ctrl->getLinkTarget($this,
'luceneSettings'));