Exemple #1
0
 /**
  * Print all categories on root level
  * @return void
  */
 public function block_cats($selected = NULL)
 {
     // Creating instance of model and fetching data
     $cats = new Cat_Model();
     $data = $cats->get_all(0);
     // View
     $template = new View('block_cats');
     $template->data = $data;
     $template->render(TRUE);
 }
Exemple #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
 }