/** * Build assets data */ public function buildAssets() { if ($this->_isAuthorized()) { $assets = Zo2Assets::getInstance(); if ($assets->buildAssets()) { $this->_ajax->addMessage(JText::_('ZO2_ADMIN_MESSAGE_BUILD_ASSETS_SUCCESS'), 'success'); } else { $this->_ajax->addMessage(JText::_('ZO2_ADMIN_MESSAGE_BUILD_ASSETS_FAILED'), 'error'); } } $this->_ajax->response(); }
/** * */ 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'); }
<?php if (!defined('ZO_MEGAMENU_ASSET')) { define('ZO_MEGAMENU_ASSET', 1); $assets = Zo2Assets::getInstance(); $assets->addStylesheet('zo2/css/megamenu.css'); $assets->addStyleSheet('zo2/css/adminmegamenu.css'); $assets->addScript('zo2/js/adminmegamenu.min.js'); } $html = array(); $vars = array(); $calls = array(); $attr = ''; // Get the field options. $options = (array) JHtml::_('menu.menus'); $html[] = JHtml::_('select.genericlist', $options, $this->data['name'], trim($attr), 'value', 'text', $this->data['value'], $this->data['id']); ?> <div class="control-group"> <div class="control-label"> <label class="zo2-label"><?php echo JText::_('ZO2_ADMIN_MEGA_MENU_TYPE'); ?> </label> <div class="label-desc"><?php echo JText::_('ZO2_ADMIN_MEGA_MENU_TYPE_DESC'); ?> </div> </div> <div class="controls"> <?php echo implode("\n", $html);
/** * Generate custom CSS style for FontDeck option * * @param $data * @param $selector */ protected function _buildFontDeckStyle($data, $selector) { $fontdeckCode = $this->get('fontdeck_code'); $assets = Zo2Assets::getInstance(); $family = $data->get('family'); if (!empty($fontdeckCode)) { $assets->addScriptDeclaration($fontdeckCode); } $style = array(); if (!empty($family->fontdeck)) { $style[] = 'font-family:"' . $family->fontdeck . '"'; } /* Font size */ if ($data->get('size') > 0) { $style[] = 'font-size:' . $data->get('size') . 'px'; } /* Font line height */ if ($data->get('font_line_height') > 0) { $style[] = 'line-height:' . $data->get('font_line_height') . 'px'; } $style = implode(';', $style); if (!empty($style)) { $style = $selector . '{' . $style . '}'; $assets->addStyleSheetDeclaration($style); } }