diff options
Diffstat (limited to 'app/Controller/Search.php')
-rw-r--r-- | app/Controller/Search.php | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/app/Controller/Search.php b/app/Controller/Search.php index 9b9b9e65..a42e9d3d 100644 --- a/app/Controller/Search.php +++ b/app/Controller/Search.php @@ -2,6 +2,8 @@ namespace Kanboard\Controller; +use Kanboard\Filter\TaskProjectsFilter; + /** * Search controller * @@ -23,14 +25,12 @@ class Search extends Base ->setDirection('DESC'); if ($search !== '' && ! empty($projects)) { - $query = $this - ->taskFilter - ->search($search) - ->filterByProjects(array_keys($projects)) - ->getQuery(); - $paginator - ->setQuery($query) + ->setQuery($this->taskLexer + ->build($search) + ->withFilter(new TaskProjectsFilter(array_keys($projects))) + ->getQuery() + ) ->calculate(); $nb_tasks = $paginator->getTotal(); @@ -46,4 +46,22 @@ class Search extends Base 'title' => t('Search tasks').($nb_tasks > 0 ? ' ('.$nb_tasks.')' : '') ))); } + + public function activity() + { + $search = urldecode($this->request->getStringParam('search')); + $events = $this->helper->projectActivity->searchEvents($search); + $nb_events = count($events); + + $this->response->html($this->helper->layout->app('search/activity', array( + 'values' => array( + 'search' => $search, + 'controller' => 'search', + 'action' => 'activity', + ), + 'title' => t('Search in activity stream').($nb_events > 0 ? ' ('.$nb_events.')' : ''), + 'nb_events' => $nb_events, + 'events' => $events, + ))); + } } |