| Current Path : /home/azimutno/www/demo/modules/mod_swmenupro/helpers/ |
| Current File : /home/azimutno/www/demo/modules/mod_swmenupro/helpers/mygosu.php |
<?php
/**
* swmenupro v6.0
* http://swmenupro.com
* Copyright 2006 Sean White
* */
defined('_JEXEC') or die('Restricted access');
function GosuMenu($ordered, $swmenupro) {
$live_site = JURI::base();
if (substr($live_site, (strlen($live_site) - 1), 1) == "/") {
$live_site = substr($live_site, 0, (strlen($live_site) - 1));
}
if (substr($live_site, (strlen($live_site) - 13), 13) == "administrator") {
$live_site = substr($live_site, 0, (strlen($live_site) - 14));
}
if (substr($live_site, (strlen($live_site) - 1), 1) != "/") {
$live_site =$live_site."/" ;
}
$sub_active = 0;
$name = "";
$counter = 0;
$doMenu = 1;
$uniqueID = $swmenupro['id'];
$number = count($ordered);
$activesub = -1;
$activesub2 = -1;
$topcount = 0;
$subcounter = 0;
$str = "<table id=\"outertable" . $uniqueID . "\" align=\"" . $swmenupro['position'] . "\" class=\"outer\"><tr><td><div id=\"outerwrap" . $uniqueID . "\">\n";
$str .= "<table cellspacing=\"0\" border=\"0\" cellpadding=\"0\" id=\"menu" . $uniqueID . "\" class=\"ddmx" . $uniqueID . "\" > \n";
if ($swmenupro['orientation'] == "horizontal/down" || $swmenupro['orientation'] == "horizontal/left" || $swmenupro['orientation'] == "horizontal/up") {
$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/right" || $swmenupro['orientation'] == "vertical/left") {
$str .= "<tr> \n";
}
$act = 0;
if (islast($ordered, $counter)) {
if (($ordered[$counter]['ID'] == $swmenupro['active_menu'])) {
$str .= "<td class='item11 acton last'> \n";
$act = 1;
$activesub = $topcount;
} else {
$str .= "<td class='item11 last'> \n";
}
} else {
if (($ordered[$counter]['ID'] == $swmenupro['active_menu'])) {
$str .= "<td class='item11 acton'> \n";
$act = 1;
$activesub = $topcount;
} else {
$str .= "<td class='item11'> \n";
}
}
$topcount++;
$classname = "item1";
if ($ordered[$counter]['indent'] > @$ordered[$counter - 1]['indent']) {
$classname .= " first";
}
if (($counter + 1 == $number) || islast($ordered, $counter)) {
$classname .= " last";
}
if (($counter + 1 != $number) && ($ordered[$counter + 1]['indent'] > $ordered[$counter]['indent']) && $swmenupro['top_sub_indicator']) {
$name = "<div><img src='" . $live_site . $swmenupro['top_sub_indicator'] . "' align='" . $swmenupro['top_sub_indicator_align'] . "' style='position:relative;left:" . $swmenupro['top_sub_indicator_left'] . "px;top:" . $swmenupro['top_sub_indicator_top'] . "px;' alt='' border='0' />" . $name."</div>\n";
}
if ($ordered[$counter]['TARGETLEVEL'] == "0") {
$str .= "<a class='" . $classname . "' href=\"javascript:void(0);\" >" . $name . "</a> \n";
} else {
switch ($ordered[$counter]['TARGET']) {
case 1:
$str .= '<a href="' . $ordered[$counter]['URL'] . '" target="_blank" class="' . $classname . '" >' . $name . '</a>';
break;
case 2:
$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='" . $classname . "'>" . $name . "</a>\n";
break;
case 3:
$str .= '<a class="' . $classname . '" >' . $name . '</a>';
break;
default:
$str .= '<a href="' . $ordered[$counter]['URL'] . '" class="' . $classname . '">' . $name . '</a>';
break;
}
}
if ($counter + 1 == $number) {
$doSubMenu = 0;
$doMenu = 0;
// $str .= "<div class=\"section\" style=\"border:0 !important;display:none;\"></div> \n";
} elseif ($ordered[$counter + 1]['indent'] == 0) {
$doSubMenu = 0;
// $str .= "<div class=\"section\" style=\"border:0 !important;display:none;\"></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']) {
if ($act && $sub_active && ($swmenupro['orientation'] == "vertical/right")) {
$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 = " style=\"";
$classname = "item2";
if ($ordered[$counter]['indent'] > $ordered[$counter - 1]['indent']) {
$classname .= " first";
}
if (($counter + 1 == $number) || islast($ordered, $counter)) {
$classname .= " last";
}
if (($counter + 1 != $number) && ($ordered[$counter + 1]['indent'] > $ordered[$counter]['indent']) && $swmenupro['sub_sub_indicator']) {
$name = "<img src='" . $live_site . $swmenupro['sub_sub_indicator'] . "' align='" . $swmenupro['sub_sub_indicator_align'] . "' style='position:relative;left:" . $swmenupro['sub_sub_indicator_left'] . "px;top:" . $swmenupro['sub_sub_indicator_top'] . "px;' alt='' border='0' />" . $name;
}
$style .= "\" ";
if ($ordered[$counter]['TARGETLEVEL'] == "0") {
$str .= "<a class=\"" . $classname . "\"" . $style . " href=\"javascript:void(0);\" >" . $name . "</a> \n";
} else {
switch ($ordered[$counter]['TARGET']) {
case 1:
$str .= '<a href="' . $ordered[$counter]['URL'] . '" ' . $style . ' target="_blank" class="' . $classname . '" >' . $name . '</a>';
break;
case 2:
$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=\"" . $classname . "\">" . $name . "</a>\n";
break;
case 3:
$str .= '<a class="' . $classname . '" ' . $style . ' >' . $name . '</a>';
break;
default:
$str .= "<a href=\"" . $ordered[$counter]['URL'] . "\" class=\"" . $classname . "\" " . $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/right" || $swmenupro['orientation'] == "vertical/left") {
$str .= "</tr> \n";
}
if ($counter == ($number)) {
$doMenu = 0;
}
}
if ($swmenupro['orientation'] == "horizontal/down" || $swmenupro['orientation'] == "horizontal/left" || $swmenupro['orientation'] == "horizontal/up") {
$str .= "</tr> \n";
}
$str .= "</table></div></td></tr></table><hr style=\"display:block;clear:left;margin:-0.66em 0;visibility:hidden;\" /> \n";
$str .= "<script type=\"text/javascript\">\n";
$str .= "<!--\n";
$str .= "function makemenu" . $uniqueID . "(){\n";
$str .= "var ddmx" . $uniqueID . " = new DropDownMenuX('menu" . $uniqueID . "');\n";
$str .= "ddmx" . $uniqueID . ".type = '" . $swmenupro['orientation'] . "'; \n";
$str .= "ddmx" . $uniqueID . ".delay.show = " . $swmenupro['specialB'] . ";\n";
$str .= "ddmx" . $uniqueID . ".iframename = 'ddmx" . $uniqueID . "';\n";
$str .= "ddmx" . $uniqueID . ".delay.hide = " . $swmenupro['specialB'] . " ;\n";
$str .= "ddmx" . $uniqueID . ".effect = '" . ($swmenupro['extra'] ? $swmenupro['extra'] : 'none') . "';\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 = " . (@$swmenupro['selectbox_hack'] ? 'true' : 'false') . ";\n";
$str .= "ddmx" . $uniqueID . ".autoposition = " . ($swmenupro['auto_position'] ? 'true' : 'false') . ";\n";
$str .= "ddmx" . $uniqueID . ".revealtype = 'hover';\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";
$str .= "<script type=\"text/javascript\">\n";
$str .= "<!--\n";
if (($swmenupro['c_corner_style'] != 'none') && ($swmenupro['c_corner_style'])&& ($swmenupro['c_corner_style'] != 'curvycorner')){
if (($swmenupro['main_border_width'] > 0) && ($swmenupro['main_border_style'] != 'none')) {
$str .= "if (jQuery.browser.msie && jQuery.browser.version < 9 ) {\n";
$str .= "jQuery('#outerwrap" . $uniqueID . "').css('z-index','-1');\n";
$str .= "jQuery('#outerwrap" . $uniqueID . "').wrap('<div></div>');\n";
$str .= "jQuery('#outerwrap" . $uniqueID . "').parent().css('padding', '" . $swmenupro['main_border_width'] . "px');\n";
$str .= "jQuery('#outerwrap" . $uniqueID . "').parent().css('background-color', '" . $swmenupro['main_border_color'] . "');\n";
$str .= "jQuery('#outerwrap" . $uniqueID . "').corner('" . $swmenupro['c_corner_style'] . " " . (@$swmenupro['ctl_corner'] ? 'tl' : '') . " " . (@$swmenupro['ctr_corner'] ? 'tr' : '') . " " . (@$swmenupro['cbl_corner'] ? 'bl' : '') . " " . (@$swmenupro['cbr_corner'] ? 'br' : '') . " " . ($swmenupro['c_corner_size']) . "px');\n";
$str .= "jQuery('#outerwrap" . $uniqueID . "').parent().corner('" . $swmenupro['c_corner_style'] . " " . (@$swmenupro['ctl_corner'] ? 'tl' : '') . " " . (@$swmenupro['ctr_corner'] ? 'tr' : '') . " " . (@$swmenupro['cbl_corner'] ? 'bl' : '') . " " . (@$swmenupro['cbr_corner'] ? 'br' : '') . " " . ($swmenupro['c_corner_size'] + $swmenupro['main_border_width']) . "px');\n";
// $str .= "jQuery('#outerwrap').css('z-index','1');\n";
$str .= "}else{\n";
$str .= "jQuery('#outerwrap" . $uniqueID . "').corner('keep " . $swmenupro['c_corner_style'] . " " . (@$swmenupro['ctl_corner'] ? 'tl' : '') . " " . (@$swmenupro['ctr_corner'] ? 'tr' : '') . " " . (@$swmenupro['cbl_corner'] ? 'bl' : '') . " " . (@$swmenupro['cbr_corner'] ? 'br' : '') . " " . ($swmenupro['c_corner_size']) . "px');\n";
$str .= "}\n";
}else{
$str .= "jQuery('#outerwrap" . $uniqueID . "').corner('" . $swmenupro['c_corner_style'] . " " . (@$swmenupro['ctl_corner'] ? 'tl' : '') . " " . (@$swmenupro['ctr_corner'] ? 'tr' : '') . " " . (@$swmenupro['cbl_corner'] ? 'bl' : '') . " " . (@$swmenupro['cbr_corner'] ? 'br' : '') . " " . ($swmenupro['c_corner_size']) . "px');\n";
}
}
if (($swmenupro['t_corner_style'] != 'none') && ($swmenupro['t_corner_style'])&& ($swmenupro['t_corner_style'] != 'curvycorner')){
if (($swmenupro['main_border_over_width'] > 0) && ($swmenupro['main_border_over_style'] != 'none')) {
$str .= "if (jQuery.browser.msie && jQuery.browser.version < 9) {\n";
$str .= "jQuery('#menu" . $uniqueID . " .item1').css('z-index','-1');\n";
// $str .= "jQuery('#swmenu .item1').wrap('<span></span>');\n";
$str .= "jQuery('#menu" . $uniqueID . " .item1').parent().css('padding', '" . $swmenupro['main_border_over_width'] . "px');\n";
$str .= "jQuery('#menu" . $uniqueID . " .item1').parent().css('background-color', '" . $swmenupro['main_border_color_over'] . "');\n";
$str .= "jQuery('#menu" . $uniqueID . " .item1').corner('" . $swmenupro['t_corner_style'] . " " . (@$swmenupro['ttl_corner'] ? 'tl' : '') . " " . (@$swmenupro['ttr_corner'] ? 'tr' : '') . " " . (@$swmenupro['tbl_corner'] ? 'bl' : '') . " " . (@$swmenupro['tbr_corner'] ? 'br' : '') . " " . ($swmenupro['t_corner_size']) . "px');\n";
$str .= "jQuery('#menu" . $uniqueID . " .item1').parent().corner('" . $swmenupro['t_corner_style'] . " " . (@$swmenupro['ttl_corner'] ? 'tl' : '') . " " . (@$swmenupro['ttr_corner'] ? 'tr' : '') . " " . (@$swmenupro['tbl_corner'] ? 'bl' : '') . " " . (@$swmenupro['tbr_corner'] ? 'br' : '') . " " . ($swmenupro['t_corner_size'] + $swmenupro['main_border_over_width']) . "px');\n";
// $str .= "jQuery('#outerwrap').css('z-index','1');\n";
$str .= "}else{\n";
$str .= "jQuery('#menu" . $uniqueID . " .item1').corner('keep " . $swmenupro['t_corner_style'] . " " . (@$swmenupro['ttl_corner'] ? 'tl' : '') . " " . (@$swmenupro['ttr_corner'] ? 'tr' : '') . " " . (@$swmenupro['tbl_corner'] ? 'bl' : '') . " " . (@$swmenupro['tbr_corner'] ? 'br' : '') . " " . ($swmenupro['t_corner_size']) . "px');\n";
$str .= "}\n";
}else{
$str .= "jQuery('#menu" . $uniqueID . " .item1').corner('" . $swmenupro['t_corner_style'] . " " . (@$swmenupro['ttl_corner'] ? 'tl' : '') . " " . (@$swmenupro['ttr_corner'] ? 'tr' : '') . " " . (@$swmenupro['tbl_corner'] ? 'bl' : '') . " " . (@$swmenupro['tbr_corner'] ? 'br' : '') . " " . ($swmenupro['t_corner_size']) . "px');\n";
}
}
if (($swmenupro['s_corner_style'] != 'none') && ($swmenupro['s_corner_style'])&& ($swmenupro['s_corner_style'] != 'curvycorner')){
if (($swmenupro['sub_border_width'] > 0) && ($swmenupro['sub_border_style'] != 'none')) {
$str .= "if (jQuery.browser.msie && jQuery.browser.version < 9) {\n";
// $str .= "jQuery('.section').css('z-index','-1');\n";
// $str .= "jQuery('.section').wrap('<span></span>');\n";
// $str .= "jQuery('.section').parent().css('padding', '" . $swmenupro['sub_border_width'] . "px');\n";
// $str .= "jQuery('.section').parent().css('background-color', '" . $swmenupro['sub_border_color'] . "');\n";
$str .= "jQuery('.section').corner('" . $swmenupro['s_corner_style'] . " " . (@$swmenupro['stl_corner'] ? 'tl' : '') . " " . (@$swmenupro['str_corner'] ? 'tr' : '') . " " . (@$swmenupro['sbl_corner'] ? 'bl' : '') . " " . (@$swmenupro['sbr_corner'] ? 'br' : '') . " " . ($swmenupro['s_corner_size']) . "px');\n";
// $str .= "jQuery('.section').parent().corner('" . $swmenupro['s_corner_style'] . " " . (@$swmenupro['stl_corner'] ? 'tl' : '') . " " . (@$swmenupro['str_corner'] ? 'tr' : '') . " " . (@$swmenupro['sbl_corner'] ? 'bl' : '') . " " . (@$swmenupro['sbr_corner'] ? 'br' : '') . " " . ($swmenupro['s_corner_size'] + $swmenupro['sub_border_width']) . "px');\n";
// $str .= "jQuery('#outerwrap').css('z-index','1');\n";
$str .= "}else{\n";
$str .= "jQuery('.section').corner('keep " . $swmenupro['s_corner_style'] . " " . (@$swmenupro['stl_corner'] ? 'tl' : '') . " " . (@$swmenupro['str_corner'] ? 'tr' : '') . " " . (@$swmenupro['sbl_corner'] ? 'bl' : '') . " " . (@$swmenupro['sbr_corner'] ? 'br' : '') . " " . ($swmenupro['s_corner_size']) . "px');\n";
$str .= "}\n";
}else{
if (@$swmenupro['stl_corner'] + @$swmenupro['str_corner'] != 0) {
$str .= "jQuery('#menu" . $uniqueID . " .section .item2.first').corner('" . $swmenupro['s_corner_style'] . " " . (@$swmenupro['stl_corner'] ? 'tl' : '') . " " . (@$swmenupro['str_corner'] ? 'tr' : '') . " " . @$swmenupro['s_corner_size'] . "px');\n";
}
if (@$swmenupro['sbl_corner'] + @$swmenupro['sbr_corner'] != 0) {
$str .= "jQuery('#menu" . $uniqueID . " .section .item2.last').corner('" . $swmenupro['s_corner_style'] . " " . (@$swmenupro['sbl_corner'] ? 'bl' : '') . " " . (@$swmenupro['sbr_corner'] ? 'br' : '') . " " . @$swmenupro['s_corner_size'] . "px');\n";
}
}
}
if (($swmenupro['si_corner_style'] != 'none') && ($swmenupro['si_corner_style'])&& ($swmenupro['si_corner_style'] != 'curvycorner')){
if (($swmenupro['sub_border_width'] > 0) && ($swmenupro['sub_border_style'] != 'none')) {
$str .= "if (jQuery.browser.msie && jQuery.browser.version < 9) {\n";
// $str .= "jQuery('.section').css('z-index','-1');\n";
// $str .= "jQuery('.section').wrap('<span></span>');\n";
// $str .= "jQuery('.section').parent().css('padding', '" . $swmenupro['sub_border_width'] . "px');\n";
// $str .= "jQuery('.section').parent().css('background-color', '" . $swmenupro['sub_border_color'] . "');\n";
$str .= "jQuery('.section').corner('" . $swmenupro['si_corner_style'] . " " . (@$swmenupro['sitl_corner'] ? 'tl' : '') . " " . (@$swmenupro['sitr_corner'] ? 'tr' : '') . " " . (@$swmenupro['sibl_corner'] ? 'bl' : '') . " " . (@$swmenupro['sibr_corner'] ? 'br' : '') . " " . ($swmenupro['si_corner_size']) . "px');\n";
// $str .= "jQuery('.section').parent().corner('" . $swmenupro['s_corner_style'] . " " . (@$swmenupro['stl_corner'] ? 'tl' : '') . " " . (@$swmenupro['str_corner'] ? 'tr' : '') . " " . (@$swmenupro['sbl_corner'] ? 'bl' : '') . " " . (@$swmenupro['sbr_corner'] ? 'br' : '') . " " . ($swmenupro['s_corner_size'] + $swmenupro['sub_border_width']) . "px');\n";
// $str .= "jQuery('#outerwrap').css('z-index','1');\n";
$str .= "}else{\n";
$str .= "jQuery('.section').corner('" . $swmenupro['si_corner_style'] . " " . (@$swmenupro['sitl_corner'] ? 'tl' : '') . " " . (@$swmenupro['sitr_corner'] ? 'tr' : '') . " " . (@$swmenupro['sibl_corner'] ? 'bl' : '') . " " . (@$swmenupro['sibr_corner'] ? 'br' : '') . " " . ($swmenupro['si_corner_size']) . "px');\n";$str .= "}\n";
}else{
if (@$swmenupro['sitl_corner'] + @$swmenupro['sitr_corner'] +@$swmenupro['sibl_corner'] + @$swmenupro['sibr_corner'] != 0) {
$str .= "jQuery('#menu" . $uniqueID . " .item2').corner('" . $swmenupro['si_corner_style'] . " " . (@$swmenupro['sitl_corner'] ? 'tl' : '') . " " . (@$swmenupro['sitr_corner'] ? 'tr' : '') . " " . (@$swmenupro['sibl_corner'] ? 'bl' : '') . " " . (@$swmenupro['sibr_corner'] ? 'br' : '') . " " . ($swmenupro['si_corner_size']) . "px');\n";
}
}
}
if ($swmenupro['overlay_hack']) {
$str .= "jQuery('#menu" . $uniqueID . "').parents().css('overflow','visible');\n";
$str .= "jQuery('html').css('overflow','auto');\n";
$str .= "jQuery('#menu" . $uniqueID . "').parents().css('z-index','100');\n";
$str .= "jQuery('#menu" . $uniqueID . "').css('z-index','101');\n";
}
if ($swmenupro['top_ttf']) {
$str .= "Cufon.replace('.ddmx" . $uniqueID . " .item1',{hover: true, fontFamily: '" . $swmenupro['top_font_face']. "' });\n";
}
if ($swmenupro['sub_ttf']) {
$str .= "Cufon.replace('.ddmx" . $uniqueID . " .item2',{hover: true, fontFamily: '" . $swmenupro['sub_font_face']. "' });\n";
}
$str .= "//-->\n";
$str .= "</script>\n";
// $str .= swmenu_gettooltip($ordered);
return $str;
}
?>