4 require_once
"./Services/Object/classes/class.ilObjectGUI.php";
32 public function __construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output =
true)
40 $this->lng->loadLanguageModule(
'search');
45 $next_class = $this->ctrl->getNextClass($this);
46 $cmd = $this->ctrl->getCmd();
49 switch ($next_class) {
50 case 'ilpermissiongui':
51 $this->tabs_gui->setTabActive(
'perm_settings');
52 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
54 $ret = &$this->ctrl->forwardCommand($perm_gui);
58 if ($cmd ==
"" || $cmd ==
"view") {
72 $this->ctrl->redirect($this,
"settings");
81 if (!$this->dic->rbac()->system()->checkAccess(
"visible,read", $this->object->getRefId())) {
82 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
84 $this->tabs_gui->setTabActive(
'settings');
86 $this->tpl->setContent($this->form->getHTML());
96 include_once
'Services/WebServices/RPC/classes/class.ilRPCServerSettings.php';
102 if (!
$rbacsystem->checkAccess(
'write', $this->object->getRefId())) {
103 $this->
ilias->raiseError($this->lng->txt(
"permission_denied"), $this->
ilias->error_obj->MESSAGE);
106 $this->
object->initSettingsObject();
107 $this->
object->settings_obj->setMaxHits((
int)
$_POST[
'max_hits']);
108 $this->
object->settings_obj->enableIndex($_POST[
'search_index']);
109 $this->
object->settings_obj->enableLucene($_POST[
'search_lucene']);
110 $this->
object->settings_obj->setHideAdvancedSearch($_POST[
'hide_adv_search']);
111 $this->
object->settings_obj->setAutoCompleteLength($_POST[
'auto_complete_length']);
112 $this->
object->settings_obj->setDefaultOperator((
int) $_POST[
'operator']);
113 $this->
object->settings_obj->enableLuceneItemFilter((
int) $_POST[
'if']);
114 $this->
object->settings_obj->setLuceneItemFilter((array) $_POST[
'filter']);
118 if ($this->object->settings_obj->enabledLucene() and !$rpc_settings->pingServer()) {
120 $this->ctrl->redirect($this,
'settings');
125 $this->
object->settings_obj->update();
128 $this->ctrl->redirect($this,
'settings');
149 if (
$rbacsystem->checkAccess(
"visible,read", $this->object->getRefId())) {
150 $this->tabs_gui->addTarget(
152 $this->ctrl->getLinkTarget($this,
"settings"),
153 array(
"settings",
"",
"view"),
159 if (
$rbacsystem->checkAccess(
'read', $this->object->getRefId())) {
160 $this->tabs_gui->addTarget(
161 'lucene_advanced_settings',
162 $this->ctrl->getLinkTarget($this,
'advancedLuceneSettings')
166 if (
$rbacsystem->checkAccess(
'read', $this->object->getRefId())) {
167 $this->tabs_gui->addTarget(
168 'lucene_settings_tab',
169 $this->ctrl->getLinkTarget($this,
'luceneSettings')
174 if (
$rbacsystem->checkAccess(
'edit_permission', $this->object->getRefId())) {
175 $this->tabs_gui->addTarget(
177 $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
"perm"),
178 array(
"perm",
"info",
"owner"),
193 $ilDB = $DIC[
'ilDB'];
197 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
198 include_once
'./Services/Search/classes/class.ilSearchSettings.php';
203 $this->form->setFormAction($this->ctrl->getFormAction($this,
'updateSettings'));
205 if (
$access->checkAccess(
'write',
'', $this->object->getRefId())) {
206 $this->form->addCommandButton(
'updateSettings', $this->lng->txt(
'save'));
208 $this->form->setTitle($this->lng->txt(
'seas_settings'));
212 $hits->setValue(
$settings->getMaxHits());
213 $hits->setRequired(
true);
214 for ($value = 5; $value <= 50; $value += 5) {
215 $values[$value] = $value;
217 $hits->setOptions($values);
218 $hits->setInfo($this->lng->txt(
'seas_max_hits_info'));
219 $this->form->addItem($hits);
232 $type->setRequired(
true);
233 $this->form->addItem(
$type);
238 $operator->setInfo($this->lng->txt(
'lucene_default_operator_info'));
239 $operator->setValue(
$settings->getDefaultOperator());
242 $operator->addOption($and);
245 $operator->addOption($or);
246 $this->form->addItem($operator);
249 $us =
new ilCheckboxInputGUI($this->lng->txt(
'search_user_search_form'),
'user_search_enabled');
250 $us->
setInfo($this->lng->txt(
'search_user_search_info_form'));
252 $us->setChecked(
$settings->isLuceneUserSearchEnabled());
253 $this->form->addItem($us);
259 $if->setChecked(
$settings->isLuceneItemFilterEnabled());
260 $if->setInfo($this->lng->txt(
'search_item_filter_form_info'));
261 $this->form->addItem($if);
263 $filter =
$settings->getLuceneItemFilter();
266 if (isset($filter[$obj]) and $filter[$obj]) {
270 $if->addSubItem($ch);
274 $cdate->
setInfo($this->lng->txt(
'search_cdate_filter_info'));
275 $cdate->setChecked(
$settings->isDateFilterEnabled());
277 $this->form->addItem($cdate);
282 $this->form->addItem($cb);
287 $type->addOption($direct);
289 if (
$ilDB->supportsFulltext()) {
295 $type->addOption($lucene);
306 $si->setOptions($options);
307 $val = (
$settings->getAutoCompleteLength() > 0)
311 $this->form->addItem(
$si);
313 $inactive_user =
new ilCheckboxInputGUI($this->lng->txt(
'search_show_inactive_user'),
'inactive_user');
314 $inactive_user->
setInfo($this->lng->txt(
'search_show_inactive_user_info'));
315 $inactive_user->setChecked(
$settings->isInactiveUserVisible());
316 $this->form->addItem($inactive_user);
318 $limited_user =
new ilCheckboxInputGUI($this->lng->txt(
'search_show_limited_user'),
'limited_user');
319 $limited_user->
setInfo($this->lng->txt(
'search_show_limited_user_info'));
320 $limited_user->setChecked(
$settings->isLimitedUserVisible());
321 $this->form->addItem($limited_user);
333 $ilAccess = $DIC[
'ilAccess'];
336 $this->form->checkInput();
338 if (!$ilAccess->checkAccess(
'write',
'', $this->object->getRefId())) {
340 $GLOBALS[
'DIC']->ctrl()->redirect($this,
'settings');
343 include_once
'./Services/Search/classes/class.ilSearchSettings.php';
347 switch ((
int) $_POST[
'search_type']) {
362 $settings->setDefaultOperator((
int) $_POST[
'operator']);
363 $settings->enableLuceneItemFilter((
int) $_POST[
'if']);
364 $settings->setLuceneItemFilter((array) $_POST[
'filter']);
366 $settings->setHideAdvancedSearch($_POST[
'hide_adv_search']);
367 $settings->setAutoCompleteLength($_POST[
'auto_complete_length']);
368 $settings->showInactiveUser($_POST[
"inactive_user"]);
369 $settings->showLimitedUser($_POST[
"limited_user"]);
370 $settings->enableDateFilter($_POST[
'cdate']);
371 $settings->enableLuceneUserSearch((
int) $_POST[
'user_search_enabled']);
398 $this->tabs_gui->setTabActive(
'lucene_settings_tab');
403 $this->tpl->setContent($this->form->getHTML());
413 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
414 include_once
'./Services/Search/classes/class.ilSearchSettings.php';
419 $this->form->setFormAction($this->ctrl->getFormAction($this,
'cancel'));
421 $this->form->setTitle($this->lng->txt(
'lucene_settings_title'));
424 if (
$access->checkAccess(
'write',
'', $this->object->getRefId())) {
425 $this->form->addCommandButton(
'saveLuceneSettings', $this->lng->txt(
'save'));
431 $if =
new ilCheckboxInputGUI($this->lng->txt(
'search_mime_filter_form'),
'mime_enabled');
433 $if->setChecked($this->
settings->isLuceneMimeFilterEnabled());
434 $if->setInfo($this->lng->txt(
'search_mime_filter_form_info'));
435 $this->form->addItem($if);
437 $mimes = $this->
settings->getLuceneMimeFilter();
440 if (isset($mimes[$mime]) and $mimes[$mime]) {
444 $if->addSubItem($ch);
447 $prefix =
new ilCheckboxInputGUI($this->lng->txt(
'lucene_prefix_wildcard'),
'prefix');
449 $prefix->setInfo($this->lng->txt(
'lucene_prefix_wildcard_info'));
450 $prefix->setChecked($this->
settings->isPrefixWildcardQueryEnabled());
451 $this->form->addItem($prefix);
454 $numFrag =
new ilNumberInputGUI($this->lng->txt(
'lucene_num_fragments'),
'fragmentCount');
456 $numFrag->setSize(2);
457 $numFrag->setMaxLength(2);
458 $numFrag->setMinValue(1);
459 $numFrag->setMaxValue(10);
460 $numFrag->setInfo($this->lng->txt(
'lucene_num_frag_info'));
461 $numFrag->setValue($this->
settings->getFragmentCount());
462 $this->form->addItem($numFrag);
464 $sizeFrag =
new ilNumberInputGUI($this->lng->txt(
'lucene_size_fragments'),
'fragmentSize');
466 $sizeFrag->setSize(2);
467 $sizeFrag->setMaxLength(4);
468 $sizeFrag->setMinValue(10);
469 $sizeFrag->setMaxValue(1000);
470 $sizeFrag->setInfo($this->lng->txt(
'lucene_size_frag_info'));
471 $sizeFrag->setValue($this->
settings->getFragmentSize());
472 $this->form->addItem($sizeFrag);
474 $maxSub =
new ilNumberInputGUI($this->lng->txt(
'lucene_max_sub'),
'maxSubitems');
477 $maxSub->setMaxLength(2);
478 $maxSub->setMinValue(1);
479 $maxSub->setMaxValue(10);
480 $maxSub->setInfo($this->lng->txt(
'lucene_max_sub_info'));
481 $maxSub->setValue($this->
settings->getMaxSubitems());
482 $this->form->addItem($maxSub);
484 $relevance =
new ilCheckboxInputGUI($this->lng->txt(
'lucene_relevance'),
'relevance');
485 $relevance->
setOptionTitle($this->lng->txt(
'lucene_show_relevance'));
486 $relevance->setInfo($this->lng->txt(
'lucene_show_relevance_info'));
487 $relevance->setValue(1);
488 $relevance->setChecked($this->
settings->isRelevanceVisible());
489 $this->form->addItem($relevance);
493 $subrel->setOptionTitle($this->lng->txt(
'lucene_show_sub_relevance'));
494 $subrel->setValue(1);
495 $subrel->setChecked($this->
settings->isSubRelevanceVisible());
496 $relevance->addSubItem($subrel);
499 $last_index =
new ilDateTimeInputGUI($this->lng->txt(
'lucene_last_index_time'),
'last_index');
501 $last_index->setShowTime(
true);
502 $last_index->setDate($this->
settings->getLastIndexTime());
503 $last_index->setInfo($this->lng->txt(
'lucene_last_index_time_info'));
504 $this->form->addItem($last_index);
518 $ilLog = $DIC[
'ilLog'];
525 $settings->setFragmentSize((
int) $_POST[
'fragmentSize']);
526 $settings->setMaxSubitems((
int) $_POST[
'maxSubitems']);
527 $settings->showRelevance((
int) $_POST[
'relevance']);
528 $settings->enableLuceneOfflineFilter((
int) $_POST[
'offline_filter']);
529 $settings->enableLuceneMimeFilter((
int) $_POST[
'mime_enabled']);
530 $settings->setLuceneMimeFilter((array) $_POST[
'mime']);
531 $settings->showSubRelevance((
int) $_POST[
'subrelevance']);
532 $settings->enablePrefixWildcardQuery((
int) $_POST[
'prefix']);
534 if ($this->form->checkInput()) {
535 $settings->setLastIndexTime($this->form->getItemByPostVar(
'last_index')->getDate());
552 $this->form->setValuesByPost();
572 include_once
'./Services/WebServices/RPC/classes/class.ilRpcClientFactory.php';
575 ilLoggerFactory::getLogger(
'src')->error(
'Refresh of lucene server settings failed with message: ' . $exception->getMessage());
586 $this->tabs_gui->setTabActive(
'lucene_advanced_settings');
588 include_once
'./Services/Search/classes/Lucene/class.ilLuceneAdvancedSearchActivationTableGUI.php';
589 include_once
'./Services/Search/classes/Lucene/class.ilLuceneAdvancedSearchSettings.php';
592 $table->setTitle($this->lng->txt(
'lucene_advanced_settings_table'));
595 $this->tpl->setContent($table->getHTML());
605 if (!
$access->checkAccess(
'write',
'', $this->object->getRefId())) {
607 $GLOBALS[
'DIC']->ctrl()->redirect($this,
'settings');
613 $settings->setActive($field, in_array($field, (array)
$_POST[
'fid']) ?
true :
false);
625 switch ($a_section) {
627 $this->tabs_gui->addSubTabTarget(
628 'lucene_general_settings',
629 $this->ctrl->getLinkTarget($this,
'luceneSettings')
advancedLuceneSettingsObject()
show advanced settings
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.
static factory($a_package, $a_timeout=0)
Creates an ilRpcClient instance to our ilServer.
initFormSettings()
Init settings form.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
initFormLuceneSettings()
Show lucene settings form.
prepareOutput($a_show_subobjects=true)
prepare output
static getLuceneMimeFilterDefinitions()
Class ilObjectGUI Basic methods of all Output classes.
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Activation of meta data fields.
redirection script todo: (a better solution should control the processing via a xml file) ...
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output=true)
Constructor public.
luceneSettingsObject(ilPropertyFormGUI $form=null)
Lucene settings.
__construct(Container $dic, ilPlugin $plugin)
static getFields()
Return an array of all meta data fields.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
static getLogger($a_component_id)
Get component logger.
refreshLuceneSettings()
Refresh lucene server settings.
saveSettingsObject()
Save settings public.
saveAdvancedLuceneSettingsObject()
Save advanced settings.
static getInstance()
Get singelton instance.