Improve dashboard
This commit is contained in:
35
app/Pagination/ProjectPagination.php
Normal file
35
app/Pagination/ProjectPagination.php
Normal file
@@ -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');
|
||||
}
|
||||
}
|
||||
35
app/Pagination/SubtaskPagination.php
Normal file
35
app/Pagination/SubtaskPagination.php
Normal file
@@ -0,0 +1,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();
|
||||
}
|
||||
}
|
||||
39
app/Pagination/TaskPagination.php
Normal file
39
app/Pagination/TaskPagination.php
Normal file
@@ -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');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user