diff options
Diffstat (limited to 'app/Controller/Board.php')
-rw-r--r-- | app/Controller/Board.php | 111 |
1 files changed, 69 insertions, 42 deletions
diff --git a/app/Controller/Board.php b/app/Controller/Board.php index 0f38f910..50d9c62e 100644 --- a/app/Controller/Board.php +++ b/app/Controller/Board.php @@ -27,7 +27,7 @@ class Board extends Base } // Display the board with a specific layout - $this->response->html($this->template->layout('board/public', array( + $this->response->html($this->template->layout('board/public_view', array( 'project' => $project, 'swimlanes' => $this->board->getBoard($project['id']), 'title' => $project['name'], @@ -44,28 +44,17 @@ class Board extends Base * Show a board for a given project * * @access public - * @param integer $project_id Default project id */ - public function show($project_id = 0) + public function show() { - $project = $this->getProject($project_id); - $projects = $this->projectPermission->getAllowedProjects($this->userSession->getId()); + $params = $this->getProjectFilters('board', 'show'); - $board_selector = $projects; - unset($board_selector[$project['id']]); - - $this->response->html($this->template->layout('board/index', array( - 'users' => $this->projectPermission->getMemberList($project['id'], true, true), - 'projects' => $projects, - 'project' => $project, - 'swimlanes' => $this->board->getBoard($project['id']), - 'categories_listing' => $this->category->getList($project['id'], true, true), - 'title' => $project['name'], - 'description' => $project['description'], - 'board_selector' => $board_selector, + $this->response->html($this->template->layout('board/private_view', array( + 'swimlanes' => $this->taskFilter->search($params['filters']['search'])->getBoard($params['project']['id']), + 'description' => $params['project']['description'], 'board_private_refresh_interval' => $this->config->get('board_private_refresh_interval'), 'board_highlight_period' => $this->config->get('board_highlight_period'), - ))); + ) + $params)); } /** @@ -99,15 +88,7 @@ class Board extends Base return $this->response->status(400); } - $this->response->html( - $this->template->render('board/show', array( - 'project' => $this->project->getById($project_id), - 'swimlanes' => $this->board->getBoard($project_id), - 'board_private_refresh_interval' => $this->config->get('board_private_refresh_interval'), - 'board_highlight_period' => $this->config->get('board_highlight_period'), - )), - 201 - ); + $this->response->html($this->renderBoard($project_id), 201); } /** @@ -132,14 +113,7 @@ class Board extends Base return $this->response->status(304); } - $this->response->html( - $this->template->render('board/show', array( - 'project' => $this->project->getById($project_id), - 'swimlanes' => $this->board->getBoard($project_id), - 'board_private_refresh_interval' => $this->config->get('board_private_refresh_interval'), - 'board_highlight_period' => $this->config->get('board_highlight_period'), - )) - ); + $this->response->html($this->renderBoard($project_id)); } /** @@ -150,7 +124,7 @@ class Board extends Base public function tasklinks() { $task = $this->getTask(); - $this->response->html($this->template->render('board/tasklinks', array( + $this->response->html($this->template->render('board/tooltip_tasklinks', array( 'links' => $this->taskLink->getAll($task['id']), 'task' => $task, ))); @@ -164,7 +138,7 @@ class Board extends Base public function subtasks() { $task = $this->getTask(); - $this->response->html($this->template->render('board/subtasks', array( + $this->response->html($this->template->render('board/tooltip_subtasks', array( 'subtasks' => $this->subtask->getAll($task['id']), 'task' => $task, ))); @@ -179,7 +153,7 @@ class Board extends Base { $task = $this->getTask(); - $this->response->html($this->template->render('board/files', array( + $this->response->html($this->template->render('board/tooltip_files', array( 'files' => $this->file->getAllDocuments($task['id']), 'images' => $this->file->getAllImages($task['id']), 'task' => $task, @@ -195,7 +169,7 @@ class Board extends Base { $task = $this->getTask(); - $this->response->html($this->template->render('board/comments', array( + $this->response->html($this->template->render('board/tooltip_comments', array( 'comments' => $this->comment->getAll($task['id']) ))); } @@ -209,7 +183,7 @@ class Board extends Base { $task = $this->getTask(); - $this->response->html($this->template->render('board/description', array( + $this->response->html($this->template->render('board/tooltip_description', array( 'task' => $task ))); } @@ -224,7 +198,7 @@ class Board extends Base $task = $this->getTask(); $project = $this->project->getById($task['project_id']); - $this->response->html($this->template->render('board/assignee', array( + $this->response->html($this->template->render('board/popover_assignee', array( 'values' => $task, 'users_list' => $this->projectPermission->getMemberList($project['id']), 'project' => $project, @@ -262,7 +236,7 @@ class Board extends Base $task = $this->getTask(); $project = $this->project->getById($task['project_id']); - $this->response->html($this->template->render('board/category', array( + $this->response->html($this->template->render('board/popover_category', array( 'values' => $task, 'categories_list' => $this->category->getList($project['id']), 'project' => $project, @@ -321,4 +295,57 @@ class Board extends Base 'recurrence_basedate_list' => $this->task->getRecurrenceBasedateList(), ))); } + + /** + * Enable collapsed mode + * + * @access public + */ + public function collapse() + { + $this->changeDisplayMode(true); + } + + /** + * Enable expanded mode + * + * @access public + */ + public function expand() + { + $this->changeDisplayMode(false); + } + + /** + * Change display mode + * + * @access private + */ + private function changeDisplayMode($mode) + { + $project_id = $this->request->getIntegerParam('project_id'); + $this->userSession->setBoardDisplayMode($project_id, $mode); + + if ($this->request->isAjax()) { + $this->response->html($this->renderBoard($project_id)); + } + else { + $this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $project_id))); + } + } + + /** + * Render board + * + * @access private + */ + private function renderBoard($project_id) + { + return $this->template->render('board/table_container', array( + 'project' => $this->project->getById($project_id), + 'swimlanes' => $this->taskFilter->search($this->userSession->getFilters($project_id))->getBoard($project_id), + 'board_private_refresh_interval' => $this->config->get('board_private_refresh_interval'), + 'board_highlight_period' => $this->config->get('board_highlight_period'), + )); + } } |