From efbf679385773e76cbb436691f63e931c17172d4 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Tue, 10 Feb 2015 22:10:32 -0500 Subject: Add subtask time tracking in the task view --- app/Model/SubtaskTimeTracking.php | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'app/Model') diff --git a/app/Model/SubtaskTimeTracking.php b/app/Model/SubtaskTimeTracking.php index 5b58dfe2..8093cf80 100644 --- a/app/Model/SubtaskTimeTracking.php +++ b/app/Model/SubtaskTimeTracking.php @@ -43,6 +43,35 @@ class SubtaskTimeTracking extends Base ->eq(self::TABLE.'.user_id', $user_id); } + /** + * Get query for task (pagination) + * + * @access public + * @param integer $task_id Task id + * @return \PicoDb\Table + */ + public function getTaskQuery($task_id) + { + return $this->db + ->table(self::TABLE) + ->columns( + self::TABLE.'.id', + self::TABLE.'.subtask_id', + self::TABLE.'.end', + self::TABLE.'.start', + self::TABLE.'.user_id', + Subtask::TABLE.'.task_id', + Subtask::TABLE.'.title AS subtask_title', + Task::TABLE.'.project_id', + User::TABLE.'.username', + User::TABLE.'.name AS user_fullname' + ) + ->join(Subtask::TABLE, 'id', 'subtask_id') + ->join(Task::TABLE, 'id', 'task_id', Subtask::TABLE) + ->join(User::TABLE, 'id', 'user_id', self::TABLE) + ->eq(Task::TABLE.'.id', $task_id); + } + /** * Get all recorded time slots for a given user * -- cgit v1.2.3