summaryrefslogtreecommitdiff
path: root/app/Model/ProjectModel.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2017-04-08 13:58:25 -0400
committerFrederic Guillot <fred@kanboard.net>2017-04-08 13:58:25 -0400
commitd7b0cfbbe57fae9afbf9637afa7e54d3bf708747 (patch)
treeced408d01329538bd34b659018a7cd11e04aa982 /app/Model/ProjectModel.php
parentfe9f3ba707d1caf9348ae17e0566eabd505fbce2 (diff)
Improve dashboard
Diffstat (limited to 'app/Model/ProjectModel.php')
-rw-r--r--app/Model/ProjectModel.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/app/Model/ProjectModel.php b/app/Model/ProjectModel.php
index cabfee8a..7f489c75 100644
--- a/app/Model/ProjectModel.php
+++ b/app/Model/ProjectModel.php
@@ -304,6 +304,27 @@ class ProjectModel extends Base
}
/**
+ * Get project summary for a list of project
+ *
+ * @access public
+ * @param array $project_ids List of project id
+ * @return \PicoDb\Table
+ */
+ public function getQueryColumnStats(array $project_ids)
+ {
+ if (empty($project_ids)) {
+ return $this->db->table(ProjectModel::TABLE)->eq(ProjectModel::TABLE.'.id', 0);
+ }
+
+ return $this->db
+ ->table(ProjectModel::TABLE)
+ ->columns(self::TABLE.'.*', UserModel::TABLE.'.username AS owner_username', UserModel::TABLE.'.name AS owner_name')
+ ->join(UserModel::TABLE, 'id', 'owner_id')
+ ->in(self::TABLE.'.id', $project_ids)
+ ->callback(array($this, 'applyColumnStats'));
+ }
+
+ /**
* Get query for list of project without column statistics
*
* @access public