From 5cc488947305eea5b9762997222c84d6007761c8 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 1 Apr 2017 17:04:18 -0400 Subject: Move Gantt charts to external plugin --- app/Controller/ProjectGanttController.php | 56 ---------------------------- app/Controller/TaskGanttController.php | 61 ------------------------------- 2 files changed, 117 deletions(-) delete mode 100644 app/Controller/ProjectGanttController.php delete mode 100644 app/Controller/TaskGanttController.php (limited to 'app/Controller') 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 @@ -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 @@ -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); - } - } -} -- cgit v1.2.3