From d3727e92a6000a01fb962e559f8e6b936def1fb9 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 11 Apr 2015 16:26:45 -0400 Subject: Add category description (merge and modify pull-request #692) --- app/Model/Category.php | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'app/Model') 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 @@ -73,6 +73,38 @@ class Category extends Base ->findOneColumn('id'); } + /** + * 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 * -- cgit v1.2.3