/** * 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); } }