/**
 * Print a single menu link.
 * @param string $uid Menu identifier
 * @param string $text Override link text
 * @param string $classes class="$classes"
 * @param string $intag e.g. 'target="_blank"'
 */
function print_menu_link($uid, $text = null, $classes = null, $intag = null)
{
    if (!($menu = get_menu_entry($uid))) {
        return null;
    }
    echo HTML::a($menu->url, $text ? $text : $menu->name, $menu->get('title', $menu->name), $classes, $intag);
}
Exemple #2
0
function page_sub_menu()
{
    echo '<table style="width: 98.9%; margin-left: 10px; margin-right: 10px;" border="0" cellspacing="0" cellpadding="0">';
    echo '<tr>';
    global $menu;
    global $html_dir;
    $menu2 = $menu;
    // bug in php 5.1.6 (redhat 5.2)
    $position = get_menu_entry();
    $parent = $menu2[$position]['parent'];
    if (is_array($parent)) {
        if (count($parent) > 0) {
            $parent = $parent[0];
        } else {
            $parent = NULL;
        }
    }
    if (!is_null($parent)) {
        if ($html_dir === 'ltr') {
            echo '<td style="width: 150px; text-align: center; vertical-align: top; background: url(\'' . ROOT_ADMIN_URL . '/media/image/submenu_bg.png\') repeat-y right;">';
        } else {
            echo '<td style="width: 150px; text-align: center; vertical-align: top; background: url(\'' . ROOT_ADMIN_URL . '/media/image/submenu_bg.png\') repeat-y left;">';
        }
        foreach ($menu2 as $id => $entrie) {
            if (is_array($entrie['parent'])) {
                if (!in_array($parent, $entrie['parent'])) {
                    continue;
                }
            } else {
                if ($parent != $entrie['parent']) {
                    continue;
                }
            }
            if ($id == $position) {
                if ($html_dir === 'ltr') {
                    echo '<div class="container" style="background: #fff; border-top: 1px solid #ccc; border-left: 1px solid #ccc; border-bottom: 1px solid #ccc;">';
                } else {
                    echo '<div class="container" style="background: #fff; border-top: 1px solid #ccc; border-right: 1px solid #ccc; border-bottom: 1px solid #ccc;">';
                }
            } else {
                echo '<div class="container">';
            }
            echo '<a href="' . ROOT_ADMIN_URL . '/' . $entrie['page'] . '">' . $entrie['name'] . '</a>';
            echo '</div>';
        }
        echo '</td>';
    }
    if ($html_dir === 'ltr') {
        echo '<td style="text-align: inherit; vertical-align: top; background: #fff; border-top: 1px solid  #ccc; border-right: 1px solid  #ccc; border-bottom: 1px solid  #ccc;';
        if (is_null($parent)) {
            echo ' border-left: 1px solid #ccc;';
        }
    } else {
        echo '<td style="text-align: inherit; vertical-align: top; background: #fff; border-top: 1px solid  #ccc; border-left: 1px solid  #ccc; border-bottom: 1px solid  #ccc;';
        if (is_null($parent)) {
            echo ' border-right: 1px solid #ccc;';
        }
    }
    echo '">';
    echo '<div class="container">';
}
function print_title($uid)
{
    $menuEntry = get_menu_entry($uid);
    echo "<h1>" . HTML::a($menuEntry->url, $menuEntry->name, $menuEntry->get('description')) . "</h1>\n";
}