summaryrefslogtreecommitdiff
path: root/app/Model
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2017-02-26 19:30:02 -0500
committerFrederic Guillot <fred@kanboard.net>2017-02-26 19:30:02 -0500
commitf3deb6492a74f1ffa9e3391274e0ab7947a04016 (patch)
treecbf7a3563cf1543bd131dd114f8dc89afdf5328f /app/Model
parent4f325193be4f16a9658258fecd525e71917156a0 (diff)
Add toggle button to show/hide subtasks in task list view
Diffstat (limited to 'app/Model')
-rw-r--r--app/Model/SubtaskModel.php17
-rw-r--r--app/Model/TaskTagModel.php3
2 files changed, 19 insertions, 1 deletions
diff --git a/app/Model/SubtaskModel.php b/app/Model/SubtaskModel.php
index af9af93b..c62ddb53 100644
--- a/app/Model/SubtaskModel.php
+++ b/app/Model/SubtaskModel.php
@@ -132,6 +132,23 @@ class SubtaskModel extends Base
}
/**
+ * Get subtasks for a list of tasks
+ *
+ * @param array $taskIds
+ * @return array
+ */
+ public function getAllByTaskIds(array $taskIds)
+ {
+ if (empty($taskIds)) {
+ return array();
+ }
+
+ return $this->subtaskListFormatter
+ ->withQuery($this->getQuery()->in('task_id', $taskIds))
+ ->format();
+ }
+
+ /**
* Get a subtask by the id
*
* @access public
diff --git a/app/Model/TaskTagModel.php b/app/Model/TaskTagModel.php
index 0553cc6c..78b7a90a 100644
--- a/app/Model/TaskTagModel.php
+++ b/app/Model/TaskTagModel.php
@@ -59,7 +59,7 @@ class TaskTagModel extends Base
* @param integer[] $task_ids
* @return array
*/
- public function getTagsByTasks($task_ids)
+ public function getTagsByTaskIds($task_ids)
{
if (empty($task_ids)) {
return array();
@@ -69,6 +69,7 @@ class TaskTagModel extends Base
->columns(TagModel::TABLE.'.id', TagModel::TABLE.'.name', self::TABLE.'.task_id')
->in(self::TABLE.'.task_id', $task_ids)
->join(self::TABLE, 'tag_id', 'id')
+ ->asc(TagModel::TABLE.'.name')
->findAll();
return array_column_index($tags, 'task_id');