示例#1
0
 /** 
  * Return name of cat 
  * @return string name of cat
  */
 public function get_name($id)
 {
     // Creating instance of model and fetching data
     $cats = new Cat_Model();
     $data = $cats->get_one($id);
     if (!isset($data['name'])) {
         return NULL;
     } else {
         return $data['name'];
     }
 }
示例#2
0
 /**
  * Return ID of all cats
  * @return array
  */
 public function get_all_cats()
 {
     $cat = new Cat_Model();
     $root = $cat->get_all(0);
     //get all on root level
     $all_cats[] = '';
     foreach ($root as $row) {
         $temp = self::get_all_cats_in_depth($row['id']);
         $all_cats = array_merge($all_cats, $temp);
         unset($temp);
     }
     return array_filter($all_cats);
     // also filter empty values
 }