Beispiel #1
0
 /**
  * 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;
 }
Beispiel #2
0
 /**
  * reparsing the page unsing specific template
  *
  * @param \Cms\Data\Page      $page
  * @param \Cms\Data\Template  $template
  * @return boolean
  */
 private function doReparsePage(\Cms\Data\Page $page, \Cms\Data\Template $template)
 {
     if ($page->getTemplatecontentchecksum() != $template->getContentchecksum()) {
         try {
             if (Reparser::reparseAndUpdatePage($page, $template)) {
                 return true;
             }
         } catch (\Exception $e) {
             $data = method_exists($e, 'getData') ? $e->getData() : array();
             $data['pageId'] = $page->getId();
             $data['pageName'] = $page->getName();
             throw new \Cms\Exception(801, __METHOD__, __LINE__, $data, $e);
         }
     }
     return false;
 }