Index: trunk/core/units/general/helpers/search_helper.php =================================================================== diff -u -N -r7702 -r8067 --- trunk/core/units/general/helpers/search_helper.php (.../search_helper.php) (revision 7702) +++ trunk/core/units/general/helpers/search_helper.php (.../search_helper.php) (revision 8067) @@ -509,9 +509,60 @@ $this->Application->RemovePersistentVar($event->getPrefixSpecial().'_custom_filter.'.$view_name); } - - - + /** + * Creates filters based on "types" & "except" parameters from PrintList + * + * @param kEvent $event + * @param Array $type_clauses + * @param string $types + * @param string $except_types + */ + function SetComplexFilter(&$event, &$type_clauses, $types, $except_types) + { + $includes_or_filter =& $this->Application->makeClass('kMultipleFilter', FLT_TYPE_OR); + $excepts_and_filter =& $this->Application->makeClass('kMultipleFilter', FLT_TYPE_AND); + + $includes_or_filter_h =& $this->Application->makeClass('kMultipleFilter', FLT_TYPE_OR); + $excepts_and_filter_h =& $this->Application->makeClass('kMultipleFilter', FLT_TYPE_AND); + + if ($types) { + $types = explode(',', $types); + foreach ($types as $type) { + $type = trim($type); + + if (isset($type_clauses[$type])) { + if ($type_clauses[$type]['having_filter']) { + $includes_or_filter_h->addFilter('filter_'.$type, $type_clauses[$type]['include']); + } else { + $includes_or_filter->addFilter('filter_'.$type, $type_clauses[$type]['include']); + } + } + } + } + + if ($except_types) { + $except_types = explode(',', $except_types); + foreach ($except_types as $type) { + $type = trim($type); + + if (isset($type_clauses[$type])) { + if ($type_clauses[$type]['having_filter']) { + $excepts_and_filter_h->addFilter('filter_'.$type, $type_clauses[$type]['except']); + } else { + $excepts_and_filter->addFilter('filter_'.$type, $type_clauses[$type]['except']); + } + } + } + } + + $object =& $event->getObject(); + + $object->addFilter('includes_filter', $includes_or_filter); + $object->addFilter('excepts_filter', $excepts_and_filter); + + $object->addFilter('includes_filter_h', $includes_or_filter_h, HAVING_FILTER); + $object->addFilter('excepts_filter_h', $excepts_and_filter_h, HAVING_FILTER); + } } ?> \ No newline at end of file