diff options
author | emkael <emkael@tlen.pl> | 2020-05-05 14:25:42 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2020-05-05 14:25:42 +0200 |
commit | 62827e6cf470449c117624058fb36ad94804bcc0 (patch) | |
tree | 10cd1e4d36c34b694acfadaa69fc7f6ae2b1eabd /plugins/Timetrackingeditor/Controller/SubtaskStatusController.php | |
parent | 7b66ddf2e4fbdb837e78d8b7dbaa9fc38391bc32 (diff) |
Diffstat (limited to 'plugins/Timetrackingeditor/Controller/SubtaskStatusController.php')
-rw-r--r-- | plugins/Timetrackingeditor/Controller/SubtaskStatusController.php | 49 |
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,
+ ));
+ }
+}
+?>
|