Esempio n. 1
0
 protected static function fillWebpage(\Dual\Render\Webpage &$webpage, &$structure, &$node)
 {
     // Webpage-Daten ermitteln
     $data = $node;
     $globalVars = array();
     // Webpage ermitteln
     $cmsWebpage = RenderContext::getPageById($node['id']);
     // Webpage gefunden?
     if (is_object($cmsWebpage)) {
         // Daten uebernehmen
         $data = $cmsWebpage->toArray();
         $globalVars = $data['globalcontent'];
         if (is_string($globalVars)) {
             $globalVars = json_decode($globalVars, true);
         }
         // Einige Attribute entfernen
         unset($data['content']);
         unset($data['globalcontent']);
         unset($data['templateContent']);
     }
     // Url aufnehmen
     $data['url'] = RenderContext::getPageUrlById($node['id']);
     // Werte aufnehmen
     $webpage->setArray($data);
     $webpage->setGlobalArray($globalVars);
     // Erfoglreich
     return true;
 }
Esempio n. 2
0
 public function __construct($id, $icon = false)
 {
     $this->mediaContext = RenderContext::getMediaContext();
     $this->id = $id;
     $this->icon = $icon;
     $this->mediaItem = $this->mediaContext->getMediaInfoStorage()->getItem($id);
     $this->initImageDimensions();
 }
Esempio n. 3
0
 protected function initSite($siteId)
 {
     RenderContext::setWebsiteId($siteId);
     /** @var $newRenderContextMock \Render\RenderContext */
     $newRenderContextMock = $this->getMockBuilder('\\Render\\RenderContext')->disableOriginalConstructor()->getMock();
     $newRenderContextMock->expects($this->any())->method('getMediaContext')->will($this->returnValue($this->createMediaContext($siteId)));
     RenderContext::setNewRenderContext($newRenderContextMock);
 }
Esempio n. 4
0
 /**
  * Name der zu verwendenden Navigationsklasse zurueckgeben
  * @return string   Namen der Navigationsklasse welche verwendet werden soll
  * @access public
  */
 private static function getNavigationClassName()
 {
     // Muss der Klassennamen ermittelt werden
     if (!isset(self::$navigationClassName) || empty(self::$navigationClassName)) {
         // Navigationsklasse laden und Classennamen setzen
         $renderType = RenderContext::getRenderType();
         $navigationName = $renderType . 'Navigation';
         self::loadClass($navigationName);
         self::$navigationClassName = 'Dual\\Render\\Navigation\\' . $navigationName;
         $className = self::$navigationClassName;
         $className::setRenderType($renderType);
     }
     // Klassennamen zurueckgeben
     return self::$navigationClassName;
 }
Esempio n. 5
0
 protected function &createUnit(&$unitData)
 {
     // init
     $unit = null;
     // Unit-Klassennamen ermitteln
     $unitClassName = $this->getUnitClassName($unitData);
     // Unit-Objekt erzeugen
     if (isset($unitClassName) && !empty($unitClassName)) {
         // Unit erzeugen
         $unit = new $unitClassName();
         $unit->setParent($this->parentUnit);
         $unit->setWebsiteId(RenderContext::getWebsiteId());
         $unit->setArray($unitData);
     }
     // Unit zurueckgeben
     return $unit;
 }
Esempio n. 6
0
 public function __construct($id)
 {
     $this->mediaContext = RenderContext::getMediaContext();
     $this->id = $id;
 }
Esempio n. 7
0
 protected function addRenderHeadState()
 {
     // Head-Render Status dieses Modul (nicht Unit) setzen
     return RenderContext::addRenderState(self::CODE_TYPE_HEAD, $this->getModuleId(), true);
 }
Esempio n. 8
0
 /**
  * Ermittelt alle Medien-Ids eines Albums
  * @param string $albumId Id des Aldums
  * @return array
  */
 public static function getIdsByAlbumId($albumId)
 {
     return RenderContext::getMediaIdsByAlbumId($albumId);
 }
Esempio n. 9
0
 protected function getBaseValues()
 {
     if (RenderContext::getRenderType() == RenderContext::RENDER_STATIC) {
         return;
     }
     if ($this->initBaseValuesFromCache()) {
         return;
     }
     parent::getBaseValues();
     $this->cacheBaseValues();
 }
Esempio n. 10
0
 protected function initLegacy()
 {
     // use the full path here, DO NOT convert this to use ...
     // if you do, it will fail in case of disabled legacy support
     // as the files are not copied to target server
     /** @noinspection PhpUnnecessaryFullyQualifiedNameInspection */
     \Dual\Render\RenderContext::init($this->getRenderContext(), $this->pageMeta['websiteId'], $this->pageId);
 }
Esempio n. 11
0
 /**
  * @param array   $content
  * @param string  $websiteId
  * @param string  $pageOrTemplateId
  * @param string  $mode
  * @param array   $currentItemInfo
  * @param string  $codeType
  * @param boolean $isTemplate
  */
 protected function renderWithNewRenderer(array &$content, $websiteId, $pageOrTemplateId, $mode, $currentItemInfo, $codeType, $isTemplate)
 {
     $websiteService = $this->getService('Website');
     $moduleService = $this->getService('Modul');
     $websiteSettingsService = $this->getService('WebsiteSettings');
     $websiteInfoStorage = new ServiceBasedWebsiteInfoStorage($websiteId, $websiteService, $websiteSettingsService);
     $moduleInfoStorage = new ServiceBasedModuleInfoStorage($websiteId, $moduleService);
     $colorInfoStorage = $this->getColorInfoStorage($websiteService, $websiteId);
     $resolutions = $this->getResolutions($websiteService, $websiteId);
     $navigationInfoStorage = $this->createNavigationInfoStorage($websiteId, $pageOrTemplateId, $isTemplate, $currentItemInfo, $this->createPageUrlHelper($websiteId, $pageOrTemplateId, $isTemplate, $mode));
     $usedMediaIds = $this->getMediaIdsFromContent($content);
     $mediaContext = $this->createMediaContext($websiteId, $usedMediaIds);
     $cacheImpl = $this->createCache($websiteId, $pageOrTemplateId);
     $renderContext = $this->createRenderContext($mode, $isTemplate, $resolutions, $websiteInfoStorage, $moduleInfoStorage, $mediaContext, $navigationInfoStorage, $colorInfoStorage, $cacheImpl);
     // Legacy Support (NOTE: this init NEEDS to be AFTER the init of all info storage and the new render context)
     LegacyRenderContext::init($renderContext, $websiteId, $pageOrTemplateId);
     $this->startNewRenderer($content, $moduleInfoStorage, $codeType, $renderContext);
 }
Esempio n. 12
0
 /**
  * Render Context suitable for usage in the creator
  * (e.g. use Service as data backend, but generate URLs for usage in live page)
  *
  * @param string        $websiteId
  * @param string        $currentPageId
  * @param SiteStructure $structure
  *
  * @param               $relativePathToWebRoot
  *
  * @return \Render\RenderContext
  */
 protected function createRenderContext($websiteId, $currentPageId, $structure, $relativePathToWebRoot)
 {
     $websiteInfoStorage = $this->getCreatorContext()->getWebsiteInfoStorage($websiteId);
     $moduleInfoStorage = $this->getCreatorContext()->createCreatorModuleInfoStorage($websiteId, $relativePathToWebRoot);
     $navUrlHelper = new SiteStructurePageUrlHelper($structure, $currentPageId, $relativePathToWebRoot);
     $navigationInfoStorage = $this->getCreatorContext()->getNavigationInfoStorage($websiteId, $currentPageId, $navUrlHelper);
     $colorInfoStorage = $this->getCreatorContext()->getColorInfoStorage($websiteId);
     // media context
     $mediaContext = new MediaContext($this->getCreatorContext()->createMediaInfoStorage($websiteId, $this->createInterceptorMediaUrlHelper($relativePathToWebRoot)), $this->getCreatorContext()->getImageToolFactory());
     $interfaceLocaleCode = 'en_EN';
     $renderMode = RenderContext::RENDER_MODE_CREATOR;
     $renderType = RenderContext::RENDER_TYPE_PAGE;
     $resolutions = $this->getCreatorContext()->getResolutions($websiteId);
     $renderContext = new RenderContext($websiteInfoStorage, $moduleInfoStorage, $navigationInfoStorage, $colorInfoStorage, $mediaContext, $interfaceLocaleCode, $renderMode, $renderType, $resolutions);
     // TODO: add cache here?
     // init legacy if required
     if ($this->result->getLegacySupport()) {
         LegacyRenderContext::init($renderContext, $websiteId, $currentPageId);
     }
     return $renderContext;
 }