From 73ee4462740c0c7d793bb8e0952e34110dfdb78b Mon Sep 17 00:00:00 2001 From: vincent-peugnet Date: Wed, 21 Aug 2019 13:45:28 +0200 Subject: feature : limit query added --- app/class/modelhome.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'app/class/modelhome.php') diff --git a/app/class/modelhome.php b/app/class/modelhome.php index 3347edf..c30da44 100644 --- a/app/class/modelhome.php +++ b/app/class/modelhome.php @@ -38,14 +38,17 @@ class Modelhome extends Modelart + /** + * @param array $table + * @param Opt $opt + */ public function table2($table, $opt) { - $listmanager = new Modelart; - $filtertagfilter = $listmanager->filtertagfilter($table, $opt->tagfilter(), $opt->tagcompare()); - $filterauthorfilter = $listmanager->filterauthorfilter($table, $opt->authorfilter(), $opt->authorcompare()); - $filtersecure = $listmanager->filtersecure($table, $opt->secure()); + $filtertagfilter = $this->filtertagfilter($table, $opt->tagfilter(), $opt->tagcompare()); + $filterauthorfilter = $this->filterauthorfilter($table, $opt->authorfilter(), $opt->authorcompare()); + $filtersecure = $this->filtersecure($table, $opt->secure()); $filter = array_intersect($filtertagfilter, $filtersecure, $filterauthorfilter); $table2 = []; @@ -64,7 +67,11 @@ class Modelhome extends Modelart $table2 = $table2invert; } - $listmanager->artlistsort($table2, $opt->sortby(), $opt->order()); + $this->artlistsort($table2, $opt->sortby(), $opt->order()); + + if($opt->limit() !== 0) { + $table2 = array_slice($table2, 0, $opt->limit()); + } return $table2; -- cgit v1.2.3