diff options
author | Frederic Guillot <fred@kanboard.net> | 2017-02-26 16:06:09 -0500 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2017-02-26 16:06:09 -0500 |
commit | 4f325193be4f16a9658258fecd525e71917156a0 (patch) | |
tree | 898aaf4f18bfa9b2b3a09dbb8f54413154b1d357 /app/Formatter/SubtaskListFormatter.php | |
parent | 4a87fb34ba0a88303282923a73a8fef83d7aada3 (diff) |
Add class SubtaskListFormatter
Diffstat (limited to 'app/Formatter/SubtaskListFormatter.php')
-rw-r--r-- | app/Formatter/SubtaskListFormatter.php | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/app/Formatter/SubtaskListFormatter.php b/app/Formatter/SubtaskListFormatter.php new file mode 100644 index 00000000..5b20111d --- /dev/null +++ b/app/Formatter/SubtaskListFormatter.php @@ -0,0 +1,34 @@ +<?php + +namespace Kanboard\Formatter; + +use Kanboard\Core\Filter\FormatterInterface; + +/** + * Class SubtaskListFormatter + * + * @package Kanboard\Formatter + * @author Frederic Guillot + */ +class SubtaskListFormatter extends BaseFormatter implements FormatterInterface +{ + /** + * Apply formatter + * + * @access public + * @return mixed + */ + public function format() + { + $status = $this->subtaskModel->getStatusList(); + $subtasks = $this->query->findAll(); + + foreach ($subtasks as &$subtask) { + $subtask['status_name'] = $status[$subtask['status']]; + $subtask['timer_start_date'] = isset($subtask['timer_start_date']) ? $subtask['timer_start_date'] : 0; + $subtask['is_timer_started'] = ! empty($subtask['timer_start_date']); + } + + return $subtasks; + } +} |