summaryrefslogtreecommitdiff
path: root/app/Formatter
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2017-02-26 16:06:09 -0500
committerFrederic Guillot <fred@kanboard.net>2017-02-26 16:06:09 -0500
commit4f325193be4f16a9658258fecd525e71917156a0 (patch)
tree898aaf4f18bfa9b2b3a09dbb8f54413154b1d357 /app/Formatter
parent4a87fb34ba0a88303282923a73a8fef83d7aada3 (diff)
Add class SubtaskListFormatter
Diffstat (limited to 'app/Formatter')
-rw-r--r--app/Formatter/SubtaskListFormatter.php34
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;
+ }
+}