| Current Path : /home/azimutno/www/demo/modules/mod_swmenupro/helpers/ |
| Current File : /home/azimutno/www/demo/modules/mod_swmenupro/helpers/column.php |
<?php
/**
* swmenupro v6.0
* http://swmenupro.com
* Copyright 2006 Sean White
* */
defined('_JEXEC') or die('Restricted access');
function columnMenu($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."/" ;
}
$activesub = 0;
$name = "";
$uniqueID = $swmenupro['id'];
$number = count($ordered);
$topcount=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";
}
for($counter=0;$counter<count($ordered);$counter++){
if ($ordered[$counter]['indent'] == 0) {
$topcount++;
$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";
}
if (islast($ordered, $counter)) {
if (($ordered[$counter]['ID'] == $swmenupro['active_menu'])) {
$str .= "<td class='item11 acton last'> \n";
} else {
$str .= "<td class='item11 last'> \n";
}
} else {
if (($ordered[$counter]['ID'] == $swmenupro['active_menu'])) {
$str .= "<td class='item11 acton'> \n";
$activesub = $topcount-1;
} else {
$str .= "<td class='item11'> \n";
}
}
$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 (($counter + 1 != $number) && ($ordered[$counter + 1]['indent'] > $ordered[$counter]['indent']) && $swmenupro['disable_parent']) {
$ordered[$counter]['URL'] = "javascript:void(0);";
}
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) {
$str .= "<table class=\"section\" style=\"border:0 !important;display:none;\"><tr><td></td> \n";
} elseif ($ordered[$counter + 1]['indent'] == 0) {
$str .= "<table class=\"section\" style=\"border:0 !important;display:none;\"><tr><td></td> \n";
} else {
$str .= "<table class='section' cellspacing=\"0\" border=\"0\" cellpadding=\"0\" ><tr>\n";
$level1=chain('ID', 'PARENT', 'ORDER', $ordered, $ordered[$counter]['ID'], 1);
for($i=0;$i<count($level1);$i++){
$level1_classname="";
if($i==0){
$level1_classname.=" first";
}
if($i==(count($level1)-1)){
$level1_classname.=" last";
}
$str.= "<td valign='top' class='level1_outer".$level1_classname."'>\n";
$level1_classname="item2 level1".$level1_classname;
$level1[$i]['URL'] = str_replace('&', '&', $level1[$i]['URL']);
$name = swmenu_getname($level1[$i]);
if ($level1[$i]['TARGETLEVEL'] == "0") {
$str .= "<a class=\"" . $level1_classname . "\" href=\"javascript:void(0);\" >" . $name . "</a> \n";
} else {
switch ($ordered[$counter]['TARGET']) {
case 1:
$str .= '<a href="' . $level1[$i]['URL'] . '" ' . $style . ' target="_blank" class="' . $level1_classname . '" >' . $name . '</a>';
break;
case 2:
$str .= "<a href=\"#\" onclick=\"javascript: window.open('" . $level1[$i]['URL'] . "', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550'); return false\" class=\"" . $level1_classname . "\">" . $name . "</a>\n";
break;
case 3:
$str .= '<a class="' . $level1_classname . '" >' . $name . '</a>';
break;
default:
$str .= "<a href=\"" . $level1[$i]['URL'] . "\" class=\"" . $level1_classname . "\" >" . $name . "</a>\n";
break;
}
}
$str.="</td>\n";
}
$str.="</tr><tr>\n";
for($i=0;$i<count($level1);$i++){
$levelx=chain('ID', 'PARENT', 'ORDER', $ordered, $level1[$i]['ID'], 20);
if($i==0){
$str.= "<td valign='top' class='levelx_outer first'>\n";
}else if($i==(count($level1)-1)){
$str.= "<td valign='top' class='levelx_outer last'>\n";
}else{
$str.= "<td valign='top' class='levelx_outer'>\n";
}
for($j=0;$j<count($levelx);$j++){
$levelx_classname="item2 levelx";
if($j==0){
$levelx_classname.=" first";
}
if($j==(count($levelx)-1)){
$levelx_classname.=" last";
}
$levelx[$j]['URL'] = str_replace('&', '&', $levelx[$j]['URL']);
$name = swmenu_getname($levelx[$j]);
if ($levelx[$j]['TARGETLEVEL'] == "0") {
$str .= "<a class=\"" . $levelx_classname . "\" href=\"javascript:void(0);\" >" . $name . "</a> \n";
} else {
switch ($ordered[$counter]['TARGET']) {
case 1:
$str .= '<a href="' . $levelx[$j]['URL'] . '" ' . $style . ' target="_blank" class="' . $levelx_classname . '" >' . $name . '</a>';
break;
case 2:
$str .= "<a href=\"#\" onclick=\"javascript: window.open('" . $levelx[$j]['URL'] . "', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550'); return false\" class=\"" . $levelx_classname . "\">" . $name . "</a>\n";
break;
case 3:
$str .= '<a class="' . $levelx_classname . '" >' . $name . '</a>';
break;
default:
$str .= "<a href=\"" . $levelx[$j]['URL'] . "\" class=\"" . $levelx_classname . "\" >" . $name . "</a>\n";
break;
}
}
}
$str.="</td>\n";
}
}
//$counter++;
if ($swmenupro['orientation'] == "vertical/right" || $swmenupro['orientation'] == "vertical/left") {
$str .= "</tr> \n";
}
$str .= "</table> \n";
}
// $str .= "</td> \n";
}
if ($swmenupro['orientation'] == "horizontal/down" || $swmenupro['orientation'] == "horizontal/left" || $swmenupro['orientation'] == "horizontal/up") {
$str .= "</tr> \n";
}
// $swmenupro['reveal_type']='hover';
$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 = 0;\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['levelx_sub_left'] . ";\n";
$str .= "ddmx" . $uniqueID . ".position.levelX.top = " . $swmenupro['levelx_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 = 'true' ;\n";
$str .= "ddmx" . $uniqueID . ".autoposition = " . ($swmenupro['auto_position'] ? 'true' : 'false') . ";\n";
$str .= "ddmx" . $uniqueID . ".revealtype = '" . ($swmenupro['revealtype'] ? 'click' : '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";
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['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";
return $str;
}
?>