Beispiel #1
0
 function addComponentsToEdit($menu)
 {
     $templatePath = org_glizycms_Glizycms::getSiteTemplatePath();
     $originalRootComponent =& $this->_application->getRootComponent();
     $originalChildren = $this->childComponents;
     $this->childComponents = array();
     $this->addDefaultComponents($menu);
     $this->_pageTypeObj =& org_glizy_ObjectFactory::createPage($this->_application, $menu->menu_pageType, org_glizy_Paths::get('APPLICATION_TO_ADMIN_PAGETYPE'), array('idPrefix' => $this->getId() . '-', 'skipImport' => true, 'pathTemplate' => $templatePath, 'mode' => 'edit'));
     $rootComponent =& $this->_application->getRootComponent();
     $rootComponent->init();
     $this->_application->_rootComponent =& $originalRootComponent;
     $editComponents = $rootComponent->getAttribute('adm:editComponents');
     $this->allowBlocks = $rootComponent->getAttribute('allowBlocks');
     if (count($editComponents)) {
         foreach ($editComponents as $id) {
             $component =& $rootComponent->getComponentById($this->getId() . '-' . $id);
             if (!is_object($component)) {
                 continue;
             }
             $component->remapAttributes($this->getId() . '-');
             $this->addChild($component);
             $component->_parent =& $this;
             $component->setAttribute('visible', true);
         }
     } else {
         for ($i = 0; $i < count($rootComponent->childComponents); $i++) {
             $rootComponent->childComponents[$i]->remapAttributes($this->getId() . '-');
             $this->addChild($rootComponent->childComponents[$i]);
             $rootComponent->childComponents[$i]->_parent =& $this;
         }
     }
     $this->childComponents = array_merge($this->childComponents, $originalChildren);
 }
Beispiel #2
0
 protected function getEditForm($pageId, $formId = 'editForm', $formAction = 'edit')
 {
     $oldAction = __Request::get('action');
     __Request::set('action', $formAction);
     $application = org_glizy_ObjectValues::get('org.glizy', 'application');
     $originalRootComponent = $application->getRootComponent();
     $siteMap = $application->getSiteMap();
     $siteMapNode = $siteMap->getNodeById($pageId);
     $pageType = $siteMapNode->getAttribute('pageType');
     $path = org_glizy_Paths::get('APPLICATION_PAGETYPE');
     $templatePath = org_glizycms_Glizycms::getSiteTemplatePath();
     $options = array('skipImport' => true, 'pathTemplate' => $templatePath, 'mode' => 'edit');
     $pageTypeObj =& org_glizy_ObjectFactory::createPage($application, $pageType, $path, $options);
     $rootComponent = $application->getRootComponent();
     $rootComponent->init();
     $application->_rootComponent =& $originalRootComponent;
     __Request::set('action', $oldAction);
     return $rootComponent->getComponentById($formId);
 }