From 5ca9a12a0ac64dccded3f8ebae16c00f91a49455 Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Tue, 11 Nov 2014 21:52:22 -0500 Subject: Add subtasks to the dashboard --- app/Controller/App.php | 2 ++ app/Locale/da_DK/translations.php | 2 ++ app/Locale/de_DE/translations.php | 2 ++ app/Locale/es_ES/translations.php | 2 ++ app/Locale/fi_FI/translations.php | 2 ++ app/Locale/fr_FR/translations.php | 2 ++ app/Locale/it_IT/translations.php | 2 ++ app/Locale/ja_JP/translations.php | 2 ++ app/Locale/pl_PL/translations.php | 2 ++ app/Locale/pt_BR/translations.php | 2 ++ app/Locale/ru_RU/translations.php | 2 ++ app/Locale/sv_SE/translations.php | 2 ++ app/Locale/th_TH/translations.php | 2 ++ app/Locale/zh_CN/translations.php | 2 ++ app/Model/SubTask.php | 32 ++++++++++++++++++++++++++++++++ app/Template/app/index.php | 31 +++++++++++++++++++++++++++++++ 16 files changed, 91 insertions(+) (limited to 'app') diff --git a/app/Controller/App.php b/app/Controller/App.php index 9f8ded19..993149c5 100644 --- a/app/Controller/App.php +++ b/app/Controller/App.php @@ -3,6 +3,7 @@ namespace Controller; use Model\Project as ProjectModel; +use Model\SubTask; /** * Application controller @@ -27,6 +28,7 @@ class App extends Base 'board_selector' => $this->projectPermission->getAllowedProjects($user_id), 'events' => $this->projectActivity->getProjects($project_ids, 10), 'tasks' => $this->taskFinder->getAllTasksByUser($user_id), + 'subtasks' => $this->subTask->getAllByUser($user_id, array(SubTask::STATUS_TODO, SubTask::STATUS_INPROGRESS)), 'projects' => $this->project->getSummary($project_ids), 'title' => t('Dashboard'), ))); diff --git a/app/Locale/da_DK/translations.php b/app/Locale/da_DK/translations.php index 590f2512..2cb77240 100644 --- a/app/Locale/da_DK/translations.php +++ b/app/Locale/da_DK/translations.php @@ -571,4 +571,6 @@ return array( // 'Reportings' => '', // 'Task repartition for "%s"' => '', // 'Analytics' => '', + // 'Subtask' => '', + // 'My subtasks' => '', ); diff --git a/app/Locale/de_DE/translations.php b/app/Locale/de_DE/translations.php index 807118d8..fb03b616 100644 --- a/app/Locale/de_DE/translations.php +++ b/app/Locale/de_DE/translations.php @@ -571,4 +571,6 @@ return array( // 'Reportings' => '', // 'Task repartition for "%s"' => '', // 'Analytics' => '', + // 'Subtask' => '', + // 'My subtasks' => '', ); diff --git a/app/Locale/es_ES/translations.php b/app/Locale/es_ES/translations.php index 25df8acf..c54267ff 100644 --- a/app/Locale/es_ES/translations.php +++ b/app/Locale/es_ES/translations.php @@ -571,4 +571,6 @@ return array( // 'Reportings' => '', // 'Task repartition for "%s"' => '', // 'Analytics' => '', + // 'Subtask' => '', + // 'My subtasks' => '', ); diff --git a/app/Locale/fi_FI/translations.php b/app/Locale/fi_FI/translations.php index 517430ea..59cea9f7 100644 --- a/app/Locale/fi_FI/translations.php +++ b/app/Locale/fi_FI/translations.php @@ -571,4 +571,6 @@ return array( // 'Reportings' => '', // 'Task repartition for "%s"' => '', // 'Analytics' => '', + // 'Subtask' => '', + // 'My subtasks' => '', ); diff --git a/app/Locale/fr_FR/translations.php b/app/Locale/fr_FR/translations.php index 3afa53ce..d36b0e93 100644 --- a/app/Locale/fr_FR/translations.php +++ b/app/Locale/fr_FR/translations.php @@ -571,4 +571,6 @@ return array( 'Reportings' => 'Rapports', 'Task repartition for "%s"' => 'Répartition des tâches pour « %s »', 'Analytics' => 'Analytique', + 'Subtask' => 'Sous-tâche', + 'My subtasks' => 'Mes sous-tâches', ); diff --git a/app/Locale/it_IT/translations.php b/app/Locale/it_IT/translations.php index 81ccbd86..e4f9fc8b 100644 --- a/app/Locale/it_IT/translations.php +++ b/app/Locale/it_IT/translations.php @@ -571,4 +571,6 @@ return array( // 'Reportings' => '', // 'Task repartition for "%s"' => '', // 'Analytics' => '', + // 'Subtask' => '', + // 'My subtasks' => '', ); diff --git a/app/Locale/ja_JP/translations.php b/app/Locale/ja_JP/translations.php index 2fdfb3d6..0e75fc23 100644 --- a/app/Locale/ja_JP/translations.php +++ b/app/Locale/ja_JP/translations.php @@ -571,4 +571,6 @@ return array( // 'Reportings' => '', // 'Task repartition for "%s"' => '', // 'Analytics' => '', + // 'Subtask' => '', + // 'My subtasks' => '', ); diff --git a/app/Locale/pl_PL/translations.php b/app/Locale/pl_PL/translations.php index 45253fe1..f0277429 100644 --- a/app/Locale/pl_PL/translations.php +++ b/app/Locale/pl_PL/translations.php @@ -571,4 +571,6 @@ return array( // 'Reportings' => '', // 'Task repartition for "%s"' => '', // 'Analytics' => '', + // 'Subtask' => '', + // 'My subtasks' => '', ); diff --git a/app/Locale/pt_BR/translations.php b/app/Locale/pt_BR/translations.php index 778bfd3a..fd1fc1cf 100644 --- a/app/Locale/pt_BR/translations.php +++ b/app/Locale/pt_BR/translations.php @@ -571,4 +571,6 @@ return array( // 'Reportings' => '', // 'Task repartition for "%s"' => '', // 'Analytics' => '', + // 'Subtask' => '', + // 'My subtasks' => '', ); diff --git a/app/Locale/ru_RU/translations.php b/app/Locale/ru_RU/translations.php index f2eaca63..9c486ff4 100644 --- a/app/Locale/ru_RU/translations.php +++ b/app/Locale/ru_RU/translations.php @@ -571,4 +571,6 @@ return array( // 'Reportings' => '', // 'Task repartition for "%s"' => '', // 'Analytics' => '', + // 'Subtask' => '', + // 'My subtasks' => '', ); diff --git a/app/Locale/sv_SE/translations.php b/app/Locale/sv_SE/translations.php index 4f9d815a..a56c7db5 100644 --- a/app/Locale/sv_SE/translations.php +++ b/app/Locale/sv_SE/translations.php @@ -571,4 +571,6 @@ return array( // 'Reportings' => '', // 'Task repartition for "%s"' => '', // 'Analytics' => '', + // 'Subtask' => '', + // 'My subtasks' => '', ); diff --git a/app/Locale/th_TH/translations.php b/app/Locale/th_TH/translations.php index 8a1c8b35..f2e51d12 100644 --- a/app/Locale/th_TH/translations.php +++ b/app/Locale/th_TH/translations.php @@ -571,4 +571,6 @@ return array( // 'Reportings' => '', // 'Task repartition for "%s"' => '', // 'Analytics' => '', + // 'Subtask' => '', + // 'My subtasks' => '', ); diff --git a/app/Locale/zh_CN/translations.php b/app/Locale/zh_CN/translations.php index 3d45532a..4b86a7e1 100644 --- a/app/Locale/zh_CN/translations.php +++ b/app/Locale/zh_CN/translations.php @@ -571,4 +571,6 @@ return array( // 'Reportings' => '', // 'Task repartition for "%s"' => '', // 'Analytics' => '', + // 'Subtask' => '', + // 'My subtasks' => '', ); diff --git a/app/Model/SubTask.php b/app/Model/SubTask.php index 886ad1f3..f414da7f 100644 --- a/app/Model/SubTask.php +++ b/app/Model/SubTask.php @@ -92,6 +92,38 @@ class SubTask extends Base return $subtasks; } + /** + * Get all subtasks assigned to a user + * + * @access public + * @param integer $user_id User id + * @param array $status List of status + * @return array + */ + public function getAllByUser($user_id, array $status) + { + $status_list = $this->getStatusList(); + $subtasks = $this->db->table(self::TABLE) + ->columns( + self::TABLE.'.*', + Task::TABLE.'.project_id', + Task::TABLE.'.color_id', + Project::TABLE.'.name AS project_name' + ) + ->eq('user_id', $user_id) + ->in(self::TABLE.'.status', $status) + ->join(Task::TABLE, 'id', 'task_id') + ->join(Project::TABLE, 'id', 'project_id', Task::TABLE) + ->asc(Task::TABLE.'.id') + ->findAll(); + + foreach ($subtasks as &$subtask) { + $subtask['status_name'] = $status_list[$subtask['status']]; + } + + return $subtasks; + } + /** * Get a subtask by the id * diff --git a/app/Template/app/index.php b/app/Template/app/index.php index 89550e05..637bc402 100644 --- a/app/Template/app/index.php +++ b/app/Template/app/index.php @@ -75,6 +75,37 @@ + +

+ +

+ + + + + + + + + + + + + + + + +
 
+ $subtask['task_id'])) ?> + + $subtask['project_id'])) ?> + + + + $subtask['task_id'])) ?> +
+ +

-- cgit v1.2.3