Esempio n. 1
0
function NavMenus($options = array())
{
    if (!defined('PREPEND_PATH')) {
        define('PREPEND_PATH', '');
    }
    global $Translation;
    $menu = array();
    $prepend_path = PREPEND_PATH;
    /* default options */
    if (empty($options)) {
        $options = array('tabs' => 7);
    }
    $table_group_name = array_keys(get_table_groups());
    /* 0 => group1, 1 => group2 .. */
    /* if only one group named 'None', set to translation of 'select a table' */
    if (count($table_group_name) == 1 && $table_group_name[0] == 'None') {
        $table_group_name[0] = $Translation['select a table'];
    }
    $table_group_index = array_flip($table_group_name);
    /* group1 => 0, group2 => 1 .. */
    $t = time();
    $arrTables = getTableList();
    if (is_array($arrTables)) {
        foreach ($arrTables as $tn => $tc) {
            /* ---- list of tables where hide link in nav menu is set ---- */
            $tChkHL = array_search($tn, array());
            if ($tChkHL !== false && $tChkHL !== null) {
                continue;
            }
            /* ---- list of tables where filter first is set ---- */
            $tChkFF = array_search($tn, array('submitlog', 'paddata'));
            if ($tChkFF !== false && $tChkFF !== null) {
                $searchFirst = '&Filter_x=1';
            } else {
                $searchFirst = '';
            }
            /* when no groups defined, $table_group_index['None'] is NULL, so $menu_index is still set to 0 */
            $menu_index = intval($table_group_index[$tc[3]]);
            $menu[$menu_index] .= "<li><a href=\"{$prepend_path}{$tn}_view.php?t={$t}{$searchFirst}\"><img src=\"{$prepend_path}" . ($tc[2] ? $tc[2] : 'blank.gif') . "\" height=\"32\"> {$tc[0]}</a></li>";
        }
    }
    // custom nav links, as defined in "hooks/links-navmenu.php"
    global $navLinks;
    if (is_array($navLinks)) {
        $memberInfo = getMemberInfo();
        $links_added = array();
        foreach ($navLinks as $link) {
            if (!isset($link['url']) || !isset($link['title'])) {
                continue;
            }
            if ($memberInfo['admin'] || @in_array($memberInfo['group'], $link['groups']) || @in_array('*', $link['groups'])) {
                $menu_index = intval($link['table_group']);
                if (!$links_added[$menu_index]) {
                    $menu[$menu_index] .= '<li class="divider"></li>';
                }
                /* add prepend_path to custom links if they aren't absolute links */
                if (!preg_match('/^(http|\\/\\/)/i', $link['url'])) {
                    $link['url'] = $prepend_path . $link['url'];
                }
                if (!preg_match('/^(http|\\/\\/)/i', $link['icon']) && $link['icon']) {
                    $link['icon'] = $prepend_path . $link['icon'];
                }
                $menu[$menu_index] .= "<li><a href=\"{$link['url']}\"><img src=\"" . ($link['icon'] ? $link['icon'] : "{$prepend_path}blank.gif") . "\" height=\"32\"> {$link['title']}</a></li>";
                $links_added[$menu_index]++;
            }
        }
    }
    $menu_wrapper = '';
    for ($i = 0; $i < count($menu); $i++) {
        $menu_wrapper .= <<<EOT
\t\t\t\t<li class="dropdown">
\t\t\t\t\t<a href="#" class="dropdown-toggle" data-toggle="dropdown">{$table_group_name[$i]} <b class="caret"></b></a>
\t\t\t\t\t<ul class="dropdown-menu" role="menu">{$menu[$i]}</ul>
\t\t\t\t</li>
EOT;
    }
    return $menu_wrapper;
}
Esempio n. 2
0
		margin-top: 10px;
		height: 40px;
		overflow: auto;
	}
	.panel-body .btn img{
		margin: 0 10px;
		max-height: 32px;
	}
</style>


<?php 
/* accessible tables */
if (is_array($arrTables) && count($arrTables)) {
    /* how many table groups do we have? */
    $groups = get_table_groups();
    $multiple_groups = count($groups) > 1 ? true : false;
    /* construct $tg: table list grouped by table group */
    $tg = array();
    if (count($groups)) {
        foreach ($groups as $grp => $tables) {
            foreach ($tables as $tn) {
                $tg[$tn] = $grp;
            }
        }
    }
    $i = 0;
    $current_group = '';
    foreach ($tg as $tn => $tgroup) {
        $tc = $arrTables[$tn];
        $tChkFF = array_search($tn, array());