/**
  * Profile remove
  */
 public function remove()
 {
     $framework = Zo2Factory::getFramework();
     $id = $framework->template->id;
     $profile = Zo2Factory::getProfile();
     if ($profile->delete()) {
         $this->_redirect(JRoute::_('index.php?option=com_templates&view=style&layout=edit&id=' . $id, false), JText::_('PLG_ZO2_PROFILE_DELETED'));
     }
 }
 /**
  * Admin layout builder
  * @return type
  */
 public function builder()
 {
     $assets = Zo2Assets::getInstance();
     $assets->addScript('vendor/bootbox-3.3.0.min.js');
     $assets->addScript('zo2/js/adminlayout.min.js');
     $assets->addStyleSheet('vendor/bootstrap/core/css/bootstrap.gridsystem.css');
     /**
      * @uses    Anything need prepred for display will put here. Do not put process code insite layout template file
      */
     $html = new Zo2Html();
     $params = Zo2Framework::getInstance()->template->params;
     $profile = Zo2Factory::getProfile();
     if (is_object($profile->layout)) {
         $layoutData = $profile->layout->layout;
     } else {
         $layoutData = $profile->layout;
     }
     $html->set('params', $params);
     $html->set('layoutData', $layoutData);
     return $html->fetch('admin/body/sidebar/builder/layout.php');
 }
 /**
  * 
  */
 public function renameProfile()
 {
     if ($this->_isAuthorized()) {
         /* Zo2 data */
         $profile = JFactory::getApplication()->input->get('profile');
         $newProfileName = JFactory::getApplication()->input->get('newProfile');
         if ($profile != '' && $newProfileName != '') {
             $profile = Zo2Factory::getProfile($profile);
             if ($profile->rename($newProfileName)) {
                 $this->_ajax->addExecute('zo2.admin.profile.load(\'' . $newProfileName . '\');');
             } else {
             }
         }
         $this->_ajax->addExecute('jQuery(\'#modal-profile-rename\').modal("hide");');
     }
     $this->_ajax->response();
 }
/**
 * Zo2 (http://www.zootemplate.com/zo2)
 * A powerful Joomla template framework
 *
 * @version     1.4.3
 * @since       1.4.3
 * @uses        For Joomla! 3.x
 * @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
 */
defined('_JEXEC') or die('Restricted access');
$currentProfile = Zo2Factory::getProfile();
$url = JUri::getInstance();
$url->setVar('zo2_task', 'admin.downloadBackup');
$downloadProfileUrl = $url->toString();
?>
<div class="row-fluid">
    <div class="span12">
        <!-- Zo2 Messsage -->
        <div id="zo2-messages" class="zo2-messages wrapper">           
        </div>
        <!-- Overlay -->
        <div id="zo2-overlay" class="zo2-overlay hide">
            <span class="zo2-overlay-loadding"></span>
        </div>
        <!-- Navbar -->
        <div class="navbar">
 /**
  * 
  * @param type $isAdmin
  * @return string
  */
 function renderMenu($isAdmin = false)
 {
     $this->isAdmin = $isAdmin;
     $prefix = '<nav data-zo2selectable="navbar" class="wrap zo2-menu navbar navbar-default" role="navigation">
             <div class="navbar-collapse collapse">';
     $suffix = '</div></nav>';
     $html = '';
     $menuConfig = Zo2Factory::getProfile()->getMenuConfig();
     $hover = ' data-hover="' . $menuConfig->get('hover_type') . '"';
     $animation = $menuConfig->get('animation');
     $duration = $menuConfig->get('duration', 300);
     if ((int) $duration <= 0) {
         $duration = 300;
     }
     $class = 'class="zo2-megamenu' . ($animation ? ' animate ' . $animation : '') . '"';
     $data = $animation && $duration ? ' data-duration="' . $duration . '"' : '';
     if (isset($this->_items)) {
         if (count($this->_items)) {
             $keys = array_keys($this->_items);
             $html .= "<div {$class}{$data}{$hover}>";
             $html .= $this->getMenu(null, $keys[0]);
             $html .= "</div>";
             if ($isAdmin == true) {
                 return $html;
             } elseif ($isAdmin == false) {
                 return $prefix . $html . $suffix;
             }
         }
     }
     return '';
 }
        <?php 
echo Zo2Html::field('description', null, array('text' => JText::_('ZO2_ADMIN_DESCRIPTION_THEMECOLOR'), 'subtext' => '<a href="http://docs.zootemplate.com/category/zo2/themecolor">Document</a>'));
?>


        <div id="theme">
            <div id="zo2_themes_container" class="profiles-pane-inner">

                <?php 
$presetPath = Zo2Factory::getPath('templates://assets/presets.json');
$presets = array();
if ($presetPath) {
    $presets = json_decode(file_get_contents($presetPath), true);
}
$templatePath = Zo2Factory::getUrl('templates://');
$profile = Zo2Factory::getProfile();
$presetTheme = new JObject($profile->get('theme'));
/**
 * @todo Must use JRegistry
 */
$preset_data = array('name' => $presetTheme->get('name'), 'css' => $presetTheme->get('css'), 'less' => $presetTheme->get('less'), 'boxed' => $presetTheme->get('boxed', 0), 'background' => $presetTheme->get('background'), 'header' => $presetTheme->get('header'), 'header_top' => $presetTheme->get('header_top'), 'text' => $presetTheme->get('text'), 'link' => $presetTheme->get('link'), 'link_hover' => $presetTheme->get('link_hover'), 'bottom1' => $presetTheme->get('bottom1'), 'bottom2' => $presetTheme->get('bottom2'), 'footer' => $presetTheme->get('footer'), 'bg_image' => $presetTheme->get('bg_image'), 'bg_pattern' => $presetTheme->get('bg_pattern'), 'background' => $presetTheme->get('background'));
if (!isset($preset_data['name'])) {
    $preset_data['name'] = 'custom';
}
if (!isset($preset_data['boxed'])) {
    $preset_data['boxed'] = 1;
}
if (!isset($preset_data['bg_image'])) {
    $preset_data['bg_image'] = '';
}
$themeJson = htmlspecialchars(json_encode($profile->get('theme')), ENT_QUOTES, 'UTF-8');
 /**
  * Framework init
  */
 public function init()
 {
     if (!defined('ZO2_LOADED')) {
         $this->template = Zo2Factory::getTemplate();
         /* Load language */
         $language = JFactory::getLanguage();
         $language->load('plg_system_zo2', ZO2PATH_ROOT);
         JHtml::_('jquery.framework');
         $jinput = JFactory::getApplication()->input;
         /**
          * Init framework variables
          */
         $this->path = Zo2Path::getInstance();
         /* Zo2 root dir */
         $this->path->registerNamespace('zo2', ZO2PATH_ROOT);
         /* Zo2 html */
         $this->path->registerNamespace('html', ZO2PATH_ROOT . '/html');
         /* Zo2 assets */
         $this->path->registerNamespace('assets', ZO2PATH_ROOT . '/assets');
         /**
          * Zo2 template
          */
         $templateName = $this->template->template;
         $this->path->registerNamespace('zo2', JPATH_ROOT . '/templates/' . $templateName);
         $this->path->registerNamespace('assets', JPATH_ROOT . '/templates/' . $templateName . '/assets');
         /* Current */
         $this->path->registerNamespace('templates', JPATH_ROOT . '/templates/' . $templateName);
         /* Override Zo2 html directory */
         $this->path->registerNamespace('html', JPATH_ROOT . '/templates/' . $templateName . '/html');
         /**
          * Init Zo2 objects
          */
         $this->assets = Zo2Assets::getInstance();
         if (JFactory::getApplication()->isAdmin()) {
             JHtml::_('jquery.ui', array('core', 'sortable'));
             $this->profile = Zo2Factory::getProfile();
         } else {
             $this->profile = Zo2Factory::getProfile();
         }
         $this->layout = new Zo2Layout($this->profile->layout);
         $this->_loadAssets();
         define('ZO2_LOADED', 1);
     }
 }