summaryrefslogtreecommitdiff
path: root/app/Controller
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2017-11-16 14:53:05 -0800
committerFrederic Guillot <fred@kanboard.net>2017-11-16 14:53:05 -0800
commit2eeca3db3a32a536dc8eaf210329e07f3ae95554 (patch)
treee3311859e68b22b302a3aa435217532e26eaf804 /app/Controller
parentbda7f38cebf6142379b820fdb3eab120f18c94dc (diff)
Add projects search
Diffstat (limited to 'app/Controller')
-rw-r--r--app/Controller/GroupListController.php2
-rw-r--r--app/Controller/ProjectListController.php10
2 files changed, 10 insertions, 2 deletions
diff --git a/app/Controller/GroupListController.php b/app/Controller/GroupListController.php
index 9663638d..f56e63a4 100644
--- a/app/Controller/GroupListController.php
+++ b/app/Controller/GroupListController.php
@@ -24,7 +24,7 @@ class GroupListController extends BaseController
$query = $this->groupModel->getQuery();
if ($search !== '') {
- $query->ilike('name', '%'.$search.'%');
+ $query->ilike('groups.name', '%'.$search.'%');
}
$paginator = $this->paginator
diff --git a/app/Controller/ProjectListController.php b/app/Controller/ProjectListController.php
index 95ff5d91..88dac4f8 100644
--- a/app/Controller/ProjectListController.php
+++ b/app/Controller/ProjectListController.php
@@ -23,16 +23,24 @@ class ProjectListController extends BaseController
$projectIds = $this->projectPermissionModel->getProjectIds($this->userSession->getId());
}
+ $query = $this->projectModel->getQueryByProjectIds($projectIds);
+ $search = $this->request->getStringParam('search');
+
+ if ($search !== '') {
+ $query->ilike('projects.name', '%' . $search . '%');
+ }
+
$paginator = $this->paginator
->setUrl('ProjectListController', 'show')
->setMax(20)
->setOrder('name')
- ->setQuery($this->projectModel->getQueryByProjectIds($projectIds))
+ ->setQuery($query)
->calculate();
$this->response->html($this->helper->layout->app('project_list/listing', array(
'paginator' => $paginator,
'title' => t('Projects') . ' (' . $paginator->getTotal() . ')',
+ 'values' => array('search' => $search),
)));
}
}