コード例 #1
0
ファイル: navbar.inc.php プロジェクト: HaakonME/porticoestate
function render_item($item, $id = '', $children = '')
{
    $icon_style = $expand_class = $current_class = $link_class = $parent_class = '';
    static $blank_image;
    if (!isset($blank_image)) {
        $blank_image = $GLOBALS['phpgw']->common->find_image('phpgwapi', 'blank.png');
    }
    if (isset($item['image'])) {
        $icon_style = ' style="background-image: url(' . $GLOBALS['phpgw']->common->image($item['image'][0], $item['image'][1]) . ')"';
    }
    if ($children) {
        $expand_class = item_expanded($id) ? ' class="expanded"' : ' class="collapsed"';
        $parent_class = ' parent';
    }
    if ($id == "navbar::{$GLOBALS['phpgw_info']['flags']['menu_selection']}") {
        $current_class = 'current';
    }
    $link_class = " class=\"{$current_class}{$parent_class}\"";
    $out = <<<HTML
\t\t\t\t<li{$expand_class}>

HTML;
    if ($expand_class) {
        $out .= <<<HTML
\t\t\t\t\t\t\t<img src="{$blank_image}"{$expand_class}width="16" height="16" alt="+/-" />

HTML;
    }
    return <<<HTML
{$out}
\t\t\t\t\t<a href="{$item['url']}"{$link_class}{$icon_style} id="{$id}">
\t\t\t\t\t\t<span>{$item['text']}</span>
\t\t\t\t\t</a>
{$children}
\t\t\t\t</li>

HTML;
}
コード例 #2
0
ファイル: navbar.inc.php プロジェクト: HaakonME/porticoestate
function render_item($item, $id = '', $children = '')
{
    $icon_style = $expand_class = $current_class = $link_class = $parent_class = '';
    static $blank_image;
    static $images = array();
    // cache
    if (!isset($blank_image)) {
        $blank_image = $GLOBALS['phpgw']->common->find_image('phpgwapi', 'blank.png');
    }
    if (isset($item['image'])) {
        if (!isset($images[$item['image'][0]][$item['image'][1]])) {
            $icon = $GLOBALS['phpgw']->common->image($item['image'][0], $item['image'][1]);
            if (!$icon) {
                $icon = $GLOBALS['phpgw']->common->image('phpgwapi', 'folder');
            }
            $icon_style = ' style="background-image: url(' . $icon . ')"';
            $images[$item['image'][0]][$item['image'][1]] = $icon_style;
        } else {
            $icon_style = $images[$item['image'][0]][$item['image'][1]];
        }
    } else {
        $icon = $GLOBALS['phpgw']->common->image('phpgwapi', 'folder');
        $icon_style = ' style="background-image: url(' . $icon . ')"';
        //	$images[$item['image'][0]][$item['image'][1]] = $icon_style;
    }
    if ($children) {
        $expand_class = item_expanded($id) ? ' class="expanded"' : ' class="collapsed"';
        $parent_class = ' parent';
    }
    if ($id == "navbar::{$GLOBALS['phpgw_info']['flags']['menu_selection']}") {
        $current_class = 'current';
    }
    $link_class = " class=\"{$current_class}{$parent_class}\"";
    $out = <<<HTML
\t\t\t\t<li{$expand_class}>

HTML;
    if ($expand_class) {
        $out .= <<<HTML
\t\t\t\t\t\t\t<img src="{$blank_image}"{$expand_class}width="16" height="16" alt="+/-" />

HTML;
    }
    $target = '';
    if (isset($item['target'])) {
        $target = "target = '{$item['target']}'";
    }
    if (isset($item['local_files']) && $item['local_files']) {
        $item['url'] = 'file:///' . str_replace(':', '|', $item['url']);
    }
    return <<<HTML
{$out}
\t\t\t\t\t<a href="{$item['url']}"{$link_class}{$icon_style} id="{$id}" {$target}>
\t\t\t\t\t\t<span>{$item['text']}</span>
\t\t\t\t\t</a>
{$children}
\t\t\t\t</li>

HTML;
}