diff options
author | Frederic Guillot <fred@kanboard.net> | 2016-07-24 12:09:41 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2016-07-24 12:09:41 -0400 |
commit | 51b2193fc43a25f309a8510b64027d40bf21e12d (patch) | |
tree | 32683ee323de8260b24a2023401b720e56f5f58d /app/Pagination/SubtaskPagination.php | |
parent | 506ebf3bac302a63be7c32a03b872a9eefa689fc (diff) |
Move dashboard pagination into separate classes
Diffstat (limited to 'app/Pagination/SubtaskPagination.php')
-rw-r--r-- | app/Pagination/SubtaskPagination.php | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/app/Pagination/SubtaskPagination.php b/app/Pagination/SubtaskPagination.php new file mode 100644 index 00000000..f0cd6148 --- /dev/null +++ b/app/Pagination/SubtaskPagination.php @@ -0,0 +1,36 @@ +<?php + +namespace Kanboard\Pagination; + +use Kanboard\Core\Base; +use Kanboard\Core\Paginator; +use Kanboard\Model\SubtaskModel; +use Kanboard\Model\TaskModel; + +/** + * Class SubtaskPagination + * + * @package Kanboard\Pagination + * @author Frederic Guillot + */ +class SubtaskPagination 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' => 'subtasks', 'user_id' => $user_id)) + ->setMax($max) + ->setOrder(TaskModel::TABLE.'.id') + ->setQuery($this->subtaskModel->getUserQuery($user_id, array(SubtaskModel::STATUS_TODO, SubtaskModel::STATUS_INPROGRESS))) + ->calculateOnlyIf($this->request->getStringParam('pagination') === 'subtasks'); + } +} |