Example #1
0
function mosRecurseListMenu($id, $level, &$children, $open, &$indents, $class_sfx, $highlight)
{
    global $Itemid;
    global $HTTP_SERVER_VARS;
    if (@$children[$id]) {
        $n = min($level, count($indents) - 1);
        $br = strtolower($_SERVER['HTTP_USER_AGENT']);
        // what browser.
        if (ereg("msie 6", $br)) {
            $sfis_ie6 = "yes";
        } else {
            $sfis_ie6 = "no";
        }
        $br = strtolower($_SERVER['HTTP_USER_AGENT']);
        // what browser.
        if (ereg("msie 7", $br)) {
            $sfis_ie7 = "yes";
        } else {
            $sfis_ie7 = "no";
        }
        if ($level == 0) {
            if ($sfis_ie6 == "yes" || $sfis_ie7 == "yes") {
                echo '<ul>';
            } else {
                echo '<ul>';
            }
        } else {
            echo $indents[$n][0];
        }
        foreach ($children[$id] as $row) {
            switch ($row->type) {
                case 'separator':
                    $row->link = "javascript:;";
                    break;
                case 'url':
                    if ($row->link == "javascript:;") {
                        $row->link = "javascript:;";
                    } else {
                        $row->link .= "";
                    }
                    break;
                default:
                    $row->link .= "&Itemid={$row->id}";
                    break;
            }
            $li = "\n" . $indents[$n][1];
            $current_itemid = trim(JRequest::getVar('Itemid', 0));
            if ($row->link != "seperator" && $current_itemid == $row->id || $row->id == $highlight || JRoute::_(substr($_SERVER['PHP_SELF'], 0, -9) . $row->link) == $_SERVER['REQUEST_URI'] || JRoute::_(substr($_SERVER['PHP_SELF'], 0, -9) . $row->link) == $HTTP_SERVER_VARS['REQUEST_URI']) {
                $br = strtolower($_SERVER['HTTP_USER_AGENT']);
                // what browser.
                if (ereg("msie 6", $br)) {
                    $sfis_ie6 = "yes";
                } else {
                    $sfis_ie6 = "no";
                }
                $br = strtolower($_SERVER['HTTP_USER_AGENT']);
                // what browser.
                if (ereg("msie 7", $br)) {
                    $sfis_ie7 = "yes";
                } else {
                    $sfis_ie7 = "no";
                }
                if ($sfis_ie6 == "yes" || $sfis_ie7 == "yes") {
                    if ($row->type != "url") {
                        $li = "<li class=\"active\">";
                    }
                } else {
                    if ($row->type != "url") {
                        $li = "<li class=\"active\">";
                    }
                }
            }
            echo $li;
            echo mosGetLink($row, $level, $class_sfx);
            mosRecurseListMenu($row->id, $level + 1, $children, $open, $indents, $class_sfx, "");
            echo $indents[$n][2];
        }
        echo "\n" . $indents[$n][3];
    }
}
Example #2
0
/**
* Utility function to recursively work through a vertically indented
* hierarchial menu
*/
function mosRecurseListMenu($id, $level, &$children, $open, &$indents, $class_sfx, $highlight)
{
    global $Itemid;
    global $HTTP_SERVER_VARS, $mosConfig_live_site;
    if (@$children[$id]) {
        $n = min($level, count($indents) - 1);
        echo $indents[$n][0];
        foreach ($children[$id] as $row) {
            switch ($row->type) {
                case 'separator':
                    // do nothing
                    $row->link = "seperator";
                    break;
                case 'url':
                    if (eregi('index.php\\?', $row->link)) {
                        if (!eregi('Itemid=', $row->link)) {
                            $row->link .= '&Itemid=' . $row->id;
                        }
                    }
                    break;
                default:
                    $row->link .= "&Itemid={$row->id}";
                    break;
            }
            $li = "\n" . $indents[$n][1];
            /* ANDROMEDA CHANGE */
            if (defined('_ANDROMEDA_JOOMLA')) {
                $current_itemid = '';
                if ($row->id == SessionGet('AGMENU_MODULE')) {
                    if (vgfGet('menu_mode') != 'x4') {
                        $li = "<li class='active'>";
                    }
                }
            } else {
                $current_itemid = trim(mosGetParam($_REQUEST, 'Itemid', 0));
                if ($row->link != "seperator" && $current_itemid == $row->id || $row->id == $highlight || sefRelToAbs(substr($_SERVER['PHP_SELF'], 0, -9) . $row->link) == $_SERVER['REQUEST_URI'] || sefRelToAbs(substr($_SERVER['PHP_SELF'], 0, -9) . $row->link) == $HTTP_SERVER_VARS['REQUEST_URI']) {
                    $li = "<li class='active'>";
                }
            }
            echo $li;
            // KFD change 4/9/07, AJAX-ification effort
            //echo hjxCheckFirst($row->name,$row->link);
            //txt = "<a href=\"$mitem->link\">$mitem->name</a>";
            echo mosGetLink($row, $level, $class_sfx);
            mosRecurseListMenu($row->id, $level + 1, $children, $open, $indents, $class_sfx, "");
            echo $indents[$n][2];
        }
        echo "\n" . $indents[$n][3];
    }
}