/** * @param array $app * @param array $config * @throws AppException */ public function __construct($app, $config = array()) { parent::__construct($app, $config); $this->_jbrequest = $this->app->jbrequest; $task = $this->_jbrequest->getWord('task'); $ctrl = $this->_jbrequest->getCtrl(); if (!method_exists($this, $task)) { throw new AppException('Action method not found! ' . $ctrl . ' :: ' . $task . '()'); } // internal vars $this->application = $this->app->zoo->getApplication(); $this->_params = $this->application->getParams('frontpage'); $this->joomla = $this->app->system->application; $isSite = $this->app->jbenv->isSite(); if (!$isSite) { $this->app->document->addStylesheet("root:administrator/templates/system/css/system.css"); $this->app->jbassets->uikit(true, true); $this->_setToolbarTitle(); } else { $this->params = $this->joomla->getParams(); $this->pathway = $this->joomla->getPathway(); $this->app->jbassets->setAppCSS(); $this->app->jbassets->setAppJS(); } $this->_config = JBModelConfig::model(); }
/** * Import the frontpage settings * * @param Application $application The Application object * @param array $frontpage the frontpage settings * * @since 2.0 */ private function _importFrontpage(Application $application, $frontpage) { $application->description = $frontpage['description']; // set frontpage content params if (isset($frontpage['content'])) { $application->getParams()->set('content.', $frontpage['content']); } // set frontpage metadata params if (isset($frontpage['metadata'])) { $application->getParams()->set('metadata.', $frontpage['metadata']); } // save application try { $this->app->table->application->save($application); } catch (AppException $e) { $this->app->error->raiseNotice(0, JText::_('Error Importing Frontpage') . ' (' . $e . ')'); } }
/** * Add a category to the exporing list * * @param Category $category The category to export * * @return AppExporterZoo2 $this for chaining support * * @since 2.0 */ protected function _addZooCategory(Category $category) { // store category attributes $data = array(); foreach ($this->category_attributes as $attribute) { if (isset($category->{$attribute})) { $data[$attribute] = $category->{$attribute}; } } // store category parent if (isset($this->_categories[$category->parent])) { $data['parent'] = $this->_categories[$category->parent]->alias; } // store category content params $data['content'] = $category->alias == '_root' ? $this->_application->getParams()->get('content.') : $category->getParams()->get('content.'); // store category metadata params $data['metadata'] = $category->alias == '_root' ? $this->_application->getParams()->get('metadata.') : $category->getParams()->get('metadata.'); parent::_addCategory($category->name, $category->alias, $data); }
private static function _importFrontpage(Application $application, YXMLElement $frontpage_xml = null, $frontpage_params = array()) { if (!empty($frontpage_xml)) { $table = YTable::getInstance('application'); $application->description = (string) $frontpage_xml->description; // set frontpage params $params = $application->getParams(); foreach ($frontpage_params as $params_type => $assigned_params) { foreach ($assigned_params as $assigned_frontpage_param => $param) { $param_xml = $frontpage_xml->getElementByPath('content/*[@name="' . $assigned_frontpage_param . '"]'); if ($param && $param_xml) { switch ($params_type) { case 'zooimage': if ($param_xml->path) { $params->set('content.' . $param, (string) $param_xml->path); } if ($param_xml->width) { $params->set('content.' . $param . '_width', (string) $param_xml->width); } if ($param_xml->height) { $params->set('content.' . $param . '_height', (string) $param_xml->height); } break; case 'text': case 'textarea': $params->set('content.' . $param, (string) $param_xml); break; } } } } $application->params = $params->toString(); // save application try { $table->save($application); } catch (YException $e) { JError::raiseNotice(0, JText::_('Error Importing Frontpage') . ' (' . $e . ')'); } } }