diff options
Diffstat (limited to 'app/class/modelart.php')
-rw-r--r-- | app/class/modelart.php | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/app/class/modelart.php b/app/class/modelart.php index 0cb9b1c..45ff3c2 100644 --- a/app/class/modelart.php +++ b/app/class/modelart.php @@ -178,6 +178,29 @@ class Modelart extends Modeldb return $filteredlist; } + public function filterauthorfilter(array $artlist, array $authorchecked, $authorcompare = 'OR') + { + + $filteredlist = []; + foreach ($artlist as $art) { + if (empty($authorchecked)) { + $filteredlist[] = $art->id(); + } else { + $inter = (array_intersect($art->authors('array'), $authorchecked)); + if ($authorcompare == 'OR') { + if (!empty($inter)) { + $filteredlist[] = $art->id(); + } + } elseif ($authorcompare == 'AND') { + if (!array_diff($authorchecked, $art->authors('array'))) { + $filteredlist[] = $art->id(); + } + } + } + } + return $filteredlist; + } + public function filtersecure(array $artlist, $secure) { $filteredlist = []; |