summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/Model/Swimlane.php21
-rw-r--r--app/Model/TaskExport.php12
2 files changed, 30 insertions, 3 deletions
diff --git a/app/Model/Swimlane.php b/app/Model/Swimlane.php
index c9c080af..069f14b6 100644
--- a/app/Model/Swimlane.php
+++ b/app/Model/Swimlane.php
@@ -157,6 +157,27 @@ class Swimlane extends Base
}
/**
+ * Get list of all swimlanes
+ *
+ * @access public
+ * @param integer $project_id Project id
+ * @return array
+ */
+ public function getSwimlanesList($project_id)
+ {
+ $swimlanes = $this->db->table(self::TABLE)
+ ->eq('project_id', $project_id)
+ ->orderBy('position', 'asc')
+ ->listing('id', 'name');
+
+ $swimlanes[0] = $this->db->table(Project::TABLE)
+ ->eq('id', $project_id)
+ ->findOneColumn('default_swimlane');
+
+ return $swimlanes;
+ }
+
+ /**
* Add a new swimlane
*
* @access public
diff --git a/app/Model/TaskExport.php b/app/Model/TaskExport.php
index fc581a3c..13a1eddd 100644
--- a/app/Model/TaskExport.php
+++ b/app/Model/TaskExport.php
@@ -24,10 +24,11 @@ class TaskExport extends Base
public function export($project_id, $from, $to)
{
$tasks = $this->getTasks($project_id, $from, $to);
+ $swimlanes = $this->swimlane->getSwimlanesList($project_id);
$results = array($this->getColumns());
foreach ($tasks as &$task) {
- $results[] = array_values($this->format($task));
+ $results[] = array_values($this->format($task, $swimlanes));
}
return $results;
@@ -50,6 +51,7 @@ class TaskExport extends Base
projects.name AS project_name,
tasks.is_active,
project_has_categories.name AS category_name,
+ tasks.swimlane_id,
columns.title AS column_title,
tasks.position,
tasks.color_id,
@@ -89,15 +91,18 @@ class TaskExport extends Base
* Format the output of a task array
*
* @access public
- * @param array $task Task properties
+ * @param array $task Task properties
+ * @param array $swimlanes List of swimlanes
* @return array
*/
- public function format(array &$task)
+ public function format(array &$task, array &$swimlanes)
{
$colors = $this->color->getList();
$task['is_active'] = $task['is_active'] == Task::STATUS_OPEN ? e('Open') : e('Closed');
$task['color_id'] = $colors[$task['color_id']];
+ $task['score'] = $task['score'] ?: 0;
+ $task['swimlane_id'] = isset($swimlanes[$task['swimlane_id']]) ? $swimlanes[$task['swimlane_id']] : '?';
$this->dateParser->format($task, array('date_due', 'date_modification', 'date_creation', 'date_started', 'date_completed'), 'Y-m-d');
@@ -117,6 +122,7 @@ class TaskExport extends Base
e('Project'),
e('Status'),
e('Category'),
+ e('Swimlane'),
e('Column'),
e('Position'),
e('Color'),