Example #1
0
 /**
  * Build tree-like array for the category
  * Categories that have children can be selected
  * @static
  * @param Category $elem the category for which builds array
  * @param integer $i nesting level
  * @return string[]
  */
 private static function GetChildrenForTreeArrayLeafCanSelected($elem, $i)
 {
     $res = array();
     $roots = $elem->children()->findAll();
     foreach ($roots as $root) {
         $res[$root->id] = $root->GetStringName();
         if (!$root->isLeaf()) {
             $res = $res + Category::GetChildrenForTreeArrayLeafCanSelected($root, $i + 1);
         }
     }
     return $res;
 }