aboutsummaryrefslogtreecommitdiff
path: root/app/class/modelart.php
diff options
context:
space:
mode:
authorvincent-peugnet <v.peugnet@free.fr>2019-01-30 15:56:04 +0100
committervincent-peugnet <v.peugnet@free.fr>2019-01-30 15:56:04 +0100
commit396a5776cd043e899e4897ec50fc8edc52585512 (patch)
tree51714a3aa981e698f4573f0ce54e22e1dc8338a8 /app/class/modelart.php
parent3309bd722454fa8696ce2415075f401e444c9910 (diff)
downloadwcms-396a5776cd043e899e4897ec50fc8edc52585512.tar.gz
wcms-396a5776cd043e899e4897ec50fc8edc52585512.zip
author filter home
Diffstat (limited to 'app/class/modelart.php')
-rw-r--r--app/class/modelart.php23
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 = [];