summaryrefslogtreecommitdiff
path: root/plugins/Timetrackingeditor/Controller/SubtaskStatusController.php
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2020-05-05 14:25:42 +0200
committeremkael <emkael@tlen.pl>2020-05-05 14:25:42 +0200
commit62827e6cf470449c117624058fb36ad94804bcc0 (patch)
tree10cd1e4d36c34b694acfadaa69fc7f6ae2b1eabd /plugins/Timetrackingeditor/Controller/SubtaskStatusController.php
parent7b66ddf2e4fbdb837e78d8b7dbaa9fc38391bc32 (diff)
Time tracking related pluginsHEADmaster
Diffstat (limited to 'plugins/Timetrackingeditor/Controller/SubtaskStatusController.php')
-rw-r--r--plugins/Timetrackingeditor/Controller/SubtaskStatusController.php49
1 files changed, 49 insertions, 0 deletions
diff --git a/plugins/Timetrackingeditor/Controller/SubtaskStatusController.php b/plugins/Timetrackingeditor/Controller/SubtaskStatusController.php
new file mode 100644
index 00000000..c27881a1
--- /dev/null
+++ b/plugins/Timetrackingeditor/Controller/SubtaskStatusController.php
@@ -0,0 +1,49 @@
+<?php
+
+namespace Kanboard\Plugin\Timetrackingeditor\Controller;
+
+use Kanboard\Model\SubtaskModel;
+
+/**
+ * SubtaskStatusController.
+ *
+ * @author Thomas Stinner
+ */
+class SubtaskStatusController extends \Kanboard\Controller\SubtaskStatusController
+{
+ /**
+ * Change status to the next status: Toto -> In Progress -> Done.
+ */
+ public function change()
+ {
+ $task = $this->getTask();
+ $subtask = $this->getSubtask();
+
+ if ($subtask['status'] == SubtaskModel::STATUS_DONE) {
+ $status = SubtaskModel::STATUS_TODO;
+ } else {
+ $status = SubtaskModel::STATUS_DONE;
+ }
+ $subtask['status'] = $status;
+ $this->subtaskModel->update($subtask);
+
+ if ($this->request->getIntegerParam('refresh-table') === 0) {
+
+ $html = $this->helper->subtask->toggleStatus($subtask, $task['project_id']);
+ } else {
+ $html = $this->renderTable($task);
+ }
+
+ $this->response->html($html);
+ }
+
+ protected function renderTable(array $task)
+ {
+ return $this->template->render('subtask/table', array(
+ 'task' => $task,
+ 'subtasks' => $this->subtaskModel->getAll($task['id']),
+ 'editable' => true,
+ ));
+ }
+}
+?>