summaryrefslogtreecommitdiff
path: root/app/Pagination/ProjectPagination.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2017-04-08 13:58:25 -0400
committerFrederic Guillot <fred@kanboard.net>2017-04-08 13:58:25 -0400
commitd7b0cfbbe57fae9afbf9637afa7e54d3bf708747 (patch)
treeced408d01329538bd34b659018a7cd11e04aa982 /app/Pagination/ProjectPagination.php
parentfe9f3ba707d1caf9348ae17e0566eabd505fbce2 (diff)
Improve dashboard
Diffstat (limited to 'app/Pagination/ProjectPagination.php')
-rw-r--r--app/Pagination/ProjectPagination.php35
1 files changed, 35 insertions, 0 deletions
diff --git a/app/Pagination/ProjectPagination.php b/app/Pagination/ProjectPagination.php
new file mode 100644
index 00000000..8f1fa87c
--- /dev/null
+++ b/app/Pagination/ProjectPagination.php
@@ -0,0 +1,35 @@
+<?php
+
+namespace Kanboard\Pagination;
+
+use Kanboard\Core\Base;
+use Kanboard\Core\Paginator;
+use Kanboard\Model\ProjectModel;
+
+/**
+ * Class ProjectPagination
+ *
+ * @package Kanboard\Pagination
+ * @author Frederic Guillot
+ */
+class ProjectPagination extends Base
+{
+ /**
+ * Get dashboard pagination
+ *
+ * @access public
+ * @param integer $user_id
+ * @param string $method
+ * @param integer $max
+ * @return Paginator
+ */
+ public function getDashboardPaginator($user_id, $method, $max)
+ {
+ return $this->paginator
+ ->setUrl('DashboardController', $method, array('pagination' => 'projects', 'user_id' => $user_id))
+ ->setMax($max)
+ ->setOrder(ProjectModel::TABLE.'.name')
+ ->setQuery($this->projectModel->getQueryColumnStats($this->projectPermissionModel->getActiveProjectIds($user_id)))
+ ->calculateOnlyIf($this->request->getStringParam('pagination') === 'projects');
+ }
+}