public function process() { if ($this->getAttribute('global')) { $templateXml = 'TemplateAdminGlobal'; $menuId = 0; } else { $templateXml = 'TemplateAdmin'; $menuId = __Request::get('menuId', __Request::get('__id')); if (!$menuId) { // TODO ERRORE } } $templateProxy = org_glizy_ObjectFactory::createObject('org.glizycms.template.models.proxy.TemplateProxy'); $templateName = $templateProxy->getSelectedTemplate(); if (!$templateName) { // TODO ERRORE } $templateProxy->loadTemplateLocale(); // legge i dati del template $data = $templateProxy->getEditDataForMenu($menuId, __Request::exists('loadFromParent')); $customTemplate = $templateProxy->getTemplateCustomClass(); if ($customTemplate && method_exists($customTemplate, 'updateTemplateData')) { $customTemplate->updateTemplateData($data); } $this->setData($data); $this->addDefaultComponents(); $templateRealPath = $templateProxy->getTemplateRealpath(); if ($templateRealPath) { org_glizy_ObjectFactory::attachPageToComponent($this, $this->_application, $templateXml, $templateRealPath . '/', array('idPrefix' => $this->getId() . '-', 'skipImport' => true, 'mode' => 'edit'), $this->getId() . '-'); parent::process(); // TODO visualizzare che non ci sono parametri di personalizzazione } }
protected function loadTemplate() { if (__Config::get('glizycms.contents.templateEnabled')) { $templateProxy = org_glizy_ObjectFactory::createObject('org.glizycms.template.models.proxy.TemplateProxy'); $templateName = $templateProxy->getSelectedTemplate(); $templatePath = $templateProxy->getTemplateRealpath(); $this->templateData = $templateProxy->getDataForMenu($this->_application->getPageId()); // if is defined a custom XML file read and attach to component DOM if (file_exists($templatePath . '/Template.xml')) { org_glizy_ObjectFactory::attachPageToComponent($this, $this->_application, 'Template', $templateProxy->getTemplateRealpath(), array(), $this->selfId . '-', false); } // check if there is a templateFileName override if (property_exists($this->templateData, 'templateFileName') && $this->templateData->templateFileName != 'default') { $this->setAttribute('templateFileName', $this->templateData->templateFileName); } $this->customTemplate = $templateProxy->getTemplateCustomClass(); if (is_object($this->customTemplate) && method_exists($this->customTemplate, 'process')) { $this->customTemplate->process($this->_application, $this, $this->templateData); } } }