4 require_once
"./Services/Object/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']);
104 $this->
object->settings_obj->setDefaultOperator((
int) $_POST[
'operator']);
105 $this->
object->settings_obj->enableLuceneItemFilter((
int) $_POST[
'if']);
106 $this->
object->settings_obj->setLuceneItemFilter((array) $_POST[
'filter']);
110 if($this->object->settings_obj->enabledLucene() and !$rpc_settings->pingServer())
113 $this->ctrl->redirect($this,
'settings');
118 $this->
object->settings_obj->update();
121 $this->ctrl->redirect($this,
'settings');
140 if ($rbacsystem->checkAccess(
"visible,read",$this->object->getRefId()))
142 $tabs_gui->addTarget(
"settings",
143 $this->ctrl->getLinkTarget($this,
"settings"), array(
"settings",
"",
"view"),
"",
"");
146 if($rbacsystem->checkAccess(
'read',$this->object->getRefId()))
148 $tabs_gui->addTarget(
'lucene_advanced_settings',
149 $this->ctrl->getLinkTarget($this,
'advancedLuceneSettings'));
152 if($rbacsystem->checkAccess(
'read',$this->object->getRefId()))
154 $tabs_gui->addTarget(
'lucene_settings_tab',
155 $this->ctrl->getLinkTarget($this,
'luceneSettings'));
159 if ($rbacsystem->checkAccess(
'edit_permission',$this->object->getRefId()))
161 $tabs_gui->addTarget(
"perm_settings",
162 $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
"perm"), array(
"perm",
"info",
"owner"),
'ilpermissiongui');
175 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
176 include_once
'./Services/Search/classes/class.ilSearchSettings.php';
181 $this->form->setFormAction($this->ctrl->getFormAction($this,
'updateSettings'));
182 $this->form->addCommandButton(
'updateSettings',$this->lng->txt(
'save'));
183 $this->form->setTitle($this->lng->txt(
'seas_settings'));
187 $hits->
setValue($settings->getMaxHits());
188 $hits->setRequired(
true);
189 for($value = 5; $value <= 15; $value += 5)
191 $values[$value] = $value;
193 $hits->setOptions($values);
194 $hits->setInfo($this->lng->txt(
'seas_max_hits_info'));
195 $this->form->addItem($hits);
201 if($settings->enabledLucene())
205 elseif($settings->enabledIndex())
213 $type->setRequired(
true);
214 $this->form->addItem($type);
219 $operator->setInfo($this->lng->txt(
'lucene_default_operator_info'));
220 $operator->setValue($settings->getDefaultOperator());
223 $operator->addOption($and);
226 $operator->addOption($or);
227 $this->form->addItem($operator);
233 $if->setChecked($settings->isLuceneItemFilterEnabled());
234 $if->setInfo($this->lng->txt(
'search_item_filter_form_info'));
235 $this->form->addItem($if);
237 $filter = $settings->getLuceneItemFilter();
241 if(isset($filter[$obj]) and $filter[$obj])
243 $ch->setChecked(
true);
246 $if->addSubItem($ch);
252 $cb->
setChecked($settings->getHideAdvancedSearch());
253 $this->form->addItem($cb);
262 $si =
new ilSelectInputGUI($lng->txt(
"search_auto_complete_length"),
"auto_complete_length");
263 $si->setOptions($options);
264 $val = ($settings->getAutoCompleteLength() > 0)
265 ? $settings->getAutoCompleteLength()
268 $this->form->addItem(
$si);
272 $type->addOption($direct);
274 if($ilDB->getDBType() ==
'mysql')
277 $type->addOption($index);
281 $type->addOption($lucene);
294 $this->form->checkInput();
296 if(!$ilAccess->checkAccess(
'write',
'',$this->object->getRefId()))
298 $ilErr->raiseError($this->lng->txt(
'permission_denied'),$ilErr->MESSAGE);
301 include_once
'./Services/Search/classes/class.ilSearchSettings.php';
303 $settings->setMaxHits((
int)
$_POST[
'max_hits']);
305 switch((
int) $_POST[
'search_type'])
308 $settings->enableIndex(
false);
309 $settings->enableLucene(
false);
312 $settings->enableIndex(
true);
313 $settings->enableLucene(
false);
316 $settings->enableIndex(
false);
317 $settings->enableLucene(
true);
321 $settings->setDefaultOperator((
int) $_POST[
'operator']);
322 $settings->enableLuceneItemFilter((
int) $_POST[
'if']);
323 $settings->setLuceneItemFilter((array) $_POST[
'filter']);
325 $settings->setHideAdvancedSearch($_POST[
'hide_adv_search']);
326 $settings->setAutoCompleteLength($_POST[
'auto_complete_length']);
344 $this->tabs_gui->setTabActive(
'lucene_settings_tab');
347 $this->tpl->setContent($this->form->getHTML());
357 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
358 include_once
'./Services/Search/classes/class.ilSearchSettings.php';
363 $this->form->setFormAction($this->ctrl->getFormAction($this,
'cancel'));
365 $this->form->setTitle($this->lng->txt(
'lucene_settings_title'));
366 $this->form->addCommandButton(
'saveLuceneSettings',$this->lng->txt(
'save'));
367 $this->form->addCommandButton(
'cancel',$this->lng->txt(
'cancel'));
380 $numFrag =
new ilNumberInputGUI($this->lng->txt(
'lucene_num_fragments'),
'fragmentCount');
382 $numFrag->setSize(2);
383 $numFrag->setMaxLength(2);
384 $numFrag->setMinValue(1);
385 $numFrag->setMaxValue(10);
386 $numFrag->setInfo($this->lng->txt(
'lucene_num_frag_info'));
387 $numFrag->setValue($this->settings->getFragmentCount());
388 $this->form->addItem($numFrag);
390 $sizeFrag =
new ilNumberInputGUI($this->lng->txt(
'lucene_size_fragments'),
'fragmentSize');
392 $sizeFrag->setSize(2);
393 $sizeFrag->setMaxLength(4);
394 $sizeFrag->setMinValue(10);
395 $sizeFrag->setMaxValue(1000);
396 $sizeFrag->setInfo($this->lng->txt(
'lucene_size_frag_info'));
397 $sizeFrag->setValue($this->settings->getFragmentSize());
398 $this->form->addItem($sizeFrag);
400 $maxSub =
new ilNumberInputGUI($this->lng->txt(
'lucene_max_sub'),
'maxSubitems');
403 $maxSub->setMaxLength(2);
404 $maxSub->setMinValue(1);
405 $maxSub->setMaxValue(10);
406 $maxSub->setInfo($this->lng->txt(
'lucene_max_sub_info'));
407 $maxSub->setValue($this->settings->getMaxSubitems());
408 $this->form->addItem($maxSub);
411 $relevance->
setOptionTitle($this->lng->txt(
'lucene_show_relevance'));
412 $relevance->setInfo($this->lng->txt(
'lucene_show_relevance_info'));
413 $relevance->setValue(1);
414 $relevance->setChecked($this->settings->isRelevanceVisible());
415 $this->form->addItem($relevance);
417 $last_index =
new ilDateTimeInputGUI($this->lng->txt(
'lucene_last_index_time'),
'last_index');
419 $last_index->setDate($this->settings->getLastIndexTime());
420 $last_index->setInfo($this->lng->txt(
'lucene_last_index_time_info'));
421 $this->form->addItem($last_index);
437 $settings->setFragmentCount((
int)
$_POST[
'fragmentCount']);
438 $settings->setFragmentSize((
int) $_POST[
'fragmentSize']);
439 $settings->setMaxSubitems((
int) $_POST[
'maxSubitems']);
440 $settings->showRelevance((
int) $_POST[
'relevance']);
441 $settings->enableLuceneOfflineFilter((
int) $_POST[
'offline_filter']);
443 if($this->form->checkInput())
445 $settings->setLastIndexTime($this->form->getItemByPostVar(
'last_index')->getDate());
449 $ilBench->start(
'Lucene',
'LuceneRefreshSettings');
452 include_once
'./Services/WebServices/RPC/classes/class.ilRpcClientFactory.php';
454 CLIENT_ID.
'_'.$ilSetting->get(
'inst_id',0));
462 $ilLog->write(__METHOD__.
': '.$e->getMessage());
477 $this->tabs_gui->setTabActive(
'lucene_advanced_settings');
479 include_once
'./Services/Search/classes/Lucene/class.ilLuceneAdvancedSearchActivationTableGUI.php';
480 include_once
'./Services/Search/classes/Lucene/class.ilLuceneAdvancedSearchSettings.php';
483 $table->setTitle($this->lng->txt(
'lucene_advanced_settings_table'));
486 $this->tpl->setContent($table->getHTML());
491 include_once
'./Services/Search/classes/Lucene/class.ilLuceneAdvancedSearchSettings.php';
496 $settings->setActive($field,in_array($field,(array)
$_POST[
'fid']) ?
true :
false);
511 $this->tabs_gui->addSubTabTarget(
'lucene_general_settings',
512 $this->ctrl->getLinkTarget($this,
'luceneSettings'));