/** * Add filter by standard type * * @param string $id * @param int $type * @param bool $a_optional * @param string $caption * @return object */ function addFilterItemByMetaType($id, $type = self::FILTER_TEXT, $a_optional = false, $caption = NULL) { global $lng; if (!$caption) { $caption = $lng->txt($id); } include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; switch ($type) { case self::FILTER_SELECT: include_once "./Services/Form/classes/class.ilSelectInputGUI.php"; $item = new ilSelectInputGUI($caption, $id); break; case self::FILTER_DATE: include_once "./Services/Form/classes/class.ilDateTimeInputGUI.php"; $item = new ilDateTimeInputGUI($caption, $id); $item->setMode(ilDateTimeInputGUI::MODE_INPUT); break; case self::FILTER_TEXT: include_once "./Services/Form/classes/class.ilTextInputGUI.php"; $item = new ilTextInputGUI($caption, $id); $item->setMaxLength(64); $item->setSize(20); // $item->setSubmitFormOnEnter(true); break; case self::FILTER_LANGUAGE: $lng->loadLanguageModule("meta"); include_once "./Services/Form/classes/class.ilSelectInputGUI.php"; $item = new ilSelectInputGUI($caption, $id); $options = array("" => $lng->txt("trac_all")); foreach ($lng->getInstalledLanguages() as $lang_key) { $options[$lang_key] = $lng->txt("meta_l_" . $lang_key); } $item->setOptions($options); break; case self::FILTER_NUMBER_RANGE: include_once "./Services/Form/classes/class.ilCombinationInputGUI.php"; include_once "./Services/Form/classes/class.ilNumberInputGUI.php"; $item = new ilCombinationInputGUI($caption, $id); $combi_item = new ilNumberInputGUI("", $id . "_from"); $item->addCombinationItem("from", $combi_item, $lng->txt("from")); $combi_item = new ilNumberInputGUI("", $id . "_to"); $item->addCombinationItem("to", $combi_item, $lng->txt("to")); $item->setComparisonMode(ilCombinationInputGUI::COMPARISON_ASCENDING); $item->setMaxLength(7); $item->setSize(20); break; case self::FILTER_DATE_RANGE: include_once "./Services/Form/classes/class.ilCombinationInputGUI.php"; include_once "./Services/Form/classes/class.ilDateTimeInputGUI.php"; $item = new ilCombinationInputGUI($caption, $id); $combi_item = new ilDateTimeInputGUI("", $id . "_from"); $item->addCombinationItem("from", $combi_item, $lng->txt("from")); $combi_item = new ilDateTimeInputGUI("", $id . "_to"); $item->addCombinationItem("to", $combi_item, $lng->txt("to")); $item->setComparisonMode(ilCombinationInputGUI::COMPARISON_ASCENDING); $item->setMode(ilDateTimeInputGUI::MODE_INPUT); break; case self::FILTER_DATETIME_RANGE: include_once "./Services/Form/classes/class.ilCombinationInputGUI.php"; include_once "./Services/Form/classes/class.ilDateTimeInputGUI.php"; $item = new ilCombinationInputGUI($caption, $id); $combi_item = new ilDateTimeInputGUI("", $id . "_from"); $combi_item->setShowTime(true); $item->addCombinationItem("from", $combi_item, $lng->txt("from")); $combi_item = new ilDateTimeInputGUI("", $id . "_to"); $combi_item->setShowTime(true); $item->addCombinationItem("to", $combi_item, $lng->txt("to")); $item->setComparisonMode(ilCombinationInputGUI::COMPARISON_ASCENDING); $item->setMode(ilDateTimeInputGUI::MODE_INPUT); break; case self::FILTER_DURATION_RANGE: $lng->loadLanguageModule("form"); include_once "./Services/Form/classes/class.ilCombinationInputGUI.php"; include_once "./Services/Form/classes/class.ilDurationInputGUI.php"; $item = new ilCombinationInputGUI($caption, $id); $combi_item = new ilDurationInputGUI("", $id . "_from"); $combi_item->setShowMonths(false); $combi_item->setShowDays(true); $combi_item->setShowSeconds(true); $item->addCombinationItem("from", $combi_item, $lng->txt("from")); $combi_item = new ilDurationInputGUI("", $id . "_to"); $combi_item->setShowMonths(false); $combi_item->setShowDays(true); $combi_item->setShowSeconds(true); $item->addCombinationItem("to", $combi_item, $lng->txt("to")); $item->setComparisonMode(ilCombinationInputGUI::COMPARISON_ASCENDING); break; default: return false; } $this->addFilterItem($item, $a_optional); $item->readFromSession(); return $item; }