diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/Core/Filter/LexerBuilder.php | 2 | ||||
-rw-r--r-- | app/Core/Plugin/Hook.php | 17 | ||||
-rw-r--r-- | app/Formatter/BoardFormatter.php | 11 | ||||
-rw-r--r-- | app/Pagination/SubtaskPagination.php | 5 | ||||
-rw-r--r-- | app/Pagination/TaskPagination.php | 5 |
5 files changed, 33 insertions, 7 deletions
diff --git a/app/Core/Filter/LexerBuilder.php b/app/Core/Filter/LexerBuilder.php index 626d7614..e3ab725b 100644 --- a/app/Core/Filter/LexerBuilder.php +++ b/app/Core/Filter/LexerBuilder.php @@ -51,7 +51,7 @@ class LexerBuilder */ public function __construct() { - $this->lexer = new Lexer; + $this->lexer = new Lexer(); $this->queryBuilder = new QueryBuilder(); } diff --git a/app/Core/Plugin/Hook.php b/app/Core/Plugin/Hook.php index ade69150..ca197937 100644 --- a/app/Core/Plugin/Hook.php +++ b/app/Core/Plugin/Hook.php @@ -96,4 +96,21 @@ class Hook return null; } + + /** + * Hook with reference + * + * @access public + * @param string $hook + * @param mixed $param + * @return mixed + */ + public function reference($hook, &$param) + { + foreach ($this->getListeners($hook) as $listener) { + $listener($param); + } + + return $param; + } } diff --git a/app/Formatter/BoardFormatter.php b/app/Formatter/BoardFormatter.php index 350dde6c..df443a52 100644 --- a/app/Formatter/BoardFormatter.php +++ b/app/Formatter/BoardFormatter.php @@ -44,6 +44,13 @@ class BoardFormatter extends BaseFormatter implements FormatterInterface { $swimlanes = $this->swimlaneModel->getSwimlanes($this->projectId); $columns = $this->columnModel->getAll($this->projectId); + + if (empty($swimlanes) || empty($columns)) { + return array(); + } + + $this->hook->reference('formatter:board:query', $this->query); + $tasks = $this->query ->eq(TaskModel::TABLE.'.project_id', $this->projectId) ->asc(TaskModel::TABLE.'.position') @@ -52,10 +59,6 @@ class BoardFormatter extends BaseFormatter implements FormatterInterface $task_ids = array_column($tasks, 'id'); $tags = $this->taskTagModel->getTagsByTasks($task_ids); - if (empty($swimlanes) || empty($columns)) { - return array(); - } - return BoardSwimlaneFormatter::getInstance($this->container) ->withSwimlanes($swimlanes) ->withColumns($columns) diff --git a/app/Pagination/SubtaskPagination.php b/app/Pagination/SubtaskPagination.php index f0cd6148..c55d0fb4 100644 --- a/app/Pagination/SubtaskPagination.php +++ b/app/Pagination/SubtaskPagination.php @@ -26,11 +26,14 @@ class SubtaskPagination extends Base */ public function getDashboardPaginator($user_id, $method, $max) { + $query = $this->subtaskModel->getUserQuery($user_id, array(SubtaskModel::STATUS_TODO, SubtaskModel::STATUS_INPROGRESS)); + $this->hook->reference('pagination:dashboard:subtask:query', $query); + 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))) + ->setQuery($query) ->calculateOnlyIf($this->request->getStringParam('pagination') === 'subtasks'); } } diff --git a/app/Pagination/TaskPagination.php b/app/Pagination/TaskPagination.php index a395ab84..5fe986e7 100644 --- a/app/Pagination/TaskPagination.php +++ b/app/Pagination/TaskPagination.php @@ -25,11 +25,14 @@ class TaskPagination extends Base */ public function getDashboardPaginator($user_id, $method, $max) { + $query = $this->taskFinderModel->getUserQuery($user_id); + $this->hook->reference('pagination:dashboard:task:query', $query); + return $this->paginator ->setUrl('DashboardController', $method, array('pagination' => 'tasks', 'user_id' => $user_id)) ->setMax($max) ->setOrder(TaskModel::TABLE.'.id') - ->setQuery($this->taskFinderModel->getUserQuery($user_id)) + ->setQuery($query) ->calculateOnlyIf($this->request->getStringParam('pagination') === 'tasks'); } } |