diff options
author | Frédéric Guillot <fguillot@users.noreply.github.com> | 2014-04-21 22:44:25 -0400 |
---|---|---|
committer | Frédéric Guillot <fguillot@users.noreply.github.com> | 2014-04-21 22:44:25 -0400 |
commit | 919e5d51a4cc4a2928cd34c8c575d4c003bb9a74 (patch) | |
tree | acc8c0312f8efe6d32dd97355754b663c7b383e7 /models/board.php | |
parent | 9bfd824ab724dc2eb356e06b1722f843dbd8d96d (diff) |
Add a method to apply filters for tasks
Diffstat (limited to 'models/board.php')
-rw-r--r-- | models/board.php | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/models/board.php b/models/board.php index 3bff8d56..af1f4f7a 100644 --- a/models/board.php +++ b/models/board.php @@ -181,10 +181,24 @@ class Board extends Base $this->db->startTransaction(); $columns = $this->getColumns($project_id); + + $filters = array( + array('column' => 'project_id', 'operator' => 'eq', 'value' => $project_id), + array('column' => 'is_active', 'operator' => 'eq', 'value' => Task::STATUS_OPEN), + ); + $taskModel = new Task($this->db, $this->event); + $tasks = $taskModel->find($filters); foreach ($columns as &$column) { - $column['tasks'] = $taskModel->getAllByColumnId($project_id, $column['id'], array(1)); + + $column['tasks'] = array(); + + foreach ($tasks as &$task) { + if ($task['column_id'] == $column['id']) { + $column['tasks'][] = $task; + } + } } $this->db->closeTransaction(); |