/** * Page reparsen und updaten * * @param Cms\Data\Page $page * @param Cms\Data\Template $template * @param string $reparseType */ public static function reparseAndUpdatePage(Page &$page, Template $template, $reparseType = self::TYPE_REPARSE) { // Content reparsen $newPageContent = array(); $newPageContent = self::reparseContent($page->getWebsiteid(), $page->getContent(), $page->getTemplatecontent(), $template->getContent(), $reparseType); // Page mit den neuen Werten updaten $page->setContent(\Zend_Json::encode($newPageContent)); $page->setTemplatecontent($template->getContent()); $page->setTemplatecontentchecksum($template->getContentchecksum()); // Page speichern $pageBusiness = new \Cms\Business\Page('Page'); $pageBusiness->update($page->getId(), $page->getWebsiteId(), array('content' => \Zend_Json::encode($newPageContent), 'templatecontent' => $template->getContent(), 'templatecontentchecksum' => $template->getContentchecksum())); return true; }
protected function setValuesFromData(PageData $data) { $this->setId($data->getId()); $this->setWebsiteId($data->getWebsiteid()); $this->setTemplateId($data->getTemplateid()); $this->setMediaId($data->getMediaId()); $this->setName($data->getName()); $this->setDescription($data->getDescription()); $this->setInNavigation($data->getInnavigation()); $this->setDate($data->getDate()); $this->setNavigationTitle($data->getNavigationtitle()); $this->setContent($data->getContent()); $this->setPageType($data->getPageType()); $this->setPageAttributes($data->getPageAttributes()); $this->setScreenshot(); }
/** * Fuegt in der Website-Navigation eine Page hinter eine andere angegebene * Page-ID ein * * @param \Orm\Entity\Page $insertPage * @param string $pageId * @return array Neue Navigation */ public function addPageToNavigationAfterPageId(Data\Page $insertPage, $pageId) { $dataPage = array('id' => $insertPage->getId()); $website = $this->getService()->getById($insertPage->getWebsiteid()); $navigation = \Zend_Json::decode($website->getNavigation()); $data = new \Seitenbau\ArrayData(); $newNavigation = $data->insertAfter($navigation, $dataPage, $pageId); $newNavigation = \Zend_Json::encode($newNavigation); $attributes = array('navigation' => $newNavigation); $this->getService()->update($insertPage->getWebsiteid(), $attributes); return $newNavigation; }
/** * @param Data\Page $page * @return string */ private function getPageJson(Data\Page $page) { $pageColumnsAndValues = $page->getExportColumnsAndValues(); $pageJson = json_encode($pageColumnsAndValues); $this->extendingColorIds($page->getWebsiteid(), $pageJson); return $pageJson; }