Exemple #1
0
 /**
  * Return array with ID of cat and all of its subcats and their subcats...
  * @return array with all subcats (to infinity depth)
  * @param object $id
  */
 public function get_all_cats_in_depth($id)
 {
     $cat = new Cat_Model();
     // FIXME: Test if self:: is enough
     $all_cats[] = $id;
     if ($cat->has_child($id)) {
         $children = $cat->get_children($id);
         foreach ($children as $child) {
             $temp = self::get_all_cats_in_depth($child['id']);
             //recursion
             $all_cats = array_merge($all_cats, $temp);
             unset($temp);
         }
         unset($children);
     }
     return $all_cats;
 }