summaryrefslogtreecommitdiff
path: root/app/Formatter/TaskListProjectFormatter.php
diff options
context:
space:
mode:
authorDzial Techniczny WMW Projekt s.c <techniczna@wmwprojekt.pl>2020-04-08 14:01:28 +0200
committerDzial Techniczny WMW Projekt s.c <techniczna@wmwprojekt.pl>2020-04-08 14:01:28 +0200
commit0dfe48b7fa475aade00a8ccf42e3dba99dfa3702 (patch)
tree92d34a659a841c4d0036fa5ef23b2f2b425c4b4e /app/Formatter/TaskListProjectFormatter.php
parenteca069dbd1318274b4170eb78629b0128dd0543c (diff)
"My tasks" view grops tasks by project - fixes #107
Diffstat (limited to 'app/Formatter/TaskListProjectFormatter.php')
-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;
+ }
+}