summaryrefslogtreecommitdiffstats
path: root/controller
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2015-03-20 20:00:29 +0100
committerBernhard Posselt <dev@bernhard-posselt.com>2015-03-21 13:36:50 +0100
commit4dfafc5910baec90c9bc58aa61c1103dd41f13fe (patch)
tree34f9ffbcf2a8a8cbd792d5cb38ef4bb4ded39bbc /controller
parentc0dda27f2078de4c3adcf345383ba423c233fe9f (diff)
add a search parameter to the find all queries
Diffstat (limited to 'controller')
-rw-r--r--controller/itemcontroller.php13
1 files changed, 11 insertions, 2 deletions
diff --git a/controller/itemcontroller.php b/controller/itemcontroller.php
index bf63bc0b8..072ab93a7 100644
--- a/controller/itemcontroller.php
+++ b/controller/itemcontroller.php
@@ -56,10 +56,11 @@ class ItemController extends Controller {
* @param int $offset
* @param bool $showAll
* @param bool $oldestFirst
+ * @param string $search
* @return array
*/
public function index($type, $id, $limit=50, $offset=0, $showAll=null,
- $oldestFirst=null) {
+ $oldestFirst=null, $search='') {
// in case this is called directly and not from the website use the
// internal state
@@ -82,6 +83,14 @@ class ItemController extends Controller {
$params = [];
+ // split search parameter on url space
+ $search = urldecode($search);
+ if (trim($search) === '') {
+ $search = [];
+ } else {
+ $search = explode(' ', $search);
+ }
+
try {
// the offset is 0 if the user clicks on a new feed
@@ -97,7 +106,7 @@ class ItemController extends Controller {
$params['items'] = $this->itemService->findAll(
$id, $type, $limit, $offset, $showAll, $oldestFirst,
- $this->userId
+ $this->userId, $search
);
// this gets thrown if there are no items