diff options
Diffstat (limited to 'app/Controller')
-rw-r--r-- | app/Controller/Subtask.php | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/app/Controller/Subtask.php b/app/Controller/Subtask.php index 63ca6303..da9acbab 100644 --- a/app/Controller/Subtask.php +++ b/app/Controller/Subtask.php @@ -184,4 +184,26 @@ class Subtask extends Base $this->response->redirect('?controller=task&action=show&task_id='.$task['id'].'#subtasks'); } + + /** + * Change status to the next status: Toto -> In Progress -> Done + * + * @access public + */ + public function toggleStatus() + { + $task = $this->getTask(); + $subtask = $this->getSubtask(); + + $value = array( + 'id' => $subtask['id'], + 'status' => ($subtask['status'] + 1) % 3 + ); + + if (! $this->subTask->update($value)) { + $this->session->flashError(t('Unable to update your sub-task.')); + } + + $this->response->redirect('?controller=task&action=show&task_id='.$task['id'].'#subtasks'); + } } |