summaryrefslogtreecommitdiff
path: root/app/Model/SubTask.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/Model/SubTask.php')
-rw-r--r--app/Model/SubTask.php22
1 files changed, 22 insertions, 0 deletions
diff --git a/app/Model/SubTask.php b/app/Model/SubTask.php
index 6e61330b..1faad680 100644
--- a/app/Model/SubTask.php
+++ b/app/Model/SubTask.php
@@ -172,6 +172,28 @@ class SubTask extends Base
}
/**
+ * Change the status of subtask
+ *
+ * Todo -> In progress -> Done -> Todo -> etc...
+ *
+ * @access public
+ * @param integer $subtask_id
+ * @return bool
+ */
+ public function toggleStatus($subtask_id)
+ {
+ $subtask = $this->getById($subtask_id);
+
+ $values = array(
+ 'id' => $subtask['id'],
+ 'status' => ($subtask['status'] + 1) % 3,
+ 'task_id' => $subtask['task_id'],
+ );
+
+ return $this->update($values);
+ }
+
+ /**
* Remove
*
* @access public