summaryrefslogtreecommitdiff
path: root/app/Model
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-04-11 16:26:45 -0400
committerFrederic Guillot <fred@kanboard.net>2015-04-11 16:26:45 -0400
commitd3727e92a6000a01fb962e559f8e6b936def1fb9 (patch)
tree23a12c7c7db5644f0a938eb0d4bed2c81d811a61 /app/Model
parent52bc2efc65af690b075d58dcff23eac97d1a0495 (diff)
Add category description (merge and modify pull-request #692)
Diffstat (limited to 'app/Model')
-rw-r--r--app/Model/Category.php32
1 files changed, 32 insertions, 0 deletions
diff --git a/app/Model/Category.php b/app/Model/Category.php
index 1c8ba96f..c8ba7251 100644
--- a/app/Model/Category.php
+++ b/app/Model/Category.php
@@ -74,6 +74,38 @@ class Category extends Base
}
/**
+ * Prepare categories to be displayed on the board
+ *
+ * @access public
+ * @param integer $project_id
+ * @return array
+ */
+ public function getBoardCategories($project_id)
+ {
+ $descriptions = array();
+
+ $listing = array(
+ -1 => t('All categories'),
+ 0 => t('No category'),
+ );
+
+ $categories = $this->db->table(self::TABLE)
+ ->eq('project_id', $project_id)
+ ->asc('name')
+ ->findAll();
+
+ foreach ($categories as $category) {
+ $listing[$category['id']] = $category['name'];
+ $descriptions[$category['id']] = $category['description'];
+ }
+
+ return array(
+ $listing,
+ $descriptions,
+ );
+ }
+
+ /**
* Return the list of all categories
*
* @access public