看板初始化提交
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace Kanboard\Pagination;
|
||||
|
||||
use Kanboard\Core\Base;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
use Kanboard\Model\TaskModel;
|
||||
|
||||
/**
|
||||
* Class DashboardPagination
|
||||
*
|
||||
* @package Kanboard\Pagination
|
||||
* @author Frederic Guillot
|
||||
*/
|
||||
class DashboardPagination extends Base
|
||||
{
|
||||
/**
|
||||
* Get user listing pagination
|
||||
*
|
||||
* @access public
|
||||
* @param integer $userId
|
||||
* @return array
|
||||
*/
|
||||
public function getOverview($userId)
|
||||
{
|
||||
$paginators = array();
|
||||
$projects = $this->projectUserRoleModel->getActiveProjectsByUser($userId);
|
||||
|
||||
foreach ($projects as $projectId => $projectName) {
|
||||
|
||||
$query = $this->taskFinderModel->getUserQuery($userId)->eq(ProjectModel::TABLE.'.id', $projectId);
|
||||
$this->hook->reference('pagination:dashboard:task:query', $query);
|
||||
|
||||
$paginator = $this->paginator
|
||||
->setUrl('DashboardController', 'show', array('user_id' => $userId, 'pagination' => 'tasks-'.$projectId), 'project-tasks-'.$projectId)
|
||||
->setMax(15)
|
||||
->setOrder(TaskModel::TABLE.'.priority')
|
||||
->setDirection('DESC')
|
||||
->setFormatter($this->taskListSubtaskAssigneeFormatter->withUserId($userId))
|
||||
->setQuery($query)
|
||||
->calculateOnlyIf($this->request->getStringParam('pagination') === 'tasks-'.$projectId);
|
||||
|
||||
if ($paginator->getTotal() > 0) {
|
||||
$paginators[] = array(
|
||||
'project_id' => $projectId,
|
||||
'project_name' => $projectName,
|
||||
'paginator' => $paginator,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $paginators;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?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)
|
||||
{
|
||||
$query = $this->projectModel->getQueryColumnStats($this->projectPermissionModel->getActiveProjectIds($user_id));
|
||||
$this->hook->reference('pagination:dashboard:project:query', $query);
|
||||
|
||||
return $this->paginator
|
||||
->setUrl('DashboardController', $method, array('pagination' => 'projects', 'user_id' => $user_id))
|
||||
->setMax($max)
|
||||
->setOrder(ProjectModel::TABLE.'.name')
|
||||
->setQuery($query)
|
||||
->calculateOnlyIf($this->request->getStringParam('pagination') === 'projects');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?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)
|
||||
{
|
||||
$query = $this->taskFinderModel->getUserQuery($userId);
|
||||
$this->hook->reference('pagination:dashboard:subtask:query', $query);
|
||||
|
||||
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($query)
|
||||
->calculate();
|
||||
}
|
||||
}
|
||||
@@ -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');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace Kanboard\Pagination;
|
||||
|
||||
use Kanboard\Core\Base;
|
||||
use Kanboard\Core\Paginator;
|
||||
use Kanboard\Model\UserModel;
|
||||
|
||||
/**
|
||||
* Class UserPagination
|
||||
*
|
||||
* @package Kanboard\Pagination
|
||||
* @author Frederic Guillot
|
||||
*/
|
||||
class UserPagination extends Base
|
||||
{
|
||||
/**
|
||||
* Get user listing pagination
|
||||
*
|
||||
* @access public
|
||||
* @return Paginator
|
||||
*/
|
||||
public function getListingPaginator()
|
||||
{
|
||||
return $this->paginator
|
||||
->setUrl('UserListController', 'show')
|
||||
->setMax(30)
|
||||
->setOrder(UserModel::TABLE.'.username')
|
||||
->setQuery($this->userModel->getQuery())
|
||||
->calculate();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user