Example #1
0
 /**
  * Build tree-like array for the category
  * Categories that have children cannot be selected
  * @static
  * @param Category $elem the category for which builds array
  * @return string[]
  */
 private static function GetChildrenForTreeArrayLeafCannotSelected($elem)
 {
     $res = array();
     $roots = $elem->children()->findAll();
     foreach ($roots as $root) {
         if ($root->isLeaf()) {
             $res[$root->id] = $root->name;
         } else {
             $res[$root->name] = Category::GetChildrenForTreeArrayLeafCannotSelected($root);
         }
     }
     return $res;
 }