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");
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 $us =
new ilCheckboxInputGUI($this->lng->txt(
'search_user_search_form'),
'user_search_enabled');
381 $us->
setInfo($this->lng->txt(
'search_user_search_info_form'));
383 $us->setChecked($this->settings->isLuceneUserSearchEnabled());
384 $this->form->addItem($us);
388 $if =
new ilCheckboxInputGUI($this->lng->txt(
'search_mime_filter_form'),
'mime_enabled');
390 $if->setChecked($this->settings->isLuceneMimeFilterEnabled());
391 $if->setInfo($this->lng->txt(
'search_item_filter_form_info'));
392 $this->form->addItem($if);
394 $mimes = $this->settings->getLuceneMimeFilter();
398 if(isset($mimes[$mime]) and $mimes[$mime])
400 $ch->setChecked(
true);
403 $if->addSubItem($ch);
408 $prefix->setInfo($this->lng->txt(
'lucene_prefix_wildcard_info'));
409 $prefix->setChecked($this->settings->isPrefixWildcardQueryEnabled());
410 $this->form->addItem($prefix);
413 $numFrag =
new ilNumberInputGUI($this->lng->txt(
'lucene_num_fragments'),
'fragmentCount');
415 $numFrag->setSize(2);
416 $numFrag->setMaxLength(2);
417 $numFrag->setMinValue(1);
418 $numFrag->setMaxValue(10);
419 $numFrag->setInfo($this->lng->txt(
'lucene_num_frag_info'));
420 $numFrag->setValue($this->settings->getFragmentCount());
421 $this->form->addItem($numFrag);
423 $sizeFrag =
new ilNumberInputGUI($this->lng->txt(
'lucene_size_fragments'),
'fragmentSize');
425 $sizeFrag->setSize(2);
426 $sizeFrag->setMaxLength(4);
427 $sizeFrag->setMinValue(10);
428 $sizeFrag->setMaxValue(1000);
429 $sizeFrag->setInfo($this->lng->txt(
'lucene_size_frag_info'));
430 $sizeFrag->setValue($this->settings->getFragmentSize());
431 $this->form->addItem($sizeFrag);
433 $maxSub =
new ilNumberInputGUI($this->lng->txt(
'lucene_max_sub'),
'maxSubitems');
436 $maxSub->setMaxLength(2);
437 $maxSub->setMinValue(1);
438 $maxSub->setMaxValue(10);
439 $maxSub->setInfo($this->lng->txt(
'lucene_max_sub_info'));
440 $maxSub->setValue($this->settings->getMaxSubitems());
441 $this->form->addItem($maxSub);
444 $relevance->
setOptionTitle($this->lng->txt(
'lucene_show_relevance'));
445 $relevance->setInfo($this->lng->txt(
'lucene_show_relevance_info'));
446 $relevance->setValue(1);
447 $relevance->setChecked($this->settings->isRelevanceVisible());
448 $this->form->addItem($relevance);
452 $subrel->setOptionTitle($this->lng->txt(
'lucene_show_sub_relevance'));
453 $subrel->setValue(1);
454 $subrel->setChecked($this->settings->isSubRelevanceVisible());
455 $relevance->addSubItem($subrel);
458 $last_index =
new ilDateTimeInputGUI($this->lng->txt(
'lucene_last_index_time'),
'last_index');
460 $last_index->setDate($this->settings->getLastIndexTime());
461 $last_index->setInfo($this->lng->txt(
'lucene_last_index_time_info'));
462 $this->form->addItem($last_index);
478 $settings->enableLuceneUserSearch((
int)
$_POST[
'user_search_enabled']);
479 $settings->setFragmentCount((
int) $_POST[
'fragmentCount']);
480 $settings->setFragmentSize((
int) $_POST[
'fragmentSize']);
481 $settings->setMaxSubitems((
int) $_POST[
'maxSubitems']);
482 $settings->showRelevance((
int) $_POST[
'relevance']);
483 $settings->enableLuceneOfflineFilter((
int) $_POST[
'offline_filter']);
484 $settings->enableLuceneMimeFilter((
int) $_POST[
'mime_enabled']);
485 $settings->setLuceneMimeFilter((array) $_POST[
'mime']);
486 $settings->showSubRelevance((
int) $_POST[
'subrelevance']);
487 $settings->enablePrefixWildcardQuery((
int) $_POST[
'prefix']);
489 if($this->form->checkInput())
491 $settings->setLastIndexTime($this->form->getItemByPostVar(
'last_index')->getDate());
495 $ilBench->start(
'Lucene',
'LuceneRefreshSettings');
498 include_once
'./Services/WebServices/RPC/classes/class.ilRpcClientFactory.php';
500 CLIENT_ID.
'_'.$ilSetting->get(
'inst_id',0));
508 $ilLog->write(__METHOD__.
': '.$e->getMessage());
523 $this->tabs_gui->setTabActive(
'lucene_advanced_settings');
525 include_once
'./Services/Search/classes/Lucene/class.ilLuceneAdvancedSearchActivationTableGUI.php';
526 include_once
'./Services/Search/classes/Lucene/class.ilLuceneAdvancedSearchSettings.php';
529 $table->setTitle($this->lng->txt(
'lucene_advanced_settings_table'));
532 $this->tpl->setContent($table->getHTML());
537 include_once
'./Services/Search/classes/Lucene/class.ilLuceneAdvancedSearchSettings.php';
542 $settings->setActive($field,in_array($field,(array)
$_POST[
'fid']) ?
true :
false);
557 $this->tabs_gui->addSubTabTarget(
'lucene_general_settings',
558 $this->ctrl->getLinkTarget($this,
'luceneSettings'));
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
advancedLuceneSettingsObject()
This class represents an option in a radio group.
updateSettingsObject()
Update Settings.
settingsObject()
Show settings public.
static getLuceneItemFilterDefinitions()
Get lucene item filter definitions.
saveLuceneSettingsObject()
Save Lucene settings.
initFormSettings()
Init settings form.
ilObjectGUI($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
Constructor public.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
initFormLuceneSettings()
Show lucene settings form.
luceneSettingsObject()
Lucene settings.
static getLuceneMimeFilterDefinitions()
if(!is_array($argv)) $options
getTabs(&$tabs_gui)
get tabs public
Class ilObjectGUI Basic methods of all Output classes.
Activation of meta data fields.
redirection script todo: (a better solution should control the processing via a xml file) ...
ilObjSearchSettingsGUI($a_data, $a_id, $a_call_by_reference, $a_prepare_output=true)
Constructor public.
prepareOutput()
prepare output
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static factory($a_package)
Create an XML_RPC2 client instance.
static getFields()
Return an array of all meta data fields.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
saveSettingsObject()
Save settings public.
saveAdvancedLuceneSettingsObject()
static getInstance()
Get singelton instance.