summaryrefslogtreecommitdiff
path: root/app/Pagination/TaskPagination.php
diff options
context:
space:
mode:
authorJLGC @monolinux <monolinux@junglacode.org>2016-08-15 23:13:16 -0500
committerJLGC @monolinux <monolinux@junglacode.org>2016-08-15 23:13:16 -0500
commit683c0464093f6a7976236c68653c2a2cc5dae280 (patch)
treebf176ecd82415cc4952eea071b7d264dd5fd68b4 /app/Pagination/TaskPagination.php
parentb1e795fc5b45369f7b9b565b1e106d2673361977 (diff)
parent5f82a942c0011bf91947b2c1d627c0907bda0c92 (diff)
Merge https://github.com/kanboard/kanboard
Diffstat (limited to 'app/Pagination/TaskPagination.php')
-rw-r--r--app/Pagination/TaskPagination.php38
1 files changed, 38 insertions, 0 deletions
diff --git a/app/Pagination/TaskPagination.php b/app/Pagination/TaskPagination.php
new file mode 100644
index 00000000..5fe986e7
--- /dev/null
+++ b/app/Pagination/TaskPagination.php
@@ -0,0 +1,38 @@
+<?php
+
+namespace Kanboard\Pagination;
+
+use Kanboard\Core\Base;
+use Kanboard\Core\Paginator;
+use Kanboard\Model\TaskModel;
+
+/**
+ * Class TaskPagination
+ *
+ * @package Kanboard\Pagination
+ * @author Frederic Guillot
+ */
+class TaskPagination 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)
+ {
+ $query = $this->taskFinderModel->getUserQuery($user_id);
+ $this->hook->reference('pagination:dashboard:task:query', $query);
+
+ return $this->paginator
+ ->setUrl('DashboardController', $method, array('pagination' => 'tasks', 'user_id' => $user_id))
+ ->setMax($max)
+ ->setOrder(TaskModel::TABLE.'.id')
+ ->setQuery($query)
+ ->calculateOnlyIf($this->request->getStringParam('pagination') === 'tasks');
+ }
+}