Split Board model into multiple classes
This commit is contained in:
@@ -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(),
|
||||
|
||||
@@ -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'])));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.'));
|
||||
|
||||
@@ -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
|
||||
);
|
||||
|
||||
|
||||
@@ -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'],
|
||||
|
||||
@@ -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']),
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user