/** * * @param object|array $data */ public function __construct($data = null) { parent::__construct($data); $framework = Zo2Framework::getInstance(); /* Init default profile root directory */ $this->_profileDir = JPATH_ROOT . '/templates/' . $framework->template->template . '/assets/profiles'; }
public function getAvaiablePositions() { $templatePositions = Zo2Framework::getInstance()->getTemplatePositions(); $db = JFactory::getDbo(); $query = $db->getQuery(true)->select('m.position')->from('#__modules AS m')->where('m.published = 1')->where('m.client_id = 0'); $db->setQuery($query); $modulePositions = $db->loadColumn(); $list = array_merge($templatePositions, $modulePositions); $list = array_unique($list); return $list; }
/** * */ public function onAfterRender() { if ($this->_isZo2()) { $app = JFactory::getApplication(); $body = JResponse::getBody(); $jinput = JFactory::getApplication()->input; $framework = Zo2Framework::getInstance(); $assets = Zo2Assets::getInstance(); $body = str_replace('</body>', $assets->generateAssets('js') . '</body>', $body); $body = str_replace('</head>', $assets->generateAssets('css') . '</head>', $body); /* Apply back to body */ JResponse::setBody($body); } }
/** * 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'); }
<div class="span12"> <div class="row-fluid"> <div class="span12"> <h2>Information Zo2 Framework</h2> <div class="zo2-divider"></div> <p>Zo2 Framework is a Joomla template framework, built from scratch, and heavily support Bootstrap framework and LESS.</p> <p>Zo2 Framework comes with Drag & drop layout builder which allows you to create any number of stunning and unique layouts up to 5x faster than traditional way.</p> <p><a class="btn btn-primary btn-large" href="http://www.zootemplate.com/zo2" target="_blank">Learn more Zo2Framework</a></p> <div class="zo2-divider"></div> <h3>Version</h3> <p>Current version: <?php echo Zo2Framework::getInstance()->getManifest()->version; ?> </p> <?php $version = Zo2Framework::getInstance()->checkVersion(); switch ($version['compare']) { case '-1': echo '<span class="label label-important">Your Zo2 version is out of date.</span><br />'; break; case '0': echo '<span class="label label-success">Your Zo2 version is up to date.</span><br />'; break; case '1': echo '<span class="label label-info">Your Zo2 version newer than us.</span><br />'; break; } ?> <p><strong>Latest version: <?php echo $version['latestVersion']; ?>
<?php /** * Zo2 (http://www.zootemplate.com/zo2) * A powerful Joomla template framework * * @version 1.4.4 * @link http://www.zootemplate.com/zo2 * @link https://github.com/cleversoft/zo2 * @author ZooTemplate <http://zootemplate.com> * @copyright Copyright (c) 2015 CleverSoft (http://cleversoft.co/) * @license GPL v2 */ defined('_JEXEC') or die('Restricted Access'); /** * This file will use to init / register current template with ZO2 framework */ if (!class_exists('Zo2Framework')) { die('Zo2Framework not found'); } $framework = Zo2Framework::getInstance(); $framework->init(); $this->zo2 = new JRegistry(); $this->zo2->framework = $framework; $this->zo2->template = new Zo2Template(); $this->zo2->layout = $framework->layout; $this->zo2->utilities = Zo2Utilities::getInstance(); $framework->getTemplateLayouts();
echo JText::_('ZO2_USE_PROFILE'); ?> </label> <select id="zo2-profile" class="form-control pull-left" name="jform[params][profile]" > <!-- Display list of profiles --> <?php $profiles = Zo2Framework::getInstance()->getProfiles(); ?> <?php foreach ($profiles as $profile) { ?> <option value="<?php echo trim($profile->name); ?> " <?php echo $profile->name == Zo2Framework::getInstance()->template->params->get('profile') ? 'selected="selected"' : ''; ?> ><?php echo trim($profile->name); ?> </option> <?php } ?> </select> </div> </div> </div> <div class="pull-right"> <button type="button" class="btn btn-default" onclick="zo2.admin.clearCache();
/** * Get instance of Zo2Profile by name * @staticvar array $profiles * @param type $profile * @return \Zo2Profile */ public static function getProfile($profile = null) { static $profiles = array(); $profileName = 'default'; if ($profile === null) { if (JFactory::getApplication()->isSite()) { $profileName = Zo2Framework::getInstance()->template->params->get('profile', 'default'); $profileName = JFactory::getApplication()->input->get('profile', $profileName); } else { $profileName = JFactory::getApplication()->input->get('profile'); if (empty($profileName)) { $profileName = Zo2Framework::getInstance()->template->params->get('profile', 'default'); } } } else { if (is_string($profile)) { $profileName = $profile; } elseif ($profile instanceof Zo2Profile) { $profileName = $profile->name; } } if (!is_string($profileName) || empty($profileName)) { $profileName = 'default'; } if (!isset($profiles[$profileName])) { $profile = new Zo2Profile(); $profile->load($profileName); $profiles[$profileName] = $profile; } return $profiles[$profileName]; }
/** * Hide component from frontpage * @return bool */ private static function hideComponent() { $framework = Zo2Framework::getInstance(); $params = Zo2Factory::getTemplate()->params; if ((int) $params->get('component_area', 0) && $framework->isFrontPage()) { return true; } else { return false; } }
<option value="12"><?php echo JText::_('ZO2_ADMIN_FORMFIELD_LAYOUT_OFFSET_LB'); ?> 12</option> </select> </div> </div> <div class="control-group"> <label class="control-label" for="ddlColStyle"><?php echo JText::_('ZO2_ADMIN_STYLEEDIT_STYLE'); ?> </label> <div class="controls"> <select id="ddlColStyle"> <?php require_once JPATH_ROOT . '/templates/' . Zo2Framework::getInstance()->template->template . '/html/modules.php'; ?> <?php foreach ($modChromes as $chrome) { ?> <option value="<?php echo $chrome; ?> "><?php echo $chrome; ?> </option> <?php } ?>
?> </h2> <div class="zo2-divider"></div> <div class="control-group no-margin no-label"> <?php $value = Zo2Framework::getInstance()->getAssetsFile('zo2/css/custom.css'); if (strpos($value, '/* Here you can include your additional CSS Styles */') === false) { $value = '/* Here you can include your additional CSS Styles */' . PHP_EOL . $value; } echo Zo2Html::field('textarea', array('label' => JText::_('ZO2_ADMIN_CUSTOM_CSS_STYLE'), 'description' => JText::_('ZO2_ADMIN_CUSTOM_CSS_STYLE_DESC')), array('name' => 'zo2[custom_css]', 'rows' => 10, 'cols' => 20, 'value' => $value)); ?> <span>Here you can include your additional CSS styles</span> </div> <div class="control-group no-margin no-label"> <?php $value = Zo2Framework::getInstance()->getAssetsFile('zo2/js/custom.js'); if (strpos($value, '/* Here you can include your additional Javascript code */') === false) { $value = '/* Here you can include your additional Javascript code */' . PHP_EOL . $value; } echo Zo2Html::field('textarea', array('label' => JText::_('ZO2_ADMIN_CUSTOM_JAVASCRIPT_CODE'), 'description' => JText::_('ZO2_ADMIN_CUSTOM_JAVASCRIPT_CODE_DESC')), array('name' => 'zo2[custom_js]', 'rows' => 10, 'cols' => 20, 'value' => $value)); ?> <span>Here you can include your additional JavaScript code</span> </div> <!-- Tracking Cocde --> <div class="zo2-divider"></div> <h2><?php echo JText::_('ZO2_ADMIN_GOOGLE_TRACKING_CODE'); ?> </h2> <div class="zo2-divider"></div> <div class="control-group no-margin no-label">
/** * */ private function _save() { $application = JFactory::getApplication(); $jinput = JFactory::getApplication()->input; /* Zo2 data */ $zo2 = $jinput->post->get('zo2', array(), 'array'); // Joomla! form data $formData = $jinput->post->get('jform', array(), 'array'); $formData['params']['layout'] = json_decode($formData['params']['layout']); $formData['params']['theme'] = json_decode($formData['params']['theme']); $formData['params']['menu_config'] = json_decode($formData['params']['menu_config']); /* Request profileName */ $profileName = isset($zo2['newProfile']) ? $zo2['newProfile'] : $zo2['profiles']; if ($profileName != $zo2['profiles']) { JFactory::getApplication()->enqueueMessage('Added new profile: ' . $profileName, 'notice'); } // Save Joomla! data $model = JModelLegacy::getInstance('Style', 'TemplatesModel'); $model->save($formData); /** * Save profile */ $profile = new Zo2Profile(); $profile->loadArray($formData['params']); $profile->template = Zo2Framework::getInstance()->template->template; $profile->name = $profileName; if ($profile->save()) { /* Save Zo2 data */ $zo2Data = $jinput->post->get('zo2', array(), 'array'); $templateDir = JPATH_ROOT . '/templates/' . Zo2Framework::getInstance()->template->template; $customCssFile = $templateDir . '/assets/zo2/css/custom.css'; $customCss = trim($zo2Data['custom_css']); JFile::write($customCssFile, $customCss); $customJsFile = $templateDir . '/assets/zo2/js/custom.js'; $customJs = trim($zo2Data['custom_js']); JFile::write($customJsFile, $customJs); $application->enqueueMessage('Style successfully saved'); if ($jinput->get('task') == 'style.apply') { $application->redirect(JRoute::_('index.php?option=com_templates&view=style&layout=edit&id=' . $jinput->get('id') . '&profile=' . $profileName, false)); } else { $application->redirect(JRoute::_('index.php?option=com_templates&view=styles', false)); } } JFactory::getApplication()->enqueueMessage('Style save error', 'error'); $application->redirect(JRoute::_('index.php?option=com_templates&view=styles', false)); }
* @copyright Copyright (c) 2014 CleverSoft (http://cleversoft.co/) * @license GPL v2 */ defined('_JEXEC') or die('Restricted access'); $profile = Zo2Factory::getProfile(); ?> <!-- Main layout for backend --> <!-- It's using Twitter Bootstrap 2 default. Provided by Joomla! --> <!-- Begin Content --> <div id="zo2-profile" data-zo2-template="<?php echo Zo2Framework::getInstance()->template->template; ?> " data-zo2-templateid="<?php echo Zo2Framework::getInstance()->template->id; ?> " data-zo2-profile="<?php echo $profile->get('name'); ?> "> <div class="row-fluid"> <div class="span12"> <?php $this->load('admin/top/default.php'); ?> <?php $this->load('admin/body/default.php'); ?> </div>