summaryrefslogtreecommitdiff
path: root/app/Controller/Timer.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-06-24 20:39:06 -0400
committerFrederic Guillot <fred@kanboard.net>2015-06-24 20:39:06 -0400
commit6efac784fcc1a2e83bb7b43fc7841448b5975cba (patch)
treea083b3c8b86deca9c4f23bcb15cfafeec86924e8 /app/Controller/Timer.php
parent58c96b8c4ec3f326b25e6b55f133fc067345cd57 (diff)
Add timer for subtasks and remove settings for subtask time tracking
Diffstat (limited to 'app/Controller/Timer.php')
-rw-r--r--app/Controller/Timer.php35
1 files changed, 35 insertions, 0 deletions
diff --git a/app/Controller/Timer.php b/app/Controller/Timer.php
new file mode 100644
index 00000000..2a4531ba
--- /dev/null
+++ b/app/Controller/Timer.php
@@ -0,0 +1,35 @@
+<?php
+
+namespace Controller;
+
+/**
+ * Time Tracking controller
+ *
+ * @package controller
+ * @author Frederic Guillot
+ */
+class Timer extends Base
+{
+ /**
+ * Start/stop timer for subtasks
+ *
+ * @access public
+ */
+ public function subtask()
+ {
+ $project_id = $this->request->getIntegerParam('project_id');
+ $task_id = $this->request->getIntegerParam('task_id');
+ $subtask_id = $this->request->getIntegerParam('subtask_id');
+ $timer = $this->request->getStringParam('timer');
+
+ if ($timer === 'start') {
+ $this->subtaskTimeTracking->logStartTime($subtask_id, $this->userSession->getId());
+ }
+ else if ($timer === 'stop') {
+ $this->subtaskTimeTracking->logEndTime($subtask_id, $this->userSession->getId());
+ $this->subtaskTimeTracking->updateTaskTimeTracking($task_id);
+ }
+
+ $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $project_id, 'task_id' => $task_id)).'#subtasks');
+ }
+}