<?php 
echo JText::_('ZO2_ADMIN_MEGA_MENU_ANIMATION_ZOOM');
?>
</option>                        
                        <option value="elastic"
                                <?php 
echo $menuAnimation == 'elastic' ? 'selected="selected"' : '';
?>
 >
                            <?php 
echo JText::_('ZO2_ADMIN_MEGA_MENU_ANIMATION_ELASTIC');
?>
</option>
                    </select>
                </div>
            </div>

            <!-- Duration -->
            <?php 
echo Zo2Html::field('text', array('label' => JText::_('ZO2_ADMIN_MEGA_MENU_DURATION'), 'description' => JText::_('ZO2_ADMIN_MEGA_MENU_DURATION_DESC')), array('name' => 'jform[params][menu_duration]', 'value' => Zo2Framework::getParam('menu_duration', 300), 'default' => 300));
?>

            <!-- Menu type -->           
            <?php 
$model = new Zo2ModelJoomla();
echo Zo2Html::field('megamenu', array(), array('id' => 'jform_params_menu_type', 'name' => 'jform[params][menu_type]', 'value' => Zo2Framework::getParam('menu_type', 'mainmenu'), 'modules' => $model->getModules()));
?>

        </div>
    </div>
</div>
 function loadMegaMenu()
 {
     $model = new Zo2ModelJoomla();
     $lang = JFactory::getLanguage();
     $menu = JFactory::getApplication()->getMenu();
     $items = $model->getMenuItemsByType($this->_menuType);
     /* Get active menu */
     $defMenu = $menu->getDefault($lang->getTag());
     $active_menu = $menu->getActive() ? $menu->getActive() : $defMenu;
     $menu_id = $active_menu ? $active_menu->id : 0;
     $this->_activeMenuId = $menu_id;
     $menu_tree = $active_menu->tree ? $active_menu->tree : array();
     if ($menu->getActive() == $defMenu) {
         $menu_tree[] = $menu->getDefault()->id;
         /* Menu tree should be include Default home menu & Default home with language menu */
     }
     // Get all child menus for a parent menu
     foreach ($items as &$item) {
         $parent_id = $item->parent_id;
         if (isset($this->children[$parent_id])) {
             $menus = $this->children[$parent_id];
         } else {
             $menus = array();
         }
         // push a item into $menus array
         array_push($menus, $item);
         $this->children[$parent_id] = $menus;
     }
     foreach ($items as &$item) {
         $itemid = 'item-' . $item->id;
         $config = isset($this->_configs[$itemid]) ? $this->_configs[$itemid] : array();
         if (isset($config['caption']) && $config['caption']) {
             $config['caption'] = str_replace(array('[lt]', '[gt]'), array('<', '>'), $config['caption']);
         }
         if ($item->level == 1 && isset($config['caption']) && $config['caption']) {
             $item->top_level_caption = true;
         }
         // active - current
         $class = '';
         if ($item->id == $menu_id) {
             $class .= ' current';
         }
         if (in_array($item->id, $menu_tree)) {
             $class .= ' active';
         } elseif ($item->type == 'alias') {
             if (count($menu_tree) > 0 && $item->params->get('aliasoptions') == $menu_tree[count($menu_tree) - 1]) {
                 $class .= ' active';
             } elseif (in_array($item->params->get('aliasoptions'), $menu_tree)) {
                 $class .= ' alias-parent-active';
             }
         }
         $item->class = $class;
         $item->show_group = false;
         $item->isdropdown = false;
         if (isset($config['group'])) {
             $item->show_group = true;
         } else {
             // if this item is a parent then setting up the status is dropdown
             if (isset($config['submenu']) || isset($this->children[$item->id]) && (!isset($config['hidesub']) || $this->edit)) {
                 $item->isdropdown = true;
             }
         }
         $item->megamenu = $item->isdropdown || $item->show_group;
         if ($item->megamenu && !isset($config['submenu'])) {
             $firstChild = $this->children[$item->id][0]->id;
             $config['submenu'] = array('rows' => array(array(array('width' => 12, 'item' => $firstChild))));
         }
         $item->config = $config;
         $item->flink = $item->link;
         // Reverted back for CMS version 2.5.6
         switch ($item->type) {
             case 'separator':
             case 'heading':
                 // No further action needed.
                 continue;
             case 'url':
                 if (strpos($item->link, 'index.php?') === 0 && strpos($item->link, 'Itemid=') === false) {
                     // If this is an internal Joomla link, ensure the Itemid is set.
                     $item->flink = $item->link . '&Itemid=' . $item->id;
                 }
                 break;
             case 'alias':
                 // If this is an alias use the item id stored in the parameters to make the link.
                 $item->flink = 'index.php?Itemid=' . $item->params->get('aliasoptions');
                 break;
             default:
                 $router = JSite::getRouter();
                 if ($router->getMode() == JROUTER_MODE_SEF) {
                     $item->flink = 'index.php?Itemid=' . $item->id;
                 } else {
                     $item->flink .= '&Itemid=' . $item->id;
                 }
                 break;
         }
         if (strcasecmp(substr($item->flink, 0, 4), 'http') && strpos($item->flink, 'index.php?') !== false) {
             $item->flink = JRoute::_($item->flink, true, $item->params->get('secure'));
         } else {
             $item->flink = JRoute::_($item->flink);
         }
         // We prevent the double encoding because for some reason the $item is shared for menu modules and we get double encoding
         // when the cause of that is found the argument should be removed
         $item->title = htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8', false);
         $item->anchor_css = htmlspecialchars($item->params->get('menu-anchor_css', ''), ENT_COMPAT, 'UTF-8', false);
         $item->anchor_title = htmlspecialchars($item->params->get('menu-anchor_title', ''), ENT_COMPAT, 'UTF-8', false);
         $item->menu_image = $item->params->get('menu_image', '') ? htmlspecialchars($item->params->get('menu_image', ''), ENT_COMPAT, 'UTF-8', false) : '';
         $this->_items[$item->id] = $item;
     }
 }
<?php

/**
 * Zo2 (http://www.zootemplate.com/zo2)
 * A powerful Joomla template framework
 *
 * @link        http://www.zootemplate.com/zo2
 * @link        https://github.com/cleversoft/zo2
 * @author      ZooTemplate <http://zootemplate.com>
 * @copyright   Copyright (c) 2014 CleverSoft (http://cleversoft.co/)
 * @license     GPL v2$positions
 */
defined('_JEXEC') or die('Restricted access');
$framework = Zo2Framework::getInstance();
$addons = $framework->getRegisteredAddons();
$model = new Zo2ModelJoomla();
$positions = $model->getAvaiablePositions();
?>
<div id="layoutbuilder-container">
    <!-- Hidden fields -->
    <fieldset>
        <!-- Input field to store generate layout data -->
        <input type="text" 
               name="jform[params][layout]"
               id="jform_params_layout"
               value="<?php 
echo json_encode($layoutData, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP);
?>
" 
               style="display: none" 
               class="hfLayoutHtml" />