summaryrefslogtreecommitdiff
path: root/app/Model/TaskFinder.php
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2014-10-14 22:02:35 -0400
committerFrédéric Guillot <fred@kanboard.net>2014-10-14 22:02:35 -0400
commit286b1935663ef3071ad6a0aae3078ad3a42b48e4 (patch)
tree80469612ac9feba9bea28c1ac7f263e680f52d49 /app/Model/TaskFinder.php
parentd0e6d2e1f177cfe533ea7819bf79b0469b8d0cc2 (diff)
Add a dashboard (first version)
Diffstat (limited to 'app/Model/TaskFinder.php')
-rw-r--r--app/Model/TaskFinder.php27
1 files changed, 27 insertions, 0 deletions
diff --git a/app/Model/TaskFinder.php b/app/Model/TaskFinder.php
index 5bf8c139..56795152 100644
--- a/app/Model/TaskFinder.php
+++ b/app/Model/TaskFinder.php
@@ -112,6 +112,33 @@ class TaskFinder extends Base
}
/**
+ * Get all open tasks for a given user
+ *
+ * @access public
+ * @param integer $user_id User id
+ * @return array
+ */
+ public function getAllTasksByUser($user_id)
+ {
+ return $this->db
+ ->table(Task::TABLE)
+ ->columns(
+ 'tasks.id',
+ 'tasks.title',
+ 'tasks.date_due',
+ 'tasks.date_creation',
+ 'tasks.project_id',
+ 'tasks.color_id',
+ 'projects.name AS project_name'
+ )
+ ->join(Project::TABLE, 'id', 'project_id')
+ ->eq('tasks.owner_id', $user_id)
+ ->eq('tasks.is_active', Task::STATUS_OPEN)
+ ->asc('tasks.id')
+ ->findAll();
+ }
+
+ /**
* Get all tasks for a given project and status
*
* @access public