function GosuMenu($ordered, $swmenupro, $active_menu, $selectbox_hack, $sub_active) { global $mainframe, $Itemid; $absolute_path = JPATH_ROOT; $live_site = $mainframe->isAdmin() ? $mainframe->getSiteURL() : JURI::base(); $name = ""; $counter = 0; $doMenu = 1; $uniqueID = $swmenupro['id']; $number = count($ordered); $str = "<div align=\"" . $swmenupro['position'] . "\">\n"; $str .= "<table cellspacing=\"0\" cellpadding=\"0\" id=\"menu" . $uniqueID . "\" class=\"ddmx" . $uniqueID . "\" > \n"; if ($swmenupro['orientation'] == "horizontal") { $str .= "<tr> \n"; } while ($doMenu) { if ($ordered[$counter]['indent'] == 0) { $ordered[$counter]['URL'] = str_replace('&', '&', $ordered[$counter]['URL']); $name = swmenu_getname($ordered[$counter]); if ($swmenupro['orientation'] == "vertical") { $str .= "<tr> \n"; } $act = 0; if (islast($ordered, $counter)) { if ($ordered[$counter]['ID'] == $active_menu) { $str .= "<td class='item11-acton-last'> \n"; $act = 1; } else { $str .= "<td class='item11-last'> \n"; } } else { if ($ordered[$counter]['ID'] == $active_menu) { $str .= "<td class='item11-acton'> \n"; $act = 1; } else { $str .= "<td class='item11'> \n"; } } //echo $ordered[$counter]['URL']."<br />"; if ($ordered[$counter]['TARGETLEVEL'] == "0") { $str .= "<a class='item1' href=\"javascript: void(0)\" >" . $name . "</a> \n"; } else { switch ($ordered[$counter]['TARGET']) { // cases are slightly different case 1: // open in a new window $str .= '<a href="' . $ordered[$counter]['URL'] . '" target="_blank" class="item1" >' . $name . '</a>'; break; case 2: // open in a popup window $str .= "<a href=\"#\" onclick=\"javascript: window.open('" . $ordered[$counter]['URL'] . "', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550'); return false\" class=\"item1\">" . $name . "</a>\n"; break; case 3: // don't link it $str .= '<a class="item1" >' . $name . '</a>'; break; default: // formerly case 2 // open in parent window $str .= '<a href="' . $ordered[$counter]['URL'] . '" class="item1">' . $name . '</a>'; break; } } if ($counter + 1 == $number) { $doSubMenu = 0; $doMenu = 0; $str .= "<div class=\"section\" style=\"border:0 !important;\"></div> \n"; } elseif ($ordered[$counter + 1]['indent'] == 0) { $doSubMenu = 0; $str .= "<div class=\"section\" style=\"border:0 !important;\"></div> \n"; } else { $doSubMenu = 1; } $counter++; while ($doSubMenu) { if ($ordered[$counter]['indent'] != 0) { if ($ordered[$counter]['indent'] > $ordered[$counter - 1]['indent']) { if ($act && $sub_active && $swmenupro['orientation'] == "vertical") { $str .= '<div class="subsection" >'; } else { $str .= '<div class="section" >'; } } $ordered[$counter]['URL'] = str_replace('&', '&', $ordered[$counter]['URL']); $name = swmenu_getname($ordered[$counter]); if ($counter + 1 == $number || $ordered[$counter + 1]['indent'] == 0) { $doSubMenu = 0; } $style = ""; if ($counter + 1 == $number || islast($ordered, $counter)) { $style = " style=\"border-bottom:" . $swmenupro['sub_border_over'] . "\""; } if ($ordered[$counter]['TARGETLEVEL'] == "0") { $str .= "<a class=\"item2\"" . $style . " href=\"javascript: void(0)\" >" . $name . "</a> \n"; } else { switch ($ordered[$counter]['TARGET']) { // cases are slightly different case 1: // open in a new window $str .= '<a href="' . $ordered[$counter]['URL'] . '" ' . $style . ' target="_blank" class="item2" >' . $name . '</a>'; break; case 2: // open in a popup window $str .= "<a href=\"#\" " . $style . " onclick=\"javascript: window.open('" . $ordered[$counter]['URL'] . "', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550'); return false\" class=\"item2\">" . $name . "</a>\n"; break; case 3: // don't link it $str .= '<a class="item2" ' . $style . ' >' . $name . '</a>'; break; default: // formerly case 2 // open in parent window $str .= "<a href=\"" . $ordered[$counter]['URL'] . "\" class=\"item2\" " . $style . ">" . $name . "</a>\n"; break; } } if ($counter + 1 == $number || $ordered[$counter + 1]['indent'] < $ordered[$counter]['indent']) { $str .= str_repeat('</div>', $ordered[$counter]['indent'] - @$ordered[$counter + 1]['indent']); } $counter++; } } } $str .= "</td> \n"; if ($swmenupro['orientation'] == "vertical") { $str .= "</tr> \n"; } if ($counter == $number) { $doMenu = 0; } } if ($swmenupro['orientation'] == "horizontal") { $str .= "</tr> \n"; } $str .= "</table></div> \n"; $str .= "<script type=\"text/javascript\">\n"; $str .= "<!--\n"; $str .= "function makemenu" . $uniqueID . "(){\n"; $str .= "var ddmx" . $uniqueID . " = new DropDownMenuX('menu" . $uniqueID . "');\n"; if ($swmenupro['orientation'] == "vertical") { $str .= "ddmx" . $uniqueID . ".type = \"vertical\"; \n"; } $str .= "ddmx" . $uniqueID . ".delay.show = 0;\n"; $str .= "ddmx" . $uniqueID . ".iframename = 'ddmx" . $uniqueID . "';\n"; $str .= "ddmx" . $uniqueID . ".delay.hide = " . $swmenupro['specialB'] . ";\n"; $str .= "ddmx" . $uniqueID . ".position.levelX.left = " . $swmenupro['level2_sub_left'] . ";\n"; $str .= "ddmx" . $uniqueID . ".position.levelX.top = " . $swmenupro['level2_sub_top'] . ";\n"; $str .= "ddmx" . $uniqueID . ".position.level1.left = " . $swmenupro['level1_sub_left'] . ";\n"; $str .= "ddmx" . $uniqueID . ".position.level1.top = " . $swmenupro['level1_sub_top'] . "; \n"; $str .= "ddmx" . $uniqueID . ".fixIeSelectBoxBug = " . ($selectbox_hack ? 'true' : 'false') . ";\n"; $str .= "ddmx" . $uniqueID . ".init(); \n"; $str .= "}\n"; $str .= "if ( typeof window.addEventListener != \"undefined\" )\n"; $str .= "window.addEventListener( \"load\", makemenu" . $uniqueID . ", false );\n"; $str .= "else if ( typeof window.attachEvent != \"undefined\" ) { \n"; $str .= "window.attachEvent( \"onload\", makemenu" . $uniqueID . " );\n"; $str .= "}\n"; $str .= "else {\n"; $str .= "if ( window.onload != null ) {\n"; $str .= "var oldOnload = window.onload;\n"; $str .= "window.onload = function ( e ) { \n"; $str .= "oldOnload( e ); \n"; $str .= "makemenu" . $uniqueID . "() \n"; $str .= "} \n"; $str .= "} \n"; $str .= "else { \n"; $str .= "window.onload = makemenu" . $uniqueID . "();\n"; $str .= "} }\n"; $str .= "--> \n"; $str .= "</script> \n"; return $str; }
function SuperfishMenu($ordered, $swmenufree, $active_menu, $selectbox_hack, $sub_active, $show_shadow, $sub_indicator, $overlay_hack) { global $mainframe, $Itemid; $absolute_path = JPATH_ROOT; $live_site = JURI::base(); $name = ""; $counter = 0; $doMenu = 1; //$uniqueID = $swmenufree['id']; $number = count($ordered); $activesub = -1; $activesub2 = -1; $topcount = 0; $subcounter = 0; $str = "<div id=\"sfmenu\" align=\"" . $swmenufree['position'] . "\" >\n"; if ($swmenufree['orientation'] == "horizontal") { $str .= "<ul id=\"menu\" class=\"sw-sf\" > \n"; } else { $str .= "<ul id=\"menu\" class=\"sw-sf sf-vertical\" > \n"; } //if ($swmenufree['orientation']=="horizontal"){$str.= "<tr> \n";} while ($doMenu) { if ($ordered[$counter]['indent'] == 0) { $ordered[$counter]['URL'] = str_replace('&', '&', $ordered[$counter]['URL']); $name = $ordered[$counter]['TITLE']; if ($swmenufree['orientation'] == "vertical") { // $str.= "<tr> \n"; } $act = 0; if (islast($ordered, $counter)) { if ($ordered[$counter]['ID'] == $active_menu) { $str .= "<li id='sf-" . $ordered[$counter]['ID'] . "' class='current'> \n"; $act = 1; $activesub = $topcount; } else { $str .= "<li id='sf-" . $ordered[$counter]['ID'] . "' > \n"; } } else { if ($ordered[$counter]['ID'] == $active_menu) { $str .= "<li id='sf-" . $ordered[$counter]['ID'] . "' class='current'> \n"; $act = 1; $activesub = $topcount; } else { $str .= "<li id='sf-" . $ordered[$counter]['ID'] . "' > \n"; } } $topcount++; //echo $ordered[$counter]['URL']."<br />"; switch ($ordered[$counter]['TARGET']) { // cases are slightly different case 1: // open in a new window if (islast($ordered, $counter)) { $str .= '<a href="' . $ordered[$counter]['URL'] . '" target="_blank" class="item1 last" >' . $name . '</a>'; } else { $str .= '<a href="' . $ordered[$counter]['URL'] . '" target="_blank" class="item1" >' . $name . '</a>'; } break; case 2: // open in a popup window if (islast($ordered, $counter)) { $str .= "<a href=\"#\" onclick=\"javascript: window.open('" . $ordered[$counter]['URL'] . "', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550'); return false\" class=\"item1 last\">" . $name . "</a>\n"; } else { $str .= "<a href=\"#\" onclick=\"javascript: window.open('" . $ordered[$counter]['URL'] . "', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550'); return false\" class=\"item1\">" . $name . "</a>\n"; } break; case 3: // don't link it if (islast($ordered, $counter)) { $str .= '<a class="item1 last" >' . $name . '</a>'; } else { $str .= '<a class="item1" >' . $name . '</a>'; } break; default: // formerly case 2 // open in parent window if (islast($ordered, $counter)) { $str .= "<a href='" . $ordered[$counter]['URL'] . "' class='item1 last'>" . $name . "</a>\n"; } else { $str .= "<a href='" . $ordered[$counter]['URL'] . "' class='item1'>" . $name . "</a>\n"; } break; } if ($counter + 1 == $number) { $doSubMenu = 0; $doMenu = 0; //$str.= "<div class=\"section\" style=\"border:0 !important;\"></div> \n"; } elseif ($ordered[$counter + 1]['indent'] == 0) { $doSubMenu = 0; //$str.= "<div class=\"section\" style=\"border:0 !important;\"></div> \n"; } else { $doSubMenu = 1; } $counter++; if ($activesub2 == -1) { $subcounter = 0; } while ($doSubMenu) { if ($ordered[$counter]['indent'] != 0) { if ($ordered[$counter]['indent'] > $ordered[$counter - 1]['indent']) { $str .= "<ul class='sf-section' >\n"; } $ordered[$counter]['URL'] = str_replace('&', '&', $ordered[$counter]['URL']); $name = $ordered[$counter]['TITLE']; if ($counter + 1 == $number || $ordered[$counter + 1]['indent'] == 0) { $doSubMenu = 0; //$str.= "</li> \n"; } //$style=" style=\""; $li_class = ""; $a_class = ""; if ($counter + 1 == $number || islast($ordered, $counter)) { $a_class .= "item2 last"; } else { $a_class .= "item2"; } if ($ordered[$counter]['ID'] == $Itemid) { $li_class = "sf-" . $ordered[$counter]['ID'] . ""; } else { $li_class = "sf-" . $ordered[$counter]['ID'] . ""; } $str .= "<li id=\"" . $li_class . "\">"; switch ($ordered[$counter]['TARGET']) { // cases are slightly different case 1: // open in a new window $str .= '<a href="' . $ordered[$counter]['URL'] . '" target="_blank" class="' . $a_class . '" >' . $name . '</a>'; break; case 2: // open in a popup window $str .= "<a href=\"#\" onclick=\"javascript: window.open('" . $ordered[$counter]['URL'] . "', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550'); return false\" class=\"" . $a_class . "\">" . $name . "</a>\n"; break; case 3: // don't link it $str .= '<a class="' . $a_class . '" >' . $name . '</a>'; break; default: // formerly case 2 // open in parent window $str .= "<a href=\"" . $ordered[$counter]['URL'] . "\" class=\"" . $a_class . "\" >" . $name . "</a>\n"; break; } if ($counter + 1 == $number || $ordered[$counter + 1]['indent'] < $ordered[$counter]['indent']) { $str .= "</li> \n"; $str .= str_repeat("</ul>\n", $ordered[$counter]['indent'] - @$ordered[$counter + 1]['indent']); //$str.= "</ul> \n"; } else { if ($ordered[$counter + 1]['indent'] <= $ordered[$counter]['indent']) { $str .= "</li> \n"; } } $counter++; } } //$str.= "</li> \n"; } $str .= "</li> \n"; if ($swmenufree['orientation'] == "vertical") { //$str.= "</tr> \n"; } if ($counter == $number) { $doMenu = 0; } } //if ($swmenufree['orientation']=="horizontal"){$str.= "</tr> \n";} $str .= "<hr /></ul></div> \n"; if ($swmenufree['sub_width'] > 0) { $str .= "<script type=\"text/javascript\">\n"; $str .= "<!--\n"; $str .= "jQuery.noConflict();\n"; $str .= "jQuery(document).ready(function(\$){\n"; $str .= "\$('.sw-sf').superfish({\n"; switch ($swmenufree['extra']) { // cases are slightly different case 1: $str .= "animation: {opacity:'show'},"; $str .= "speed: " . $swmenufree['specialB'] . ","; break; case 2: $str .= "animation: {height:'show'},"; $str .= "speed: " . $swmenufree['specialB'] . ","; break; case 3: $str .= "animation: {width:'show'},"; $str .= "speed: " . $swmenufree['specialB'] . ","; break; case 4: $str .= "animation: {opacity:'show',height:'show'},"; $str .= "speed: " . $swmenufree['specialB'] . ","; break; case 5: $str .= "animation: {opacity:'show',width:'show'},"; $str .= "speed: " . $swmenufree['specialB'] . ","; break; default: $str .= "speed: 1,"; break; } // $str.="animation: {opacity:'show',width:'show'},"; if ($sub_indicator) { $str .= "autoArrows: true\n"; } else { $str .= "autoArrows: false\n"; } //$str.="dropShadows: true\n"; //$str.="pathClass: 'current' \n"; $str .= "});\n"; if ($overlay_hack) { //$str.="alert($.topZIndex());\n"; // $str.="$('#left_container').topZIndex();\n"; $str .= "\$('.sw-sf').parents().css('overflow','visible');\n"; $str .= "\$('html').css('overflow','auto');\n"; $str .= "\$('.sw-sf').parents().css('z-index','100');\n"; $str .= "\$('.sw-sf').css('z-index','101');\n"; } /// $str.="$('#menu".$uniqueID." ).dropShadow();\n"; $str .= "});\n"; } else { $str .= "<script type=\"text/javascript\">\n"; $str .= "<!--\n"; $str .= "jQuery.noConflict();\n"; //$str.="alert($.topZIndex());\n"; $str .= "jQuery(document).ready(function(\$){\n"; $str .= "\$('.sw-sf').supersubs({ \n"; $str .= "minWidth:8,\n"; $str .= "maxWidth:80,\n"; $str .= "extraWidth:2\n"; $str .= "}).superfish({\n"; switch ($swmenufree['extra']) { // cases are slightly different case 1: $str .= "animation: {opacity:'show'},"; $str .= "speed: " . $swmenufree['specialB'] . ","; break; case 2: $str .= "animation: {height:'show'},"; $str .= "speed: " . $swmenufree['specialB'] . ","; break; case 3: $str .= "animation: {width:'show'},"; $str .= "speed: " . $swmenufree['specialB'] . ","; break; case 4: $str .= "animation: {opacity:'show',height:'show'},"; $str .= "speed: " . $swmenufree['specialB'] . ","; break; case 5: $str .= "animation: {opacity:'show',width:'show'},"; $str .= "speed: " . $swmenufree['specialB'] . ","; break; default: // $str.="animation: {opacity:'show'},"; $str .= "speed: 1,"; break; } //$str.="animation: {opacity:'show',width:'show'},"; if ($sub_indicator) { $str .= "autoArrows: true\n"; } else { $str .= "autoArrows: false\n"; } //$str.="dropShadows: true\n"; //$str.="pathClass: 'current' \n"; $str .= "});\n"; //$str.="$.fx.off=true;\n"; if ($overlay_hack) { //$str.="alert($.topZIndex());\n"; // $str.="$('#left_container').topZIndex();\n"; $str .= "\$('.sw-sf').parents().css('overflow','visible');\n"; $str .= "\$('html').css('overflow','auto');\n"; $str .= "\$('.sw-sf').parents().css('z-index','100');\n"; $str .= "\$('.sw-sf').css('z-index','101');\n"; } $str .= "});\n"; } $str .= "//--> \n"; $str .= "</script> \n"; return $str; }