/** * Init standard search form. */ public function initStandardSearchForm($a_mode) { global $lng, $ilCtrl; include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form = new ilPropertyFormGUI(); $this->form->setOpenTag(false); $this->form->setCloseTag(false); // term combination $radg = new ilHiddenInputGUI('search_term_combination'); $radg->setValue(ilSearchSettings::getInstance()->getDefaultOperator()); $this->form->addItem($radg); if (ilSearchSettings::getInstance()->isLuceneItemFilterEnabled()) { if ($a_mode == self::SEARCH_FORM_STANDARD) { // search type $radg = new ilRadioGroupInputGUI($lng->txt("search_type"), "type"); $radg->setValue($this->getType() == ilSearchBaseGUI::SEARCH_FAST ? ilSearchBaseGUI::SEARCH_FAST : ilSearchBaseGUI::SEARCH_DETAILS); $op1 = new ilRadioOption($lng->txt("search_fast_info"), ilSearchBaseGUI::SEARCH_FAST); $radg->addOption($op1); $op2 = new ilRadioOption($lng->txt("search_details_info"), ilSearchBaseGUI::SEARCH_DETAILS); } else { $op2 = new ilCheckboxInputGUI($this->lng->txt('search_filter_by_type'), 'item_filter_enabled'); $op2->setValue(1); // $op2->setChecked($this->getType() == ilSearchBaseGUI::SEARCH_DETAILS); } $cbgr = new ilCheckboxGroupInputGUI('', 'filter_type'); $cbgr->setUseValuesAsKeys(true); $details = $this->getDetails(); $det = false; foreach (ilSearchSettings::getInstance()->getEnabledLuceneItemFilterDefinitions() as $type => $data) { $cb = new ilCheckboxOption($lng->txt($data['trans']), $type); if ($details[$type]) { $det = true; } $cbgr->addOption($cb); } if ($a_mode == self::SEARCH_FORM_LUCENE) { if (ilSearchSettings::getInstance()->isLuceneMimeFilterEnabled()) { $mimes = $this->getMimeDetails(); foreach (ilSearchSettings::getInstance()->getEnabledLuceneMimeFilterDefinitions() as $type => $data) { $op3 = new ilCheckboxOption($this->lng->txt($data['trans']), $type); if ($mimes[$type]) { $det = true; } $cbgr->addOption($op3); } } } $cbgr->setValue(array_merge((array) $details, (array) $mimes)); $op2->addSubItem($cbgr); if ($a_mode != self::SEARCH_FORM_STANDARD && $det) { $op2->setChecked(true); } if ($a_mode == ilSearchBaseGUI::SEARCH_FORM_STANDARD) { $radg->addOption($op2); $this->form->addItem($radg); } else { $this->form->addItem($op2); } } $this->form->setFormAction($ilCtrl->getFormAction($this, 'performSearch')); }
/** * Init standard search form. */ public function initStandardSearchForm($a_mode) { global $lng, $ilCtrl; include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form = new ilPropertyFormGUI(); $this->form->setOpenTag(false); $this->form->setCloseTag(false); // term combination $radg = new ilHiddenInputGUI('search_term_combination'); $radg->setValue(ilSearchSettings::getInstance()->getDefaultOperator()); $this->form->addItem($radg); /** $radg = new ilRadioGroupInputGUI($lng->txt("search_term_combination"), "combination"); $radg->setValue(($this->getCombination() == ilSearchBaseGUI::SEARCH_AND) ? "and" : "or"); $op1 = new ilRadioOption($lng->txt("search_any_word"), "or"); $radg->addOption($op1); $op2 = new ilRadioOption($lng->txt("search_all_words"), "and"); $radg->addOption($op2); */ // search area /* include_once("./Services/Form/classes/class.ilRepositorySelectorInputGUI.php"); $ti = new ilRepositorySelectorInputGUI($lng->txt("search_area"), "area"); $ti->setSelectText($lng->txt("search_select_search_area")); $this->form->addItem($ti); $ti->readFromSession();*/ // alex, 15.8.2012: Added the following lines to get the value // from the main menu top right input search form /* if (isset($_POST["root_id"])) { $ti->setValue($_POST["root_id"]); $ti->writeToSession(); }*/ if (ilSearchSettings::getInstance()->isLuceneItemFilterEnabled()) { if ($a_mode == self::SEARCH_FORM_STANDARD) { // search type $radg = new ilRadioGroupInputGUI($lng->txt("search_type"), "type"); $radg->setValue($this->getType() == ilSearchBaseGUI::SEARCH_FAST ? ilSearchBaseGUI::SEARCH_FAST : ilSearchBaseGUI::SEARCH_DETAILS); $op1 = new ilRadioOption($lng->txt("search_fast_info"), ilSearchBaseGUI::SEARCH_FAST); $radg->addOption($op1); $op2 = new ilRadioOption($lng->txt("search_details_info"), ilSearchBaseGUI::SEARCH_DETAILS); } else { $op2 = new ilCheckboxInputGUI($this->lng->txt('search_filter_by_type'), 'item_filter_enabled'); $op2->setValue(1); // $op2->setChecked($this->getType() == ilSearchBaseGUI::SEARCH_DETAILS); } $cbgr = new ilCheckboxGroupInputGUI('', 'filter_type'); $cbgr->setUseValuesAsKeys(true); $details = $this->getDetails(); $det = false; foreach (ilSearchSettings::getInstance()->getEnabledLuceneItemFilterDefinitions() as $type => $data) { $cb = new ilCheckboxOption($lng->txt($data['trans']), $type); if ($details[$type]) { $det = true; } $cbgr->addOption($cb); } $cbgr->setValue($details); $op2->addSubItem($cbgr); if ($a_mode != self::SEARCH_FORM_STANDARD && $det) { $op2->setChecked(true); } if ($a_mode == ilSearchBaseGUI::SEARCH_FORM_STANDARD) { $radg->addOption($op2); $this->form->addItem($radg); } else { $this->form->addItem($op2); } } $this->form->setFormAction($ilCtrl->getFormAction($this, 'performSearch')); }