Example #1
0
function build_main_menu()
{
    global $mainnav_links;
    foreach ($mainnav_links as $menuname => $menuitems) {
        $menunamev = explode('-', $menuname);
        if (count($menuitems) > 0 && $menuitems[0][0]) {
            echo '
                                <div id="' . $menunamev[1] . '">
                                  <div onclick="javascript:toggleNewMenu(' . $menunamev[0] . '-1);" class="menu-button-off" id="' . $menunamev[1] . '-button">
                                    <span class="' . $menunamev[1] . '-icon-off" id="' . $menunamev[1] . '-icon">&nbsp;</span><a class="' . $menunamev[1] . '-header-off" id="' . $menunamev[1] . '-header"><em>Menu item</em></a><a id="' . $menunamev[1] . '-collapse"></a><span class="menuEntry-rightBorder"></span>
                                  </div>
                                  <div id="' . $menunamev[1] . '-inner">
                                    <script type="text/javascript">
                                        if (menuCookie[' . $menunamev[0] . '-1] == 0) {
                                            document.getElementById("' . $menunamev[1] . '-inner").style.display = "none";   
                                            document.getElementById("' . $menunamev[1] . '-button").className = "menu-button-off";
                                            document.getElementById("' . $menunamev[1] . '-collapse").className = "leftMenu-plusLink";
                                            document.getElementById("' . $menunamev[1] . '-icon").className = "' . $menunamev[1] . '-icon-off";
                                            document.getElementById("' . $menunamev[1] . '-header").className = "' . $menunamev[1] . '-header-off";
                                        } else {
                                            document.getElementById("' . $menunamev[1] . '-inner").style.display = "block";    
                                            document.getElementById("' . $menunamev[1] . '-button").className = "menu-button-on";
                                            document.getElementById("' . $menunamev[1] . '-collapse").className = "leftMenu-minusLink";
                                            document.getElementById("' . $menunamev[1] . '-icon").className = "' . $menunamev[1] . '-icon-on";
                                            document.getElementById("' . $menunamev[1] . '-header").className = "' . $menunamev[1] . '-header-on";
                                        }
                                    </script>
                                    <div class="leftMenu-cont-top"></div>
                                    <div class="leftMenu-cont-mid">
                                      <div class="m-left">
                                        <div class="m-right">
                                          <div class="leftMenu-cnt" id="menuContainer1">
                                            <ul class="mainNav">
                                              <div style="position:relative;" id="menuFiller1">
                                                ' . build_menu_items($menuitems) . '
                                              </div>
                                            </ul>
                                          </div>
                                        </div>
                                      </div>
                                    </div>
                                    <div class="leftMenu-cont-bot"></div>
                                  </div>
                                </div>
    ';
        }
    }
}
function build_main_menu()
{
    global $DB, $user, $Core;
    $mainnav_links = array('1-menuNews', '2-menuAccount', '3-menuGameGuide', '4-menuInteractive', '5-menuMedia', '6-menuForums', '7-menuCommunity', '8-menuSupport');
    foreach ($mainnav_links as $menuname) {
        $menunamev = explode('-', strtolower($menuname));
        if ($user['id'] > 0) {
            $menuquery = "SELECT * FROM `mw_menu_items` WHERE `menu_id`='" . $menunamev[0] . "' AND `account_level` <= " . $user['account_level'] . " ORDER BY `order` ASC";
        } else {
            $menuquery = "SELECT * FROM `mw_menu_items` WHERE `menu_id`='" . $menunamev[0] . "' AND `account_level` <= " . $user['account_level'] . " ORDER BY `order` ASC";
        }
        $menuitems = $DB->select($menuquery);
        if ($menuitems != FALSE) {
            static $index = 0;
            $index++;
            echo '
                <div id="' . $menunamev[1] . '"  style="position: relative; z-index: 11;"> 
					<div onclick="javascript:toggleNewMenu(' . $menunamev[0] . '-1);" class="menu-button-off" id="' . $menunamev[1] . '-button">
						<span class="' . $menunamev[1] . '-icon-off" id="' . $menunamev[1] . '-icon">&nbsp;</span><a class="' . $menunamev[1] . '-header-off" id="' . $menunamev[1] . '-header"><em>Menu item</em></a><a id="' . $menunamev[1] . '-collapse"></a><span class="menuentry-rightborder"></span>
                    </div>
                    <div id="' . $menunamev[1] . '-inner">
                        <script type="text/javascript">
                        if (menuCookie[' . $menunamev[0] . '-1] == 0) 
						{
                            document.getElementById("' . $menunamev[1] . '-inner").style.display = "none";
                            document.getElementById("' . $menunamev[1] . '-button").className = "menu-button-off";
                            document.getElementById("' . $menunamev[1] . '-collapse").className = "leftmenu-pluslink";
                            document.getElementById("' . $menunamev[1] . '-icon").className = "' . $menunamev[1] . '-icon-off";
                            document.getElementById("' . $menunamev[1] . '-header").className = "' . $menunamev[1] . '-header-off";
                        } 
						else
						{
                            document.getElementById("' . $menunamev[1] . '-inner").style.display = "block";
                            document.getElementById("' . $menunamev[1] . '-button").className = "menu-button-on";
                            document.getElementById("' . $menunamev[1] . '-collapse").className = "leftmenu-minuslink";
                            document.getElementById("' . $menunamev[1] . '-icon").className = "' . $menunamev[1] . '-icon-on";
                            document.getElementById("' . $menunamev[1] . '-header").className = "' . $menunamev[1] . '-header-on";
                        }
                        </script>
                        <div class="leftmenu-cont-top"></div>
                        <div class="leftmenu-cont-mid">
                            <div class="m-left">
                                <div class="m-right">
                                    <div class="leftmenu-cnt" id="menucontainer' . $index . '">
                                        <ul class="mainnav">
                                            <li style="position:relative;" id="menufiller' . $index . '">
                                                ' . build_menu_items($menuitems) . '
                                            </li>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="leftmenu-cont-bot"></div>
                    </div>
                </div>
			';
        }
    }
    unset($menuquery);
}