summaryrefslogtreecommitdiff
path: root/app/Model/TaskFinder.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/Model/TaskFinder.php')
-rw-r--r--app/Model/TaskFinder.php37
1 files changed, 37 insertions, 0 deletions
diff --git a/app/Model/TaskFinder.php b/app/Model/TaskFinder.php
index 6cf79d1f..b98e3bd5 100644
--- a/app/Model/TaskFinder.php
+++ b/app/Model/TaskFinder.php
@@ -13,6 +13,43 @@ use PDO;
class TaskFinder extends Base
{
/**
+ * Get query for project user overview
+ *
+ * @access public
+ * @param array $project_ids
+ * @param integer $is_active
+ * @return \PicoDb\Table
+ */
+ public function getProjectUserOverviewQuery(array $project_ids, $is_active)
+ {
+ if (empty($project_ids)) {
+ $project_ids = array(-1);
+ }
+
+ return $this->db
+ ->table(Task::TABLE)
+ ->columns(
+ Task::TABLE.'.id',
+ Task::TABLE.'.title',
+ Task::TABLE.'.date_due',
+ Task::TABLE.'.date_started',
+ Task::TABLE.'.project_id',
+ Task::TABLE.'.color_id',
+ Task::TABLE.'.time_spent',
+ Task::TABLE.'.time_estimated',
+ Project::TABLE.'.name AS project_name',
+ Board::TABLE.'.title AS column_name',
+ User::TABLE.'.username AS assignee_username',
+ User::TABLE.'.name AS assignee_name'
+ )
+ ->eq(Task::TABLE.'.is_active', $is_active)
+ ->in(Project::TABLE.'.id', $project_ids)
+ ->join(Project::TABLE, 'id', 'project_id')
+ ->join(Board::TABLE, 'id', 'column_id', Task::TABLE)
+ ->join(User::TABLE, 'id', 'owner_id', Task::TABLE);
+ }
+
+ /**
* Get query for assigned user tasks
*
* @access public