Ejemplo n.º 1
0
function print_menu_sections(&$menu, $parent_content_id = 0, $depth = 0, $ordering = '')
{
    $my_children = $menu[$parent_content_id];
    $cid = $_GET['cid'];
    if (!is_array($my_children)) {
        return;
    }
    foreach ($my_children as $children) {
        echo '<option value="' . $children['content_id'] . '"';
        if ($cid == $children['content_id']) {
            echo ' selected="selected"';
        }
        echo '>';
        echo str_pad('', $depth, '-') . ' ';
        if ($parent_content_id == 0) {
            $new_ordering = $children['ordering'];
            echo $children['ordering'];
        } else {
            $new_ordering = $ordering . '.' . $children['ordering'];
            echo $ordering . '.' . $children['ordering'];
        }
        echo ' ' . $children['title'] . '</option>';
        print_menu_sections($menu, $children['content_id'], $depth + 1, $new_ordering);
    }
}
Ejemplo n.º 2
0
function print_menu_sections(&$menu, $only_print_content_folder = false, $parent_content_id = 0, $depth = 0, $ordering = '')
{
    global $len_of_title_to_display;
    $my_children = $menu[$parent_content_id];
    $cid = $_GET['cid'];
    if (!is_array($my_children)) {
        return;
    }
    foreach ($my_children as $children) {
        /* test content association, we don't want to display the test pages
         * as part of the menu section.  If test, skip it.
         */
        if (isset($children['test_id'])) {
            continue;
        }
        if ($only_print_content_folder && $children['content_type'] != CONTENT_TYPE_FOLDER) {
            continue;
        }
        echo '<option value="' . $children['content_id'] . '"';
        if ($cid == $children['content_id']) {
            echo ' selected="selected"';
        }
        echo '>';
        echo str_pad('', $depth, '-') . ' ';
        if ($parent_content_id == 0) {
            $new_ordering = $children['ordering'];
            echo $children['ordering'];
        } else {
            $new_ordering = $ordering . '.' . $children['ordering'];
            echo $ordering . '.' . $children['ordering'];
        }
        if (strlen($children['title']) > $len_of_title_to_display) {
            $title = substr($children['title'], 0, $len_of_title_to_display) . ' ...';
        } else {
            $title = $children['title'];
        }
        echo ' ' . $title . '</option>';
        print_menu_sections($menu, $only_print_content_folder, $children['content_id'], $depth + 1, $new_ordering);
    }
}