summaryrefslogtreecommitdiff
path: root/app/Controller
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2019-02-08 13:53:13 -0800
committerFrédéric Guillot <fred@kanboard.net>2019-02-08 13:53:13 -0800
commit029538846181309e9135a17f893e874b2e90f72b (patch)
treeb6e19516836c67d35a0ec842d321a7c9213d5952 /app/Controller
parentba5878e7869655feda1983967ba80e7c2e811676 (diff)
Add new actions to reorder tasks by column
Diffstat (limited to 'app/Controller')
-rw-r--r--app/Controller/TaskReorderController.php36
1 files changed, 36 insertions, 0 deletions
diff --git a/app/Controller/TaskReorderController.php b/app/Controller/TaskReorderController.php
new file mode 100644
index 00000000..32bdfc52
--- /dev/null
+++ b/app/Controller/TaskReorderController.php
@@ -0,0 +1,36 @@
+<?php
+
+namespace Kanboard\Controller;
+
+use Kanboard\Core\Controller\AccessForbiddenException;
+
+class TaskReorderController extends BaseController
+{
+ public function reorderColumn()
+ {
+ $project = $this->getProject();
+
+ if (! $this->helper->user->hasProjectAccess('TaskModificationController', 'update', $project['id'])) {
+ throw new AccessForbiddenException();
+ }
+
+ $swimlaneID = $this->request->getIntegerParam('swimlane_id');
+ $columnID = $this->request->getIntegerParam('column_id');
+ $direction = $this->request->getStringParam('direction');
+ $sort = $this->request->getStringParam('sort');
+
+ switch ($sort) {
+ case 'priority':
+ $this->taskReorderModel->reorderByPriority($project['id'], $swimlaneID, $columnID, $direction);
+ break;
+ case 'assignee-priority':
+ $this->taskReorderModel->reorderByAssigneeAndPriority($project['id'], $swimlaneID, $columnID, $direction);
+ break;
+ case 'assignee':
+ $this->taskReorderModel->reorderByAssignee($project['id'], $swimlaneID, $columnID, $direction);
+ break;
+ }
+
+ $this->response->redirect($this->helper->url->to('BoardViewController', 'show', ['project_id' => $project['id']]));
+ }
+}