diff options
Diffstat (limited to 'app/Controller/ProjectListController.php')
-rw-r--r-- | app/Controller/ProjectListController.php | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/app/Controller/ProjectListController.php b/app/Controller/ProjectListController.php new file mode 100644 index 00000000..5571b3c9 --- /dev/null +++ b/app/Controller/ProjectListController.php @@ -0,0 +1,41 @@ +<?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()) { + $project_ids = $this->project->getAllIds(); + } else { + $project_ids = $this->projectPermission->getActiveProjectIds($this->userSession->getId()); + } + + $nb_projects = count($project_ids); + + $paginator = $this->paginator + ->setUrl('ProjectListController', 'show') + ->setMax(20) + ->setOrder('name') + ->setQuery($this->project->getQueryColumnStats($project_ids)) + ->calculate(); + + $this->response->html($this->helper->layout->app('project_list/show', array( + 'paginator' => $paginator, + 'nb_projects' => $nb_projects, + 'title' => t('Projects').' ('.$nb_projects.')' + ))); + } +} |