diff options
Diffstat (limited to 'app/Export/TaskExport.php')
-rw-r--r-- | app/Export/TaskExport.php | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/app/Export/TaskExport.php b/app/Export/TaskExport.php index f47cd082..f0685576 100644 --- a/app/Export/TaskExport.php +++ b/app/Export/TaskExport.php @@ -30,11 +30,13 @@ class TaskExport extends Base public function export($project_id, $from, $to) { $tasks = $this->getTasks($project_id, $from, $to); + $taskIds = array_column($tasks, 'id'); + $tags = $this->taskTagModel->getTagsByTaskIds($taskIds); $colors = $this->colorModel->getList(); $results = array($this->getColumns()); foreach ($tasks as &$task) { - $task = $this->format($task, $colors); + $task = $this->format($task, $colors, $tags); $results[] = array_values($task); } @@ -83,7 +85,8 @@ class TaskExport extends Base TaskModel::TABLE . '.date_completed', TaskModel::TABLE . '.date_started', TaskModel::TABLE . '.time_estimated', - TaskModel::TABLE . '.time_spent' + TaskModel::TABLE . '.time_spent', + TaskModel::TABLE . '.priority' ) ->join(UserModel::TABLE, 'id', 'owner_id', TaskModel::TABLE) ->left(UserModel::TABLE, 'uc', 'id', TaskModel::TABLE, 'creator_id') @@ -103,14 +106,16 @@ class TaskExport extends Base * * @access protected * @param array $task - * @param array $colors + * @param array $colors + * @param array $tags * @return array */ - protected function format(array &$task, array $colors) + protected function format(array &$task, array $colors, array &$tags) { $task['is_active'] = $task['is_active'] == TaskModel::STATUS_OPEN ? e('Open') : e('Closed'); $task['color_id'] = $colors[$task['color_id']]; $task['score'] = $task['score'] ?: 0; + $task['tags'] = ''; $task = $this->dateParser->format( $task, @@ -118,6 +123,11 @@ class TaskExport extends Base $this->dateParser->getUserDateTimeFormat() ); + if (isset($tags[$task['id']])) { + $taskTags = array_column($tags[$task['id']], 'name'); + $task['tags'] = implode(', ', $taskTags); + } + return $task; } @@ -152,6 +162,8 @@ class TaskExport extends Base e('Start date'), e('Time estimated'), e('Time spent'), + e('Priority'), + e('Tags'), ); } } |