function drawTree($tree, $tag = 'ul')
{
    echo "<{$tag}>";
    foreach ($tree as $node) {
        drawNode($node);
    }
    echo "</{$tag}>";
}
Ejemplo n.º 2
0
/**
 * Draw the ChildNOdes of the MenuNode which is passed and the menunode itself..
 * Calls drawNode for alle the ChildNOdes then.
 *
 * @param MenuObject $node
 * @param boolean		 $commented
 */
function drawNode($node, $commented)
{
    global $cds;
    echo "<li>";
    //Draw the link
    echo $cds->layout->menu->getLink($node);
    if ($commented) {
        $desc = $node->getDescription();
        if (strlen($desc) > 0) {
            br();
            echo $desc;
        }
    }
    // query for childnodes
    if ($node->hasLowerLevel()) {
        echo '<ul>';
        $childs = $node->lowerLevel();
        for ($i = 0; $i < count($childs); $i++) {
            drawNode($childs[$i], $commented);
        }
        echo '</ul>';
    }
    echo "</li>";
}