Пример #1
0
function deepchildids($rows, $root_id)
{
    static $childids = '';
    $childs = findChild($rows, $root_id);
    if (empty($childs)) {
        return null;
    }
    foreach ($childs as $k => $v) {
        deepchildids($rows, $v['id']);
        $childids .= $v['id'] . ',';
    }
    return $childids;
}
Пример #2
0
 /**
  * Checks if node has another node as child
  * @param HTML_Node $child
  * @return bool
  */
 function hasChild($child)
 {
     return (bool) findChild($child);
 }
Пример #3
0
function build_tree($root_id, $rows)
{
    $childs = findChild($rows, $root_id);
    if (empty($childs)) {
        return null;
    }
    foreach ($childs as $k => $v) {
        $rescurTree = build_tree($v['id'], $rows);
        if (null != $rescurTree) {
            $childs[$k]['childs'] = $rescurTree;
        }
    }
    return $childs;
}