summaryrefslogtreecommitdiff
path: root/app/Formatter
diff options
context:
space:
mode:
Diffstat (limited to 'app/Formatter')
-rw-r--r--app/Formatter/TaskListProjectFormatter.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/app/Formatter/TaskListProjectFormatter.php b/app/Formatter/TaskListProjectFormatter.php
new file mode 100644
index 00000000..109e9a2d
--- /dev/null
+++ b/app/Formatter/TaskListProjectFormatter.php
@@ -0,0 +1,30 @@
+<?php
+
+namespace Kanboard\Formatter;
+
+use Kanboard\Formatter\TaskListFormatter;
+
+/**
+ * Class TaskListProjectFormatter
+ *
+ * @package Kanboard\Formatter
+ */
+class TaskListProjectFormatter extends TaskListFormatter
+{
+ /**
+ * Apply formatter
+ *
+ * @access public
+ * @return array
+ */
+ public function format()
+ {
+ $tasks = parent::format();
+ $prev = NULL;
+ foreach ($tasks as &$task) {
+ $task['render_project_name'] = (!$prev || $prev['project_name'] != $task['project_name']);
+ $prev = $task;
+ }
+ return $tasks;
+ }
+}