diff options
Diffstat (limited to 'app/Pagination/TaskPagination.php')
-rw-r--r-- | app/Pagination/TaskPagination.php | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/app/Pagination/TaskPagination.php b/app/Pagination/TaskPagination.php new file mode 100644 index 00000000..53e05c13 --- /dev/null +++ b/app/Pagination/TaskPagination.php @@ -0,0 +1,39 @@ +<?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 $userId + * @param string $method + * @param integer $max + * @return Paginator + */ + public function getDashboardPaginator($userId, $method, $max) + { + $query = $this->taskFinderModel->getUserQuery($userId); + $this->hook->reference('pagination:dashboard:task:query', $query); + + return $this->paginator + ->setUrl('DashboardController', $method, array('pagination' => 'tasks', 'user_id' => $userId)) + ->setMax($max) + ->setOrder(TaskModel::TABLE.'.id') + ->setQuery($query) + ->setFormatter($this->taskListFormatter) + ->calculateOnlyIf($this->request->getStringParam('pagination') === 'tasks'); + } +} |