コード例 #1
0
 /**
  * Show lucene settings form 
  * @param
  * @return
  */
 protected function initFormLuceneSettings()
 {
     include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
     include_once './Services/Search/classes/class.ilSearchSettings.php';
     $this->settings = ilSearchSettings::getInstance();
     $this->form = new ilPropertyFormGUI();
     $this->form->setFormAction($this->ctrl->getFormAction($this, 'cancel'));
     $this->form->setTitle($this->lng->txt('lucene_settings_title'));
     $this->form->addCommandButton('saveLuceneSettings', $this->lng->txt('save'));
     $this->form->addCommandButton('cancel', $this->lng->txt('cancel'));
     // Offline filter
     /*
     		$offline = new ilCheckboxInputGUI($this->lng->txt('lucene_offline_filter_setting'),'offline_filter');
     		$offline->setInfo($this->lng->txt('lucene_offline_filter_setting_info'));
     		$offline->setValue(1);
     		$offline->setChecked($this->settings->isLuceneOfflineFilterEnabled());
     		$this->form->addItem($offline);
     */
     // user search
     $us = new ilCheckboxInputGUI($this->lng->txt('search_user_search_form'), 'user_search_enabled');
     $us->setInfo($this->lng->txt('search_user_search_info_form'));
     $us->setValue(1);
     $us->setChecked($this->settings->isLuceneUserSearchEnabled());
     $this->form->addItem($us);
     // Item filter
     $if = new ilCheckboxInputGUI($this->lng->txt('search_mime_filter_form'), 'mime_enabled');
     $if->setValue(1);
     $if->setChecked($this->settings->isLuceneMimeFilterEnabled());
     $if->setInfo($this->lng->txt('search_item_filter_form_info'));
     $this->form->addItem($if);
     $mimes = $this->settings->getLuceneMimeFilter();
     foreach (ilSearchSettings::getLuceneMimeFilterDefinitions() as $mime => $def) {
         $ch = new ilCheckboxInputGUI($this->lng->txt($def['trans']), 'mime[' . $mime . ']');
         if (isset($mimes[$mime]) and $mimes[$mime]) {
             $ch->setChecked(true);
         }
         $ch->setValue(1);
         $if->addSubItem($ch);
     }
     $prefix = new ilCheckboxInputGUI($this->lng->txt('lucene_prefix_wildcard'), 'prefix');
     $prefix->setValue(1);
     $prefix->setInfo($this->lng->txt('lucene_prefix_wildcard_info'));
     $prefix->setChecked($this->settings->isPrefixWildcardQueryEnabled());
     $this->form->addItem($prefix);
     $numFrag = new ilNumberInputGUI($this->lng->txt('lucene_num_fragments'), 'fragmentCount');
     $numFrag->setRequired(true);
     $numFrag->setSize(2);
     $numFrag->setMaxLength(2);
     $numFrag->setMinValue(1);
     $numFrag->setMaxValue(10);
     $numFrag->setInfo($this->lng->txt('lucene_num_frag_info'));
     $numFrag->setValue($this->settings->getFragmentCount());
     $this->form->addItem($numFrag);
     $sizeFrag = new ilNumberInputGUI($this->lng->txt('lucene_size_fragments'), 'fragmentSize');
     $sizeFrag->setRequired(true);
     $sizeFrag->setSize(2);
     $sizeFrag->setMaxLength(4);
     $sizeFrag->setMinValue(10);
     $sizeFrag->setMaxValue(1000);
     $sizeFrag->setInfo($this->lng->txt('lucene_size_frag_info'));
     $sizeFrag->setValue($this->settings->getFragmentSize());
     $this->form->addItem($sizeFrag);
     $maxSub = new ilNumberInputGUI($this->lng->txt('lucene_max_sub'), 'maxSubitems');
     $maxSub->setRequired(true);
     $maxSub->setSize(2);
     $maxSub->setMaxLength(2);
     $maxSub->setMinValue(1);
     $maxSub->setMaxValue(10);
     $maxSub->setInfo($this->lng->txt('lucene_max_sub_info'));
     $maxSub->setValue($this->settings->getMaxSubitems());
     $this->form->addItem($maxSub);
     $relevance = new ilCheckboxInputGUI($this->lng->txt('lucene_relevance'), 'relevance');
     $relevance->setOptionTitle($this->lng->txt('lucene_show_relevance'));
     $relevance->setInfo($this->lng->txt('lucene_show_relevance_info'));
     $relevance->setValue(1);
     $relevance->setChecked($this->settings->isRelevanceVisible());
     $this->form->addItem($relevance);
     // begin-patch mime_filter
     $subrel = new ilCheckboxInputGUI('', 'subrelevance');
     $subrel->setOptionTitle($this->lng->txt('lucene_show_sub_relevance'));
     $subrel->setValue(1);
     $subrel->setChecked($this->settings->isSubRelevanceVisible());
     $relevance->addSubItem($subrel);
     // end-patch mime_filter
     $last_index = new ilDateTimeInputGUI($this->lng->txt('lucene_last_index_time'), 'last_index');
     $last_index->setShowTime(true);
     $last_index->setDate($this->settings->getLastIndexTime());
     $last_index->setInfo($this->lng->txt('lucene_last_index_time_info'));
     $this->form->addItem($last_index);
     return true;
 }