/**
  * postDispatch
  * @author Thomas Schedler <*****@*****.**>
  * @version 1.0
  */
 public function postDispatch()
 {
     if ($this->blnPostDispatch == true) {
         // trigger client specific dispatch helper
         if ($this->core->sysConfig->helpers->client->dispatcher === 'enabled') {
             ClientHelper::get('Dispatcher')->postDispatch($this);
         }
         if (function_exists('tidy_parse_string') && $this->blnCachingOutput == false && $this->getResponse()->getBody() != '') {
             /**
              * Tidy is a binding for the Tidy HTML clean and repair utility which allows 
              * you to not only clean and otherwise manipulate HTML documents, 
              * but also traverse the document tree. 
              */
             $arrConfig = array('indent' => TRUE, 'output-xhtml' => TRUE, 'wrap' => 200);
             $objTidy = tidy_parse_string($this->getResponse()->getBody(), $arrConfig, $this->core->sysConfig->encoding->db);
             $objTidy->cleanRepair();
             $this->getResponse()->setBody($objTidy);
         }
         if (isset($this->objCache) && $this->objCache instanceof Zend_Cache_Frontend_Output) {
             if ($this->blnCachingStart === true) {
                 $response = $this->getResponse()->getBody();
                 $this->getResponse()->setBody(str_replace("<head>", "<head>\r\n      <!-- This is a ZOOLU cached page (" . date('d.m.Y H:i:s') . ") -->", $response));
                 $this->getResponse()->outputBody();
                 $arrTags = array();
                 if ($this->objPage->getIsStartElement(false) == true) {
                     $arrTags[] = 'Start' . ucfirst($this->objPage->getType());
                 }
                 $arrTags[] = ucfirst($this->objPage->getType()) . 'Type_' . $this->objPage->getTypeId();
                 $arrTags[] = ucfirst($this->objPage->getType()) . 'Id_' . $this->objPage->getPageId() . '_' . $this->objPage->getLanguageId();
                 $this->core->logger->debug(var_export($arrTags, true));
                 $this->objCache->end($arrTags);
                 $this->core->logger->debug('... end caching!');
                 exit;
             }
         }
         parent::postDispatch();
     }
 }
Example #2
0
 /**
  * getOverviewContainer
  * @return array $arrContainer
  * @author Cornelius Hansjakob <*****@*****.**>
  * @version 1.0
  */
 public function getOverviewContainer($blnOnlyPages = false, $blnOnlyShowInNavigation = false)
 {
     try {
         $this->arrContainer = array();
         $this->arrGenForms = array();
         $this->arrFallbackGenForms = array();
         $this->arrPageEntries = array();
         $arrPageIds = array();
         $counter = 0;
         $objMyMultiRegion = $this->getRegion(15);
         //15 is the default overview block region
         if ($objMyMultiRegion instanceof GenericElementRegion) {
             foreach ($objMyMultiRegion->RegionInstanceIds() as $intRegionInstanceId) {
                 $objContainer = new PageContainer();
                 $objContainer->setContainerKey($objMyMultiRegion->getField('entry_category')->getInstanceValue($intRegionInstanceId));
                 $objContainer->setContainerTitle($objMyMultiRegion->getField('entry_title')->getInstanceValue($intRegionInstanceId));
                 $objContainer->setEntryNumber($objMyMultiRegion->getField('entry_number')->getInstanceValue($intRegionInstanceId));
                 $objContainer->setEntryViewType($objMyMultiRegion->getField('entry_viewtype')->getInstanceValue($intRegionInstanceId));
                 if ($objContainer->getEntryNumber() > 0) {
                     $objContainer->setContainerLabel($objMyMultiRegion->getField('entry_label')->getInstanceValue($intRegionInstanceId));
                     $objContainer->setContainerSortType($objMyMultiRegion->getField('entry_sorttype')->getInstanceValue($intRegionInstanceId));
                     $objContainer->setContainerSortOrder($objMyMultiRegion->getField('entry_sortorder')->getInstanceValue($intRegionInstanceId));
                     $objContainer->setContainerDepth($objMyMultiRegion->getField('entry_depth')->getInstanceValue($intRegionInstanceId));
                     /**
                      * override category and label filter with the parent page settings
                      */
                     if ($this->objParentPage instanceof Page) {
                         if ($this->objParentPage->getField('entry_category') !== null && (int) $this->objParentPage->getFieldValue('entry_category') > 0) {
                             $objContainer->setContainerKey($this->objParentPage->getFieldValue('entry_category'));
                         }
                         if ($this->objParentPage->getField('entry_label') !== null && (int) $this->objParentPage->getFieldValue('entry_label') > 0) {
                             $objContainer->setContainerLabel($this->objParentPage->getFieldValue('entry_label'));
                         }
                         if ($this->objParentPage->getField('entry_sorttype') !== null && (int) $this->objParentPage->getFieldValue('entry_sorttype') > 0) {
                             $objContainer->setContainerSortType($this->objParentPage->getFieldValue('entry_sorttype'));
                         }
                     }
                     $objEntries = $this->getOverviewPages($objContainer->getContainerKey(), $objContainer->getContainerLabel(), $objContainer->getEntryNumber(), $objContainer->getContainerSortType(), $objContainer->getContainerSortOrder(), $objContainer->getContainerDepth(), $arrPageIds, $blnOnlyPages, $blnOnlyShowInNavigation);
                     if (count($objEntries) > 0) {
                         foreach ($objEntries as $objEntryData) {
                             $objEntry = new PageEntry();
                             $objEntry->destinationId = isset($objEntryData->idDestination) ? $objEntryData->idDestination : 0;
                             $objEntry->relationId = isset($objEntryData->relationId) ? $objEntryData->relationId : false;
                             $objEntry->parentId = isset($objEntryData->plParentId) ? $objEntryData->plParentId : false;
                             $objEntry->plId = isset($objEntryData->plId) ? $objEntryData->plId : false;
                             $objEntry->pageTypeId = isset($objEntryData->idPageTypes) ? $objEntryData->idPageTypes : false;
                             $objEntry->target = isset($objEntryData->target) ? $objEntryData->target : false;
                             if (isset($objEntryData->idPageTypes) && $objEntryData->idPageTypes == $this->core->sysConfig->page_types->link->id) {
                                 $objEntry->setEntryId($objEntryData->plId);
                                 $objEntry->title = $objEntryData->title;
                                 $objEntry->url = '/' . strtolower($objEntryData->languageCode) . '/' . $objEntryData->plUrl;
                                 if (isset($objEntryData->idLanguageFallbacks) && $objEntryData->idLanguageFallbacks > 0) {
                                     if (isset($objEntryData->fallbackTitle) && $objEntryData->fallbackTitle != '') {
                                         $objEntry->title = $objEntryData->fallbackTitle;
                                     }
                                 }
                                 $this->arrGenForms[$objEntryData->plGenericFormId . '-' . $objEntryData->plVersion][] = $objEntryData->plId;
                                 $this->arrPageEntries[$objEntryData->plId] = $counter;
                                 $objContainer->addPageEntry($objEntry, 'entry_' . $objEntryData->plId);
                             } else {
                                 $objEntry->setEntryId($objEntryData->id);
                                 $objEntry->title = $objEntryData->title;
                                 if ($this->objParentPage instanceof Page && ($this->objParentPage->getTypeId() == $this->core->sysConfig->page_types->product_tree->id || $this->objParentPage->getTypeId() == $this->core->sysConfig->page_types->press_area->id || $this->objParentPage->getTypeId() == $this->core->sysConfig->page_types->courses->id || $this->objParentPage->getTypeId() == $this->core->sysConfig->page_types->events->id)) {
                                     $objEntry->url = $this->objParentPage->getFieldValue('url') . $objEntryData->url;
                                 } else {
                                     $objEntry->url = '/' . strtolower($objEntryData->languageCode) . '/' . $objEntryData->url;
                                 }
                                 if (isset($objEntryData->idLanguageFallbacks) && $objEntryData->idLanguageFallbacks > 0) {
                                     $this->arrFallbackGenForms[$objEntryData->fallbackGenericFormId . '-' . $objEntryData->fallbackGenericFormVersion][$objEntryData->idLanguageFallbacks][] = $objEntryData->id;
                                     if (isset($objEntryData->fallbackTitle) && $objEntryData->fallbackTitle != '') {
                                         $objEntry->title = $objEntryData->fallbackTitle;
                                     }
                                 } else {
                                     $this->arrGenForms[$objEntryData->genericFormId . '-' . $objEntryData->version][] = $objEntryData->id;
                                 }
                                 $this->arrPageEntries[$objEntryData->id] = $counter;
                                 $objContainer->addPageEntry($objEntry, 'entry_' . $objEntryData->id);
                             }
                             array_push($arrPageIds, $objEntryData->id);
                         }
                     }
                 }
                 $this->arrContainer[$counter] = $objContainer;
                 $counter++;
             }
         }
         /**
          * get data of instance tables
          */
         if (count($this->arrGenForms) > 0) {
             $this->loadInstanceData();
         }
         /**
          * get fallback data of instance tables
          */
         if (count($this->arrFallbackGenForms) > 0) {
             $this->loadFallbackInstanceData();
         }
         return $this->arrContainer;
     } catch (Exception $exc) {
         $this->core->logger->err($exc);
     }
 }