Added support for fetching categories list
[speedfreak] / Server / application / models / category.php
1 <?php defined('SYSPATH') or die('No direct script access.');
2 /*
3  * Categories model for creating and manipulating categories
4  *
5  * @author      Artem Daniliants <artem@daniliants.com>
6  * @copyright   (c) 2010 Speed Freak team
7  * @license     http://opensource.org/licenses/gpl-license.php GNU Public License
8  */
9
10 class Category_Model extends Model {
11
12     public function __construct(){
13
14         // load database library into $this->db
15         parent::__construct();
16     }
17
18     /*
19      * Fetch all categories
20      *
21      * @return object|bool Returns object containing results if everything is ok and false otherwise
22      */
23     public function get_all(){
24         $results = $this->db->query("SELECT slug,description,unit FROM categories");
25         if ($results->count()>0)
26             return $results;
27         else
28             return false;
29     }
30
31 }