diff --git a/class_Filter.php b/class_Filter.php index 56d58f0..7d85e22 100644 --- a/class_Filter.php +++ b/class_Filter.php @@ -78,6 +78,12 @@ private function compare($value, $operator, $reference) { } else { return (in_array($value, $reference)); } + case "not": + if (is_string($value)) { + return (!in_array(strtolower($value),array_map('strtolower', $reference))); + } else { + return (!in_array($value, $reference)); + } case "le": return ($value <= $reference); case "lt": diff --git a/class_Publikationen.php b/class_Publikationen.php index dbc85f6..40383eb 100644 --- a/class_Publikationen.php +++ b/class_Publikationen.php @@ -329,7 +329,7 @@ public function pubNachTyp($param = array(), $field = '', $content = '', $fsp = } else { foreach ($pubList as $array_type => $publications) { // Zwischenüberschrift (= Publikationstyp), außer wenn nur ein Typ gefiltert wurde - if (empty($type)) { + if (empty($type) || strpos($type, '-') === 0 || strpos($type, ',') !== false) { $title = Tools::getTitle('publications', $array_type, $param['display_language']); if (!shortcode_exists('collapsibles') || $format != 'accordion') { $output .= "
' . __('Falscher Parameter für Publikationstyp', 'fau-cris') . '
'; return $output; } - $filter['publication type__eq'] = $pubTyp; + if (!empty($pubTyp)) { + $filter['publication type__eq'] = $pubTyp; + } elseif (!empty($pubTypExclude)) { + $filter['publication type__not'] = $pubTypExclude; + } } if ($subtype !== '' && $subtype !== NULL) { $subtype = str_replace(' ', '', $subtype); $subtypes = explode(',', $subtype); foreach($subtypes as $v) { - $pubSubTyp[] = self::getType('publications', $v, $pubTyp[0]); + if (strpos($v, '-') === 0) { + $tmpSubType = substr($v, 1); + $pubSubTypExclude[] = self::getType('publications', $tmpSubType, $pubTyp[0]); + } else { + $pubSubTyp[] = self::getType('publications', $v, $pubTyp[0]); + } } - if (empty($pubSubTyp)) { + if (empty($pubSubTyp) && empty($pubSubTypExclude)) { $output = '' . __('Falscher Parameter für Publikationssubtyp', 'fau-cris') . '
'; return $output; } - $filter['subtype__eq'] = $pubSubTyp; + if (!empty($pubSubTyp)) { + $filter['subtype__eq'] = $pubSubTyp; + } elseif (!empty($pubSubTypExclude)) { + $filter['subtype__not'] = $pubSubTypExclude; + } } if ($fau !== '') { if ($fau == 1) {