diff options
author | Frederic Guillot <fred@kanboard.net> | 2017-04-01 17:04:18 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2017-04-01 17:04:18 -0400 |
commit | 5cc488947305eea5b9762997222c84d6007761c8 (patch) | |
tree | 5f602bb06ade363aa40eda99b4fe9a61f592609f /app/Controller | |
parent | 253d5a9331e4b4775066ec8cb9664da9a2aa6ac9 (diff) |
Move Gantt charts to external plugin
Diffstat (limited to 'app/Controller')
-rw-r--r-- | app/Controller/ProjectGanttController.php | 56 | ||||
-rw-r--r-- | app/Controller/TaskGanttController.php | 61 |
2 files changed, 0 insertions, 117 deletions
diff --git a/app/Controller/ProjectGanttController.php b/app/Controller/ProjectGanttController.php deleted file mode 100644 index 8239005e..00000000 --- a/app/Controller/ProjectGanttController.php +++ /dev/null @@ -1,56 +0,0 @@ -<?php - -namespace Kanboard\Controller; - -use Kanboard\Filter\ProjectIdsFilter; -use Kanboard\Filter\ProjectStatusFilter; -use Kanboard\Filter\ProjectTypeFilter; -use Kanboard\Model\ProjectModel; - -/** - * Projects Gantt Controller - * - * @package Kanboard\Controller - * @author Frederic Guillot - */ -class ProjectGanttController extends BaseController -{ - /** - * Show Gantt chart for all projects - */ - public function show() - { - $project_ids = $this->projectPermissionModel->getActiveProjectIds($this->userSession->getId()); - $filter = $this->projectQuery - ->withFilter(new ProjectTypeFilter(ProjectModel::TYPE_TEAM)) - ->withFilter(new ProjectStatusFilter(ProjectModel::ACTIVE)) - ->withFilter(new ProjectIdsFilter($project_ids)); - - $filter->getQuery()->asc(ProjectModel::TABLE.'.start_date'); - - $this->response->html($this->helper->layout->app('project_gantt/show', array( - 'projects' => $filter->format($this->projectGanttFormatter), - 'title' => t('Gantt chart for all projects'), - ))); - } - - /** - * Save new project start date and end date - */ - public function save() - { - $values = $this->request->getJson(); - - $result = $this->projectModel->update(array( - 'id' => $values['id'], - 'start_date' => $this->dateParser->getIsoDate(strtotime($values['start'])), - 'end_date' => $this->dateParser->getIsoDate(strtotime($values['end'])), - )); - - if (! $result) { - $this->response->json(array('message' => 'Unable to save project'), 400); - } else { - $this->response->json(array('message' => 'OK'), 201); - } - } -} diff --git a/app/Controller/TaskGanttController.php b/app/Controller/TaskGanttController.php deleted file mode 100644 index b03b9d00..00000000 --- a/app/Controller/TaskGanttController.php +++ /dev/null @@ -1,61 +0,0 @@ -<?php - -namespace Kanboard\Controller; - -use Kanboard\Filter\TaskProjectFilter; -use Kanboard\Model\TaskModel; - -/** - * Tasks Gantt Controller - * - * @package Kanboard\Controller - * @author Frederic Guillot - */ -class TaskGanttController extends BaseController -{ - /** - * Show Gantt chart for one project - */ - public function show() - { - $project = $this->getProject(); - $search = $this->helper->projectHeader->getSearchQuery($project); - $sorting = $this->request->getStringParam('sorting', 'board'); - $filter = $this->taskLexer->build($search)->withFilter(new TaskProjectFilter($project['id'])); - - if ($sorting === 'date') { - $filter->getQuery()->asc(TaskModel::TABLE.'.date_started')->asc(TaskModel::TABLE.'.date_creation'); - } else { - $filter->getQuery()->asc('column_position')->asc(TaskModel::TABLE.'.position'); - } - - $this->response->html($this->helper->layout->app('task_gantt/show', array( - 'project' => $project, - 'title' => $project['name'], - 'description' => $this->helper->projectHeader->getDescription($project), - 'sorting' => $sorting, - 'tasks' => $filter->format($this->taskGanttFormatter), - ))); - } - - /** - * Save new task start date and due date - */ - public function save() - { - $this->getProject(); - $values = $this->request->getJson(); - - $result = $this->taskModificationModel->update(array( - 'id' => $values['id'], - 'date_started' => strtotime($values['start']), - 'date_due' => strtotime($values['end']), - )); - - if (! $result) { - $this->response->json(array('message' => 'Unable to save task'), 400); - } else { - $this->response->json(array('message' => 'OK'), 201); - } - } -} |