blob: 88dac4f873d0df348fa0e716ef86f9892393c132 (
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
|
<?php
namespace Kanboard\Controller;
/**
* Class ProjectListController
*
* @package Kanboard\Controller
* @author Frederic Guillot
*/
class ProjectListController extends BaseController
{
/**
* List of projects
*
* @access public
*/
public function show()
{
if ($this->userSession->isAdmin()) {
$projectIds = $this->projectModel->getAllIds();
} else {
$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($query)
->calculate();
$this->response->html($this->helper->layout->app('project_list/listing', array(
'paginator' => $paginator,
'title' => t('Projects') . ' (' . $paginator->getTotal() . ')',
'values' => array('search' => $search),
)));
}
}
|