diff options
author | Frédéric Guillot <fred@kanboard.net> | 2014-11-11 21:52:22 -0500 |
---|---|---|
committer | Frédéric Guillot <fred@kanboard.net> | 2014-11-11 21:52:22 -0500 |
commit | 5ca9a12a0ac64dccded3f8ebae16c00f91a49455 (patch) | |
tree | 78b450fd849a9a0ddaa3ecc181fc1b8e3a27ada0 /app | |
parent | 7a5b78dbc6c3ad896bd07ad19aa8c9cb8fec11ac (diff) |
Add subtasks to the dashboard
Diffstat (limited to 'app')
-rw-r--r-- | app/Controller/App.php | 2 | ||||
-rw-r--r-- | app/Locale/da_DK/translations.php | 2 | ||||
-rw-r--r-- | app/Locale/de_DE/translations.php | 2 | ||||
-rw-r--r-- | app/Locale/es_ES/translations.php | 2 | ||||
-rw-r--r-- | app/Locale/fi_FI/translations.php | 2 | ||||
-rw-r--r-- | app/Locale/fr_FR/translations.php | 2 | ||||
-rw-r--r-- | app/Locale/it_IT/translations.php | 2 | ||||
-rw-r--r-- | app/Locale/ja_JP/translations.php | 2 | ||||
-rw-r--r-- | app/Locale/pl_PL/translations.php | 2 | ||||
-rw-r--r-- | app/Locale/pt_BR/translations.php | 2 | ||||
-rw-r--r-- | app/Locale/ru_RU/translations.php | 2 | ||||
-rw-r--r-- | app/Locale/sv_SE/translations.php | 2 | ||||
-rw-r--r-- | app/Locale/th_TH/translations.php | 2 | ||||
-rw-r--r-- | app/Locale/zh_CN/translations.php | 2 | ||||
-rw-r--r-- | app/Model/SubTask.php | 32 | ||||
-rw-r--r-- | app/Template/app/index.php | 31 |
16 files changed, 91 insertions, 0 deletions
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 @@ -93,6 +93,38 @@ class SubTask extends Base } /** + * 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 * * @access public 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 @@ <?php endforeach ?> </table> <?php endif ?> + + <h2><?= t('My subtasks') ?></h2> + <?php if (empty($subtasks)): ?> + <p class="alert"><?= t('There is nothing assigned to you.') ?></p> + <?php else: ?> + <table class="table-fixed"> + <tr> + <th class="column-8"> </th> + <th class="column-20"><?= t('Project') ?></th> + <th class="column-15"><?= t('Status') ?></th> + <th><?= t('Subtask') ?></th> + </tr> + <?php foreach ($subtasks as $subtask): ?> + <tr> + <td class="task-table task-<?= $subtask['color_id'] ?>"> + <?= Helper\a('#'.$subtask['task_id'], 'task', 'show', array('task_id' => $subtask['task_id'])) ?> + </td> + <td> + <?= Helper\a(Helper\escape($subtask['project_name']), 'board', 'show', array('project_id' => $subtask['project_id'])) ?> + </td> + <td> + <?= Helper\escape($subtask['status_name']) ?> + </td> + <td> + <?= Helper\a(Helper\escape($subtask['title']), 'task', 'show', array('task_id' => $subtask['task_id'])) ?> + </td> + </tr> + <?php endforeach ?> + </table> + <?php endif ?> + </div> <div class="dashboard-right-column"> <h2><?= t('Activity stream') ?></h2> |