diff options
Diffstat (limited to 'app/Formatter')
-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; + } +} |