function navbar_entry($entry, $level = 1)
{
    global $cache;
    if ($entry['divider']) {
        echo str_pad('', ($level - 1) * 2) . '                <li class="divider"></li>' . PHP_EOL;
    } elseif ($entry['locations']) {
        // Workaround until the menu builder returns an array instead of echo()
        echo str_pad('', ($level - 1) * 2) . '                <li class="dropdown-submenu">' . PHP_EOL;
        echo str_pad('', ($level - 1) * 2) . '                  <a href="' . generate_url(array('page' => 'locations')) . '"><i class="menu-icon oicon-building-hedge"></i> 位置</a>' . PHP_EOL;
        navbar_location_menu($cache['locations']);
        echo str_pad('', ($level - 1) * 2) . '                </li>' . PHP_EOL;
    } else {
        echo str_pad('', ($level - 1) * 2) . '                <li><a href="' . $entry['url'] . '"><i class="menu-icon ' . $entry['icon'] . '"></i> ';
        if (isset($entry['image'])) {
            echo '<img src="' . $entry['image'] . '" alt="" /> ';
        }
        echo $entry['title'];
        if (isset($entry['count'])) {
            echo '&nbsp;<span class="right">(' . $entry['count'] . ')</span>';
        }
        echo str_pad('', ($level - 1) * 2) . '</a></li>' . PHP_EOL;
    }
}
Esempio n. 2
0
function navbar_entry($entry, $level = 1)
{
    global $cache;
    if ($entry['divider']) {
        echo str_pad('', ($level - 1) * 2) . '                <li class="divider"></li>' . PHP_EOL;
    } elseif ($entry['locations']) {
        // Workaround until the menu builder returns an array instead of echo()
        echo str_pad('', ($level - 1) * 2) . '                <li class="dropdown-submenu">' . PHP_EOL;
        echo str_pad('', ($level - 1) * 2) . '                  ' . generate_menu_link(generate_url(array('page' => 'locations')), '<i class="menu-icon oicon-building-hedge"></i> Locations') . PHP_EOL;
        navbar_location_menu($cache['locations']);
        echo str_pad('', ($level - 1) * 2) . '                </li>' . PHP_EOL;
    } else {
        $entry_text = '<i class="menu-icon ' . $entry['icon'] . '"></i> ';
        if (isset($entry['image'])) {
            // Detect allowed screen ratio for current browser, cached!
            $ua_info = detect_browser();
            if (isset($entry['image_2x']) && $ua_info['screen_ratio'] > 1) {
                // Add hidpi image set
                $srcset = ' srcset="' . $entry['image_2x'] . ' 2x"';
            } else {
                $srcset = '';
            }
            $entry_text .= '<img src="' . $entry['image'] . '"' . $srcset . ' alt="" /> ';
        }
        $entry_text .= $entry['title'];
        echo str_pad('', ($level - 1) * 2) . '                <li>' . generate_menu_link($entry['url'], $entry_text, $entry['count']) . '</li>' . PHP_EOL;
    }
}