summaryrefslogtreecommitdiff
path: root/app/Pagination/SubtaskPagination.php
blob: 83593b5e5dca668f9196328c81afff5d67fbb1be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php

namespace Kanboard\Pagination;

use Kanboard\Core\Base;
use Kanboard\Core\Paginator;
use Kanboard\Model\TaskModel;

/**
 * Class SubtaskPagination
 *
 * @package Kanboard\Pagination
 * @author  Frederic Guillot
 */
class SubtaskPagination extends Base
{
    /**
     * Get dashboard pagination
     *
     * @access public
     * @param  integer $userId
     * @return Paginator
     */
    public function getDashboardPaginator($userId)
    {
        return $this->paginator
            ->setUrl('DashboardController', 'subtasks', array('user_id' => $userId))
            ->setMax(50)
            ->setOrder(TaskModel::TABLE.'.priority')
            ->setDirection('DESC')
            ->setFormatter($this->taskListSubtaskAssigneeFormatter->withUserId($userId)->withoutEmptyTasks())
            ->setQuery($this->taskFinderModel->getUserQuery($userId))
            ->calculate();
    }
}