diff options
author | Frederic Guillot <fred@kanboard.net> | 2016-02-20 15:08:18 -0500 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2016-02-20 15:08:18 -0500 |
commit | fc468088c3b39bc4e9d185683442db1d36b61e23 (patch) | |
tree | 6f5b6a1e13f528a8f54ac502ab428feadc53e5f5 /app/Controller | |
parent | 83832522867d06241441c04d2b3237200db57224 (diff) |
Split Board model into multiple classes
Diffstat (limited to 'app/Controller')
-rw-r--r-- | app/Controller/Action.php | 4 | ||||
-rw-r--r-- | app/Controller/BoardPopover.php | 4 | ||||
-rw-r--r-- | app/Controller/Column.php | 16 | ||||
-rw-r--r-- | app/Controller/Gantt.php | 2 | ||||
-rw-r--r-- | app/Controller/Task.php | 4 | ||||
-rw-r--r-- | app/Controller/Taskcreation.php | 2 | ||||
-rw-r--r-- | app/Controller/Taskduplication.php | 2 |
7 files changed, 17 insertions, 17 deletions
diff --git a/app/Controller/Action.php b/app/Controller/Action.php index 482a210b..6c324324 100644 --- a/app/Controller/Action.php +++ b/app/Controller/Action.php @@ -27,7 +27,7 @@ class Action extends Base 'available_actions' => $this->actionManager->getAvailableActions(), 'available_events' => $this->eventManager->getAll(), 'available_params' => $this->actionManager->getAvailableParameters($actions), - 'columns_list' => $this->board->getColumnsList($project['id']), + 'columns_list' => $this->column->getList($project['id']), 'users_list' => $this->projectUserRole->getAssignableUsersList($project['id']), 'projects_list' => $this->projectUserRole->getProjectsByUser($this->userSession->getId()), 'colors_list' => $this->color->getList(), @@ -86,7 +86,7 @@ class Action extends Base $this->response->html($this->helper->layout->project('action/params', array( 'values' => $values, 'action_params' => $action_params, - 'columns_list' => $this->board->getColumnsList($project['id']), + 'columns_list' => $this->column->getList($project['id']), 'users_list' => $this->projectUserRole->getAssignableUsersList($project['id']), 'projects_list' => $projects_list, 'colors_list' => $this->color->getList(), diff --git a/app/Controller/BoardPopover.php b/app/Controller/BoardPopover.php index 965669ff..63dab302 100644 --- a/app/Controller/BoardPopover.php +++ b/app/Controller/BoardPopover.php @@ -112,7 +112,7 @@ class BoardPopover extends Base $this->response->html($this->template->render('board/popover_close_all_tasks_column', array( 'project' => $project, 'nb_tasks' => $this->taskFinder->countByColumnAndSwimlaneId($project['id'], $column_id, $swimlane_id), - 'column' => $this->board->getColumnTitleById($column_id), + 'column' => $this->column->getColumnTitleById($column_id), 'swimlane' => $this->swimlane->getNameById($swimlane_id) ?: t($project['default_swimlane']), 'values' => array('column_id' => $column_id, 'swimlane_id' => $swimlane_id), ))); @@ -129,7 +129,7 @@ class BoardPopover extends Base $values = $this->request->getValues(); $this->taskStatus->closeTasksBySwimlaneAndColumn($values['swimlane_id'], $values['column_id']); - $this->flash->success(t('All tasks of the column "%s" and the swimlane "%s" have been closed successfully.', $this->board->getColumnTitleById($values['column_id']), $this->swimlane->getNameById($values['swimlane_id']) ?: t($project['default_swimlane']))); + $this->flash->success(t('All tasks of the column "%s" and the swimlane "%s" have been closed successfully.', $this->column->getColumnTitleById($values['column_id']), $this->swimlane->getNameById($values['swimlane_id']) ?: t($project['default_swimlane']))); $this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $project['id']))); } } diff --git a/app/Controller/Column.php b/app/Controller/Column.php index 329413ef..e02c7dcb 100644 --- a/app/Controller/Column.php +++ b/app/Controller/Column.php @@ -18,7 +18,7 @@ class Column extends Base public function index() { $project = $this->getProject(); - $columns = $this->board->getColumns($project['id']); + $columns = $this->column->getAll($project['id']); $this->response->html($this->helper->layout->project('column/index', array( 'columns' => $columns, @@ -35,7 +35,7 @@ class Column extends Base public function create(array $values = array(), array $errors = array()) { $project = $this->getProject(); - $columns = $this->board->getColumnsList($project['id']); + $columns = $this->column->getList($project['id']); if (empty($values)) { $values = array('project_id' => $project['id']); @@ -62,7 +62,7 @@ class Column extends Base list($valid, $errors) = $this->columnValidator->validateCreation($values); if ($valid) { - if ($this->board->addColumn($project['id'], $values['title'], $values['task_limit'], $values['description'])) { + if ($this->column->create($project['id'], $values['title'], $values['task_limit'], $values['description'])) { $this->flash->success(t('Column created successfully.')); return $this->response->redirect($this->helper->url->to('column', 'index', array('project_id' => $project['id'])), true); } else { @@ -81,7 +81,7 @@ class Column extends Base public function edit(array $values = array(), array $errors = array()) { $project = $this->getProject(); - $column = $this->board->getColumn($this->request->getIntegerParam('column_id')); + $column = $this->column->getById($this->request->getIntegerParam('column_id')); $this->response->html($this->helper->layout->project('column/edit', array( 'errors' => $errors, @@ -105,7 +105,7 @@ class Column extends Base list($valid, $errors) = $this->columnValidator->validateModification($values); if ($valid) { - if ($this->board->updateColumn($values['id'], $values['title'], $values['task_limit'], $values['description'])) { + if ($this->column->update($values['id'], $values['title'], $values['task_limit'], $values['description'])) { $this->flash->success(t('Board updated successfully.')); $this->response->redirect($this->helper->url->to('column', 'index', array('project_id' => $project['id']))); } else { @@ -144,7 +144,7 @@ class Column extends Base $project = $this->getProject(); $this->response->html($this->helper->layout->project('column/remove', array( - 'column' => $this->board->getColumn($this->request->getIntegerParam('column_id')), + 'column' => $this->column->getById($this->request->getIntegerParam('column_id')), 'project' => $project, 'title' => t('Remove a column from a board') ))); @@ -159,9 +159,9 @@ class Column extends Base { $project = $this->getProject(); $this->checkCSRFParam(); - $column = $this->board->getColumn($this->request->getIntegerParam('column_id')); + $column_id = $this->request->getIntegerParam('column_id'); - if (! empty($column) && $this->board->removeColumn($column['id'])) { + if ($this->column->remove($column_id)) { $this->flash->success(t('Column removed successfully.')); } else { $this->flash->failure(t('Unable to remove this column.')); diff --git a/app/Controller/Gantt.php b/app/Controller/Gantt.php index 5dbd1243..9ffa277f 100644 --- a/app/Controller/Gantt.php +++ b/app/Controller/Gantt.php @@ -103,7 +103,7 @@ class Gantt extends Base $values = $values + array( 'project_id' => $project['id'], - 'column_id' => $this->board->getFirstColumn($project['id']), + 'column_id' => $this->column->getFirstColumnId($project['id']), 'position' => 1 ); diff --git a/app/Controller/Task.php b/app/Controller/Task.php index 98b7a041..539d377b 100644 --- a/app/Controller/Task.php +++ b/app/Controller/Task.php @@ -36,7 +36,7 @@ class Task extends Base 'subtasks' => $this->subtask->getAll($task['id']), 'links' => $this->taskLink->getAllGroupedByLabel($task['id']), 'task' => $task, - 'columns_list' => $this->board->getColumnsList($task['project_id']), + 'columns_list' => $this->column->getList($task['project_id']), 'colors_list' => $this->color->getList(), 'title' => $task['title'], 'no_layout' => true, @@ -74,7 +74,7 @@ class Task extends Base 'task' => $task, 'values' => $values, 'link_label_list' => $this->link->getList(0, false), - 'columns_list' => $this->board->getColumnsList($task['project_id']), + 'columns_list' => $this->column->getList($task['project_id']), 'colors_list' => $this->color->getList(), 'users_list' => $this->projectUserRole->getAssignableUsersList($task['project_id'], true, false, false), 'title' => $task['project_name'].' > '.$task['title'], diff --git a/app/Controller/Taskcreation.php b/app/Controller/Taskcreation.php index f1ac7272..1d8a0e29 100644 --- a/app/Controller/Taskcreation.php +++ b/app/Controller/Taskcreation.php @@ -36,7 +36,7 @@ class Taskcreation extends Base 'project' => $project, 'errors' => $errors, 'values' => $values + array('project_id' => $project['id']), - 'columns_list' => $this->board->getColumnsList($project['id']), + 'columns_list' => $this->column->getList($project['id']), 'users_list' => $this->projectUserRole->getAssignableUsersList($project['id'], true, false, true), 'colors_list' => $this->color->getList(), 'categories_list' => $this->category->getList($project['id']), diff --git a/app/Controller/Taskduplication.php b/app/Controller/Taskduplication.php index 7e7fccd6..7641a48d 100644 --- a/app/Controller/Taskduplication.php +++ b/app/Controller/Taskduplication.php @@ -115,7 +115,7 @@ class Taskduplication extends Base $dst_project_id = $this->request->getIntegerParam('dst_project_id', key($projects_list)); $swimlanes_list = $this->swimlane->getList($dst_project_id, false, true); - $columns_list = $this->board->getColumnsList($dst_project_id); + $columns_list = $this->column->getList($dst_project_id); $categories_list = $this->category->getList($dst_project_id); $users_list = $this->projectUserRole->getAssignableUsersList($dst_project_id); |