Example #1
0
 function _arrangeCategories($categories, $rootId)
 {
     $arrangedCategories = array();
     foreach ($categories as $c) {
         $cat = new JWFCategoryHandler();
         $cat->setChildren(array());
         $cat->setTitle($c->cat_name);
         $cat->setId($c->id);
         $cat->setParentId(0);
     }
     return $arrangedCategories;
 }
Example #2
0
 function _getChildren($category, &$categories)
 {
     $children = array();
     for ($i = 0; $i < count($categories); $i++) {
         $c = $categories[$i];
         $cat = new JWFCategoryHandler();
         $cat->setTitle($c->title);
         $cat->setId($c->id);
         $cat->setParentId($c->parent_id);
         if ($c->parent_id == $category->getId()) {
             $cat->setChildren($this->_getChildren($cat, $categories));
             $children[] = $cat;
         }
     }
     return $children;
 }