diff options
author | vincent-peugnet <v.peugnet@free.fr> | 2019-08-21 13:45:28 +0200 |
---|---|---|
committer | vincent-peugnet <v.peugnet@free.fr> | 2019-08-21 13:45:28 +0200 |
commit | 73ee4462740c0c7d793bb8e0952e34110dfdb78b (patch) | |
tree | e8410a86c76ce8c36239a27847e8ecfa96eab3ae /app/class/opt.php | |
parent | 63202efc75a63ef30e58c12d602ea95a960a0976 (diff) | |
download | wcms-73ee4462740c0c7d793bb8e0952e34110dfdb78b.tar.gz wcms-73ee4462740c0c7d793bb8e0952e34110dfdb78b.zip |
feature : limit query added
Diffstat (limited to 'app/class/opt.php')
-rw-r--r-- | app/class/opt.php | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/app/class/opt.php b/app/class/opt.php index 39e2ab8..1cfa299 100644 --- a/app/class/opt.php +++ b/app/class/opt.php @@ -14,6 +14,7 @@ class Opt protected $taglist = []; protected $authorlist = []; protected $invert = 0; + protected $limit= 0; protected $artvarlist; @@ -67,7 +68,7 @@ class Opt public function getall() { - $optlist = ['sortby', 'order', 'secure', 'tagcompare', 'tagfilter', 'authorcompare', 'authorfilter', 'invert']; + $optlist = ['sortby', 'order', 'secure', 'tagcompare', 'tagfilter', 'authorcompare', 'authorfilter', 'limit','invert']; foreach ($optlist as $method) { if (method_exists($this, $method)) { @@ -91,11 +92,14 @@ class Opt public function getadress(string $sortby = '') { - if ($this->sortby() === $sortby) { + if ($this->sortby === $sortby) { $order = $this->order * -1; } else { $order = $this->order; } + if(empty($sortby)) { + $sortby = $this->sortby; + } $adress = '?sortby=' . $sortby; $adress .= '&order=' . $order; $adress .= '&secure=' . $this->secure; @@ -110,6 +114,7 @@ class Opt if ($this->invert == 1) { $adress .= '&invert=1'; } + $adress.= '&limit=' .$this->limit; $adress .= '&submit=filter'; return $adress; @@ -213,6 +218,11 @@ class Opt return $this->artvarlist; } + public function limit() + { + return $this->limit; + } + // __________________________________________________ S E T _____________________________________________ @@ -356,6 +366,17 @@ class Opt } } + public function setlimit($limit) + { + $limit = intval($limit); + if($limit < 0) { + $limit = 0; + } elseif ($limit >= 10000) { + $limit = 9999; + } + $this->limit = $limit; + } + public function setartvarlist(array $artvarlist) { |