/**
  * 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
 /**
  * indexGlobal
  * @author Thomas Schedler <*****@*****.**>
  * @version 1.0
  */
 public function indexGlobal()
 {
     $this->core->logger->debug('massiveart->website->page->indexGlobal()');
     try {
         if ($this->objGenericData instanceof GenericData) {
             $this->getModelPages();
             if ($this->objFallbackPage instanceof Page) {
                 $this->objModelPages->setLanguageId($this->objFallbackPage->getLanguageId());
                 $this->objGenericData->Setup()->getField(GenericSetup::FIELD_TYPE_URL)->setValue($this->objFallbackPage->GenericData()->Setup()->getField(GenericSetup::FIELD_TYPE_URL)->getValue());
             }
             $objGlobalPageParents = $this->objModelPages->loadGlobalParentPages($this->intTypeId);
             if (count($objGlobalPageParents) > 0) {
                 $this->arrContainer = array();
                 $this->arrGenForms = array();
                 $this->arrPageEntries = array();
                 foreach ($objGlobalPageParents as $objGlobalPageParent) {
                     $objEntry = new PageEntry();
                     $objEntry->setEntryId($objGlobalPageParent->id);
                     $objEntry->title = $objGlobalPageParent->title;
                     $objEntry->pageId = $objGlobalPageParent->pageId;
                     $objEntry->rootLevelId = (int) $objGlobalPageParent->idRootLevels > 0 ? $objGlobalPageParent->idRootLevels : $objGlobalPageParent->idParent;
                     $objEntry->url = '/' . strtolower($objGlobalPageParent->languageCode) . '/' . $objGlobalPageParent->url;
                     $objEntry->created = $objGlobalPageParent->created;
                     $objEntry->published = $objGlobalPageParent->published;
                     $this->arrGenForms[$objGlobalPageParent->genericFormId . '-' . $objGlobalPageParent->genericFormVersion][] = $objGlobalPageParent->id;
                     if (!array_key_exists($objEntry->rootLevelId, $this->arrContainer)) {
                         $this->arrContainer[$objEntry->rootLevelId] = new PageContainer();
                     }
                     $this->arrContainer[$objEntry->rootLevelId]->addPageEntry($objEntry, 'entry_' . $objGlobalPageParent->id);
                     $this->arrPageEntries[$objGlobalPageParent->id] = $objEntry->rootLevelId;
                 }
                 foreach ($this->arrGenForms as $key => $arrPageIds) {
                     $arrGenFormPageIds = self::getGenFormPageIds($arrPageIds);
                     $this->loadInstanceGlobalFilterData($key, $arrGenFormPageIds);
                 }
                 $arrParentFolderIds = array();
                 $arrParentFolderStrIds = array();
                 $objGlobaParentFolders = $this->getModelGlobals()->loadParentFolders($this->intElementLinkId > 0 ? $this->intElementLinkId : $this->intElementId);
                 if (count($objGlobaParentFolders) > 0) {
                     foreach ($objGlobaParentFolders as $objGlobaParentFolder) {
                         $arrParentFolderIds[] = $objGlobaParentFolder->id;
                         $arrParentFolderStrIds[] = $objGlobaParentFolder->folderId;
                     }
                 }
                 $arrGlobaCategoryies = is_array($this->getFieldValue('category')) ? $this->getFieldValue('category') : array($this->getFieldValue('category'));
                 $arrGlobaLabels = is_array($this->getFieldValue('label')) ? $this->getFieldValue('label') : array($this->getFieldValue('label'));
                 foreach ($this->arrContainer as $objContainer) {
                     foreach ($objContainer->getEntries() as $objEntry) {
                         if (array_search($objEntry->entry_point, $arrParentFolderIds) === false) {
                             $objContainer->removePageEntry('entry_' . $objEntry->getEntryId());
                         }
                         if ((int) $objEntry->entry_category > 0) {
                             if (array_search($objEntry->entry_category, $arrGlobaCategoryies) === false) {
                                 $objContainer->removePageEntry('entry_' . $objEntry->getEntryId());
                             }
                         }
                         if ((int) $objEntry->entry_label > 0) {
                             if (array_search($objEntry->entry_label, $arrGlobaLabels) === false) {
                                 $objContainer->removePageEntry('entry_' . $objEntry->getEntryId());
                             }
                         }
                     }
                 }
                 if (count($objContainer->getEntries()) > 0) {
                     $this->objGenericData->indexData(GLOBAL_ROOT_PATH . $this->core->sysConfig->path->search_index->global, $this->strPageId, $this->arrContainer, $arrParentFolderStrIds);
                 }
             }
             if ($this->objFallbackPage instanceof Page) {
                 $this->objModelPages->setLanguageId($this->intLanguageId);
             }
         }
     } catch (Exception $exc) {
         $this->core->logger->err($exc);
     }
 }
Example #3
0
 /**
  * getBlockDocuments
  * @return string $strReturn
  * @author Cornelius Hansjakob <*****@*****.**>
  * @version 1.0
  */
 public function getBlockDocuments($intRegionId, $blnFileFilterDocs)
 {
     $strReturn = '';
     $objMyMultiRegion = $this->objPage->getRegion($intRegionId);
     //47 is the default block document region
     if ($objMyMultiRegion instanceof GenericElementRegion) {
         foreach ($objMyMultiRegion->RegionInstanceIds() as $intRegionInstanceId) {
             $strBlockTitle = htmlentities($objMyMultiRegion->getField('docs_title')->getInstanceValue($intRegionInstanceId), ENT_COMPAT, $this->core->sysConfig->encoding->default);
             if ($strBlockTitle != '') {
                 $intFilterLanguageId = $this->objPage->FallbackPage() instanceof Page ? $this->objPage->FallbackPage()->getLanguageId() : $this->objPage->getLanguageId();
                 $objFiles = $blnFileFilterDocs == true ? $this->objPage->getFileFilterFieldValue($objMyMultiRegion->getField('docs')->getInstanceValue($intRegionInstanceId), $intFilterLanguageId) : $this->objPage->getFileFieldValueById($objMyMultiRegion->getField('docs')->getInstanceValue($intRegionInstanceId));
                 if ($objFiles != '' && count($objFiles) > 0) {
                     $strFiles = '';
                     $arrDestinationSpecifics = array();
                     foreach ($objFiles as $objFile) {
                         $strIcon = strpos($objFile->mimeType, 'image') !== false ? 'icon_img.gif' : 'icon_' . $objFile->extension . '.gif';
                         $strItem = '
                 <div class="item">
                   <div class="icon"><img src="' . $this->core->config->domains->static->components . '/website/themes/default/images/icons/' . $strIcon . '" alt="' . $objFile->title . '" title="' . $objFile->title . '"/></div>
                   <div class="text">
                     <a href="/zoolu-website/media/document/' . $objFile->id . '/' . urlencode(str_replace('.', '-', $objFile->title)) . '" onmousedown="clickTracker(\'/zoolu-website/media/document/' . $objFile->id . '/' . urlencode(str_replace('.', '-', $objFile->title)) . '\');" target="_blank">' . htmlentities($objFile->title == '' && (isset($objFile->alternativTitle) || isset($objFile->fallbackTitle)) ? isset($objFile->alternativTitle) && $objFile->alternativTitle != '' ? $objFile->alternativTitle : $objFile->fallbackTitle : $objFile->title, ENT_COMPAT, $this->core->sysConfig->encoding->default) . '</a>
                   </div>
                   <div class="clear"></div>
                 </div>';
                         if ($objFile->idDestination == 0) {
                             $strFiles .= $strItem;
                         } else {
                             $objTmpEntry = new stdClass();
                             $objTmpEntry->destinationId = $objFile->idDestination;
                             $objTmpEntry->output = $strItem;
                             $arrDestinationSpecifics[] = $objTmpEntry;
                         }
                     }
                     $strDisplayTitle = $strFiles == '' ? ' style="display:none;"' : '';
                     $strReturn .= '
             <div id="blockDocuments_' . $intRegionInstanceId . '">
               <h2 id="blockDocuments_' . $intRegionInstanceId . '_title"' . $strDisplayTitle . '>' . $strBlockTitle . '</h2>
               <div class="documents" id="blockDocuments_' . $intRegionInstanceId . '_container">' . $strFiles;
                     if (count($arrDestinationSpecifics) > 0) {
                         $strTmpCacheId = str_replace('.', '', uniqid(uniqid(), true));
                         $this->core->TmpCache()->save($arrDestinationSpecifics, $strTmpCacheId);
                         $strReturn .= '
             <div class="loader" id="blockDocuments_' . $intRegionInstanceId . '_addon">
               <script type="text/javascript">
                 new Ajax.Updater(\'blockDocuments_' . $intRegionInstanceId . '_addon\', \'/zoolu-website/content/destination-filter\', {
                   method: \'get\',
                   parameters: { 
                     tmpId: \'' . $strTmpCacheId . '\'
                   },
                   evalScripts: true,
                   onComplete: function() {         
                     $(\'blockDocuments_' . $intRegionInstanceId . '_addon\').removeClassName(\'loader\');
                     if($(\'blockDocuments_' . $intRegionInstanceId . '_addon\').innerHTML.blank() && ' . ($strFiles == '' ? 'true' : 'false') . '){
                       $(\'blockDocuments_' . $intRegionInstanceId . '\').remove();
                     }else{
                       $(\'blockDocuments_' . $intRegionInstanceId . '_title\').show();
                     }
                   }
                 });
               </script>
             </div>';
                     }
                     $strReturn .= '
               </div>
             </div>';
                 }
             }
         }
     }
     return $strReturn;
 }