summaryrefslogtreecommitdiff
path: root/app/Controller/UserListController.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/Controller/UserListController.php')
-rw-r--r--app/Controller/UserListController.php33
1 files changed, 33 insertions, 0 deletions
diff --git a/app/Controller/UserListController.php b/app/Controller/UserListController.php
index 6096923a..580c853c 100644
--- a/app/Controller/UserListController.php
+++ b/app/Controller/UserListController.php
@@ -2,6 +2,8 @@
namespace Kanboard\Controller;
+use Kanboard\Filter\UserNameFilter;
+
/**
* Class User List Controller
*
@@ -24,4 +26,35 @@ class UserListController extends BaseController
'paginator' => $paginator,
)));
}
+
+ /**
+ * Search in users
+ *
+ * @access public
+ */
+ public function search()
+ {
+ $search = urldecode($this->request->getStringParam('search'));
+ $paginator = $this->userPagination->getListingPaginator();
+
+ if ($search !== '' && ! $paginator->isEmpty()) {
+
+ $paginator = $paginator
+ ->setUrl('UserListController', 'search', array('search' => $search))
+ ->setQuery($this->userQuery
+ ->withFilter(new UserNameFilter($search))
+ ->getQuery()
+ )
+ ->calculate();
+ }
+
+ $this->response->html($this->helper->layout->app('user_list/listing', array(
+ 'title' => t('Users').' ('.$paginator->getTotal().')',
+ 'values' => array(
+ 'search' => $search,
+ ),
+ 'paginator' => $paginator
+ )));
+ }
+
}