summaryrefslogtreecommitdiff
path: root/app/Controller/ProjectListController.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-05-25 22:28:09 -0400
committerFrederic Guillot <fred@kanboard.net>2016-05-25 22:28:09 -0400
commitff892c5d25e0bab560f005c788189d38c2bcab7b (patch)
tree72edfcffd52db61f9a7632f860b6d914445593ab /app/Controller/ProjectListController.php
parent872dc79dbd8b04424520e32675a6e0dcb6ed44bc (diff)
Split project controller into multiple classes
Diffstat (limited to 'app/Controller/ProjectListController.php')
-rw-r--r--app/Controller/ProjectListController.php41
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.')'
+ )));
+ }
+}