From 6efac784fcc1a2e83bb7b43fc7841448b5975cba Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Wed, 24 Jun 2015 20:39:06 -0400 Subject: Add timer for subtasks and remove settings for subtask time tracking --- app/Controller/Config.php | 2 +- app/Controller/Subtask.php | 2 +- app/Controller/Timer.php | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 app/Controller/Timer.php (limited to 'app/Controller') diff --git a/app/Controller/Config.php b/app/Controller/Config.php index fbd374ab..19bc2767 100644 --- a/app/Controller/Config.php +++ b/app/Controller/Config.php @@ -42,7 +42,7 @@ class Config extends Base switch ($redirect) { case 'project': - $values += array('subtask_restriction' => 0, 'subtask_time_tracking' => 0); + $values += array('subtask_restriction' => 0); break; case 'integrations': $values += array('integration_slack_webhook' => 0, 'integration_hipchat' => 0, 'integration_gravatar' => 0, 'integration_jabber' => 0); diff --git a/app/Controller/Subtask.php b/app/Controller/Subtask.php index 5baa6004..6ee94333 100644 --- a/app/Controller/Subtask.php +++ b/app/Controller/Subtask.php @@ -256,7 +256,7 @@ class Subtask extends Base case 'dashboard': $this->response->redirect($this->helper->url->to('app', 'index')); default: - $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']))); + $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])).'#subtasks'); } } 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 @@ +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'); + } +} -- cgit v1.2.3