blob: 08dda1c856ea5a17ae3aa452f4dbf2b2c277c95c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
<?php
namespace Kanboard\Controller;
/**
* Search controller
*
* @package controller
* @author Frederic Guillot
*/
class Search extends Base
{
public function index()
{
$projects = $this->projectPermission->getAllowedProjects($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 !== '') {
$query = $this
->taskFilter
->search($search)
->filterByProjects(array_keys($projects))
->getQuery();
$paginator
->setQuery($query)
->calculate();
$nb_tasks = $paginator->getTotal();
}
$this->response->html($this->template->layout('search/index', array(
'board_selector' => $projects,
'values' => array(
'search' => $search,
'controller' => 'search',
'action' => 'index',
),
'paginator' => $paginator,
'title' => t('Search tasks').($nb_tasks > 0 ? ' ('.$nb_tasks.')' : '')
)));
}
}
|