summaryrefslogtreecommitdiff
path: root/app/Controller/Search.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-05-28 11:31:54 -0400
committerFrederic Guillot <fred@kanboard.net>2016-05-28 11:31:54 -0400
commitab48a09f0d674b703467975b376c5ac7352670ae (patch)
tree99fbb0cf719acee8c500622d498bd7f6375b62a1 /app/Controller/Search.php
parent82b5b491bec94cb3d40a5820fbef9959435309be (diff)
Rename controllers
Diffstat (limited to 'app/Controller/Search.php')
-rw-r--r--app/Controller/Search.php67
1 files changed, 0 insertions, 67 deletions
diff --git a/app/Controller/Search.php b/app/Controller/Search.php
deleted file mode 100644
index a092cba6..00000000
--- a/app/Controller/Search.php
+++ /dev/null
@@ -1,67 +0,0 @@
-<?php
-
-namespace Kanboard\Controller;
-
-use Kanboard\Filter\TaskProjectsFilter;
-
-/**
- * Search controller
- *
- * @package controller
- * @author Frederic Guillot
- */
-class Search extends BaseController
-{
- public function index()
- {
- $projects = $this->projectUserRole->getProjectsByUser($this->userSession->getId());
- $search = urldecode($this->request->getStringParam('search'));
- $nb_tasks = 0;
-
- $paginator = $this->paginator
- ->setUrl('search', 'index', array('search' => $search))
- ->setMax(30)
- ->setOrder('tasks.id')
- ->setDirection('DESC');
-
- if ($search !== '' && ! empty($projects)) {
- $paginator
- ->setQuery($this->taskLexer
- ->build($search)
- ->withFilter(new TaskProjectsFilter(array_keys($projects)))
- ->getQuery()
- )
- ->calculate();
-
- $nb_tasks = $paginator->getTotal();
- }
-
- $this->response->html($this->helper->layout->app('search/index', array(
- 'values' => array(
- 'search' => $search,
- 'controller' => 'search',
- 'action' => 'index',
- ),
- 'paginator' => $paginator,
- '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,
- )));
- }
-}