Exemplo n.º 1
0
function render_menu()
{
    global $CONF, $CUR_TEMPLATE, $MODULES, $MENU, $point, $PAGE;
    //We use default template
    if (isset($_SESSION[cur_templ])) {
        $template = $_SESSION[cur_templ];
    } else {
        $template = $CONF[default_template];
    }
    //Include PHP Layer Menù for Layers configuration
    require_once $CONF[path_base] . $CONF[dir_framework] . "external_lib/phplm/lib/PHPLIB.php";
    require_once $CONF[path_base] . $CONF[dir_framework] . "external_lib/phplm/lib/layersmenu-common.inc.php";
    require_once $CONF[path_base] . $CONF[dir_framework] . "external_lib/phplm/lib/layersmenu.inc.php";
    $CUR_TEMPLATE[JS][count($CUR_TEMPLATE[JS])] = $CONF[url_base] . $CONF[dir_framework] . "external_lib/phplm/libjs/layersmenu-browser_detection.js";
    $CUR_TEMPLATE[JS][count($CUR_TEMPLATE[JS])] = $CONF[url_base] . $CONF[dir_framework] . "external_lib/phplm/libjs/layersmenu-library.js";
    $CUR_TEMPLATE[JS][count($CUR_TEMPLATE[JS])] = $CONF[url_base] . $CONF[dir_framework] . "external_lib/phplm/libjs/layersmenu.js";
    $myDirParh = $CONF[path_base] . $CONF[dir_framework] . "external_lib/phplm/";
    $myWwwPath = $CONF[url_base] . $CONF[dir_framework] . "external_lib/phplm/";
    $mid = new LayersMenu();
    $mid->setDirroot($myDirParh);
    $mid->setLibjsdir($myDirPath . 'libjs/');
    $mid->setImgdir($myDirPath . 'menuimages/');
    $mid->setImgwww($myWwwPath . 'menuimages/');
    $mid->setIcondir($CONF[path_base] . $CONF[dir_template] . $template . "/images/ico/");
    $mid->setIconwww($CONF[url_base] . $CONF[dir_template] . $template . "/images/ico/");
    $mid->setTpldir($CONF[path_base] . $CONF[dir_template] . $template . "/menu_template/");
    $mid->setHorizontalMenuTpl('layersmenu-horizontal_menu.ihtml');
    $mid->setSubMenuTpl('layersmenu-sub_menu.ihtml');
    $pt = ".";
    $temppt = $pt;
    for ($x = 1; $x < 11; $x++) {
        $point[$x] = $temppt;
        $temppt .= $pt;
    }
    $main_level = explode(",", $CONF[menu_order]);
    $level = 1;
    foreach ($main_level as $v) {
        $string_menu2 = "";
        if (isset($MENU[$v][0][title])) {
            foreach ($MENU[$v][0] as $k => $v2) {
                if (is_int($k)) {
                    $string_menu2 .= render_submenu($level + 1, $v2, $v);
                }
            }
            if (strlen($string_menu2) > 1 || $MENU[$v][0][perm] == 1) {
                $string_menu .= $point[$level] . "|" . $MENU[$v][0][title] . "|" . $MENU[$v][0][page] . "||" . $MENU[$v][0][icon] . "\n" . $string_menu2;
            }
        }
    }
    $mid->setMenuStructureString(".|Home|" . $CONF[url_base] . "main.php||ico_home_peq.gif\n" . $string_menu);
    $mid->setIconsize(16, 16);
    $mid->parseStructureForMenu('hormenu1');
    $mid->newHorizontalMenu('hormenu1');
    $PAGE[MENU_HEADER] = $mid->makeHeader();
    $PAGE[MENU_TAB] = $mid->getMenu("hormenu1");
    $PAGE[MENU_FOOTER] = $mid->makeFooter();
}