Your IP : 216.73.217.47


Current Path : /home/azimutno/www/demo/modules/mod_swmenupro/helpers/
Upload File :
Current File : /home/azimutno/www/demo/modules/mod_swmenupro/helpers/accordion.php

<?php

/**
 * swmenupro v6.0
 * http://swmenupro.com
 * Copyright 2006 Sean White
 * */
defined('_JEXEC') or die('Restricted access');



function Accordian($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."/" ;
    }
    // echo $expand;
    $topcounter = 0;
    $counter = 0;
    $subcount = -1;
    $doMenu = 1;
    $act = 0;
    $uniqueID = $swmenupro['id'];
    $number = count($ordered);
    $topmenu = chain('ID', 'PARENT', 'ORDER', $ordered, $swmenupro['parentid'], 1);
    $topcount = count($topmenu);
  

    if ($swmenupro['top_sub_indicator']) {
        // echo $top_sub_indicator;
        $indicator_image1 = "<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' />";
    }
    if ($swmenupro['sub_sub_indicator']) {
        $indicator_image2 = "<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' />";
    }


        $str = "\n<table id=\"menu" . $uniqueID . "\" align=\"" . $swmenupro['position'] . "\" ><tr><td><div id=\"click-menu" . $uniqueID . "\" class=\"click-menu" . $uniqueID . "\" > \n";
        $act = "";
        while ($doMenu) {
            if ($ordered[$counter]['indent'] == 0) {
                $topcounter++;
                $ordered[$counter]['URL'] = str_replace('&', '&amp;', $ordered[$counter]['URL']);
                $hasSub = 0;
                $name = swmenu_getname($ordered[$counter]);
                if ($counter + 1 == $number) {
                    $doSubMenu = 0;
                    $topmenu[$topcounter]['hassub'] = 0;
                    $doMenu = 0;
                    $classname = "nonbox" . $uniqueID;
                } elseif ($ordered[$counter + 1]['indent'] == 0) {
                    $doSubMenu = 0;
                    $topmenu[$topcounter]['hassub'] = 0;
                    $classname = "nonbox" . $uniqueID;
                } else {
                    $doSubMenu = 1;
                    $act == $topcounter ? $topmenu[($topcounter)]['hassub'] = 1 : $topmenu[($topcounter)]['hassub'] = 0;
                    $classname = "box" . $uniqueID;
                    $subcount++;
                    if ($swmenupro['disable_parent']) {
                        $ordered[$counter]['URL'] = "javascript:void(0);";
                    }
                }
                if (($ordered[$counter]['ID'] == $swmenupro['active_menu']) && $doSubMenu) {
                    $act = $subcount;
                } elseif (($ordered[$counter]['ID'] == $swmenupro['active_menu']) && !$doSubMenu) {
                    $act = "";
                }
                $linktext = "id=\"slideclick" . $uniqueID . $topcounter . "\" class=\"" . (($ordered[$counter]['ID'] == $swmenupro['active_menu']) ? "inbox1 act" : "inbox1") . "" . ($topcounter == $topcount ? " last" : "" ) . "\"";
                if ($ordered[$counter]['TARGETLEVEL'] == "0") {
                    $str .= '<div class="' . $classname . '" id="topclick' . $uniqueID . ($counter + 1) . '"><a  ' . $linktext . ' href="javascript:void(0);" >' . $name . '</a></div>' . "\n";
                } else {
                    switch ($ordered[$counter]['TARGET']) {
                        case 1:
                            $str .= '<div class="' . $classname . '" id="topclick' . $uniqueID . ($counter + 1) . '"><a  ' . $linktext . ' href="' . $ordered[$counter]['URL'] . '" target="_blank" >' . $name . '</a></div>' . "\n";
                            break;
                        case 2:
                            $str .= "<div class='" . $classname . "' id='topclick" . $uniqueID . ($counter + 1) . "'><a ' . $linktext . ' 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\" >" . $name . "</a></div>\n";
                            break;
                        case 3:
                            $str .= "<div class='" . $classname . "' id='topclick" . $uniqueID . ($counter + 1) . "'>" . $name . "\n";
                            break;
                        default:
                            $str .= '<div class="' . $classname . '" id="topclick' . $uniqueID . ($counter + 1) . '"><a ' . $linktext . ' href="' . $ordered[$counter]['URL'] . '" >' . $name . '</a></div>' . "\n";
                            break;
                    }
                }
                $counter++;
                if (!$doSubMenu) {
                    
                }
                while ($doSubMenu) {
                    if ($ordered[$counter]['indent'] != 0) {
                        if (($ordered[$counter]['indent'] == 1) && ($ordered[$counter - 1]['indent'] == 0)) {
                            $str .= '<div id="subsection' . $uniqueID . $topcounter . '" class="section' . $uniqueID . '">' . "\n";
                        }
                        $ordered[$counter]['URL'] = str_replace('&', '&amp;', $ordered[$counter]['URL']);
                        $name = swmenu_getname($ordered[$counter]);
                        if (($counter + 1 == $number) || ($ordered[$counter + 1]['indent'] == 0)) {
                            $doSubMenu = 0;
                        }
                        if ($ordered[$counter]['indent'] > 1) {
                            $ordered[$counter]['indent'] = 1;
                        }
                       
                     
                       if (!$swmenupro['preview']){
                           $sub_itemid=sw_getsubactive($ordered);
                       }else{
                           $sub_itemid=0;
                       }
                       

                        $classname = "inbox2";
                        if ($ordered[$counter]['indent'] > $ordered[$counter - 1]['indent']) {
                            $classname .= " first";
                        }
                        if (($counter + 1 == $number) || ($ordered[$counter + 1]['indent'] == 0)) {
                            $classname .= " last";
                        }


                        if ($sub_itemid == $ordered[$counter]['ID']) {
                            $classname .= ' active';
                        }
                        if ($ordered[$counter]['TARGETLEVEL'] == "0") {
                            $str .= "<a id=\"subclick" . $uniqueID . $ordered[$counter]['ID'] . "\" class=\"" . $classname . "\" href=\"javascript:void(0);\" >" . $name . "</a>\n";
                        } else {
                            switch ($ordered[$counter]['TARGET']) {
                                case 1:
                                    $str .= '<a  id="subclick' . $uniqueID . $ordered[$counter]['ID'] . '" class="' . $classname . '" href="' . $ordered[$counter]['URL'] . '" target="_blank" >' . $name . '</a>' . "\n";
                                    break;
                                case 2:
                                    $str .= "<a  id=\"subclick" . $uniqueID . $ordered[$counter]['ID'] . "\" class=\"" . $classname . "\" 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\" >" . $name . "</a>\n";
                                    break;
                                case 3:
                                    $str .= '' . $name . '' . "\n";
                                    break;
                                default:
                                    $str .= '<a  id="subclick' . $uniqueID . $ordered[$counter]['ID'] . '" class="' . $classname . '" href="' . $ordered[$counter]['URL'] . '" >' . $name . '</a>' . "\n";
                                    break;
                            }
                        }
                        $counter++;
                        $hasSub = 1;
                    }
                }
            }
            if ($hasSub == 1) {
                $str .= "</div> \n";
            } else {
                $str .= " \n";
            }
            if ($counter == ($number)) {
                $doMenu = 0;
            }
        }
        $str .= "</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 .= "/***********************************************\n";
    $str .= "* Accordion Content script- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)\n";
    $str .= "* Visit http://www.dynamicDrive.com for hundreds of DHTML scripts\n";
    $str .= "* This notice must stay intact for legal use\n";
    $str .= "***********************************************/\n\n";
    $str .= "ddaccordion.init({\n";
    $str .= "headerclass: 'box" . $uniqueID . "',\n";
    $str .= "contentclass: 'section" . $uniqueID . "',\n";
    $str .= "revealtype:'" . ($swmenupro['revealtype'] ? 'click' : 'mouseover') . "',\n";
    $str .= "mouseoverdelay: " . $swmenupro['specialB'] . ",\n";
    $str .= "collapseprev: " . ($swmenupro['autoclose'] ? 'true' : 'false') . ", \n";
    $str .= "defaultexpanded: [" . $act . "],\n";
    $str .= "onemustopen: false,\n";
    $str .= "animatedefault: false,\n";
    $str .= "persiststate: false,\n";
    $str .= "toggleclass: ['','active'],\n";
    $str .= "togglehtml: [\"prefix\", \"" . $indicator_image1 . "\", \"" . $indicator_image2 . "\"],\n";
    $str .= "animatespeed:'normal',\n";
   // if ($overlay_hack) {
        //$str .= "ddaccordion.expandall('box". $uniqueID . "'),\n";
   // }
    $str .= "oninit:function(headers, expandedindices){ },\n";
    $str .= "onopenclose:function(header, index, state, isuseractivated){ }\n";
    $str .= "})\n";
    //$str .= "jQuery.noConflict();\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('#click-menu" . $swmenupro['id'] . "').css('z-index','-1');\n";
                $str .= "jQuery('#click-menu" . $swmenupro['id'] . "').wrap('<div></div>');\n";
                $str .= "jQuery('#click-menu" . $swmenupro['id'] . "').parent().css('padding', '" . $swmenupro['main_border_width'] . "px');\n";
                $str .= "jQuery('#click-menu" . $swmenupro['id'] . "').parent().css('background-color', '" . $swmenupro['main_border_color'] . "');\n";
                $str .= "jQuery('#click-menu" . $swmenupro['id'] . "').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('#click-menu" . $swmenupro['id'] . "').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('#click-menu" . $swmenupro['id'] . "').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('#click-menu" . $swmenupro['id'] . "').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('#click-menu" . $swmenupro['id'] . " .inbox1').css('z-index','-1');\n";
               // $str .= "jQuery('#swmenu .item1').wrap('<span></span>');\n";
                $str .= "jQuery('#click-menu" . $swmenupro['id'] . " .inbox1').parent().css('padding', '" . $swmenupro['main_border_over_width'] . "px');\n";
                $str .= "jQuery('#click-menu" . $swmenupro['id'] . " .inbox1').parent().css('background-color', '" . $swmenupro['main_border_color_over'] . "');\n";
                $str .= "jQuery('#click-menu" . $swmenupro['id'] . " .inbox1').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('#click-menu" . $swmenupro['id'] . " .inbox1').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('#click-menu" . $swmenupro['id'] . " .inbox1').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('#click-menu" . $swmenupro['id'] . " .inbox1').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" . $swmenupro['id'] . " .inbox2').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" . $swmenupro['id'] . " .inbox2').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('.section" . $swmenupro['id'] . " .inbox2.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('.section" . $swmenupro['id'] . " .inbox2.last').corner('" . $swmenupro['s_corner_style'] . " " . (@$swmenupro['sbl_corner'] ? 'bl' : '') . " " . (@$swmenupro['sbr_corner'] ? 'br' : '') . " " . @$swmenupro['s_corner_size'] . "px');\n";
               }
       }
        
        
        
    }
   
    if ($swmenupro['expand_all']) {
       
        $str .= "jQuery(document).ready(function($){\n";
        $str .= "ddaccordion.expandall('box" . $uniqueID . "');\n";
        $str .= "})\n";
       
    }
    
    
     if ($swmenupro['top_ttf']) {
       $str .= "Cufon.replace('.click-menu" . $swmenupro['id'] . " .inbox1',{hover: true, fontFamily: '" . $swmenupro['top_font_face'] . "' });\n";
        $str .= "Cufon.replace('.click-menu" . $swmenupro['id'] . " .inbox1-active',{hover: true, fontFamily: '" . $swmenupro['top_font_face'] . "' });\n";
    }
    if ($swmenupro['sub_ttf']) {
        $str .= "Cufon.replace('.click-menu" . $swmenupro['id'] . " .inbox2',{hover: true, fontFamily: '" . $swmenupro['sub_font_face'] . "' });\n";
        $str .= "Cufon.replace('.click-menu" . $swmenupro['id'] . " .inbox2-active',{hover: true, fontFamily: '" . $swmenupro['sub_font_face'] . "' });\n";
    }
     $str .= "//-->\n";
    $str .= "</script>\n";

    return $str;
}

?>