/** * * @param string $nodePath * @param ApplicationDefault $app * @return null */ static public function findNodeFromPath ($nodePath, $app ) { $uri = explode( '/', ltrim( $nodePath, '/' ) ); $rootNodes = array(); $applicationName = $app->applicationName(); if( count( $uri ) > 1 && is_numeric($uri[0]) ) { $publisherFolderId = $uri[0]; array_shift($uri); $uriArticle = implode ('/', $uri); } else $uriArticle = ltrim( $nodePath, '/' ); $uriArticle = urldecode($uriArticle); if($applicationName) { $publishers = $app->applicationLocalized()->publisherFolders; /* @var $publisher PublisherFolder */ foreach ($publishers as $publisher) { $pfids = PublisherFolderTool::getPathToIDMapping( $publisher->attribute('path') ); // If PublisherFolderId is included in url, we only take care about this publisher folder if ( isset($publisherFolderId) && $pfids['pfid'] == $publisherFolderId ) { $rootNodes[] = eZContentObjectTreeNode::fetch($pfids['nid']); $articlePath = $uriArticle; break; } elseif( !isset($publisherFolderId) ) { $node = eZContentObjectTreeNode::fetch($pfids['nid']); if($node) { $rootNodes[] = $node; $articlePath = $uriArticle; } } } } if ( isset($publisherFolderId) != false && trim($uriArticle) == '' ) return $app; if ( !isset($articlePath) || count($rootNodes) == 0 ) return null; $node = self::getNodeFromPath ($articlePath, $rootNodes); if ( !$node ) return null; $cluster = $app->applicationLocalized()->attribute( 'cluster_identifier' ); $isVisible = ObjectVisibilityManager::isVisible( $node->attribute('contentobject_id'), $cluster ); if ( !$isVisible ) return null; return $node; }
/** * @param ApplicationDefault $app * @return bool */ public static function hasHomepage($app) { $result = $app->applicationLocalized()->getCustomParameter('HasHomepage'); if ( $result === false ) $result = $app->applicationObject()->getCustomParameter('HasHomepage'); return ($result == '1'); }
public function htmlBuildResult() { $lessFiles = SolrSafeOperatorHelper::getLessFiles( ($this->app) ? $this->app->applicationObject()->attribute('identifier') : $this->applicationName(), $this->app ); $this->tpl()->setVariable( 'applicationLessFiles', $lessFiles ); if ( !$this->app ) return; if ( $this->app->isFull ) { if ( $this->app->node && $this->app->node instanceof eZContentObjectTreeNode ) { $dataMap = $this->app->node->dataMap(); if($dataMap["serialized_taxonomies"]){ $taxonomies = $dataMap["serialized_taxonomies"]->content(); $publisherPath = $taxonomies["publisher_folder"][0]; $publisherFolder = $this->app->applicationLocalized()->getPublisherFolderFromPath($publisherPath); if (isset($taxonomies['language']) && $publisherFolder instanceof PublisherFolder) { $publisherLanguages = $publisherFolder->getLanguages(); $languageList = $taxonomies['language']; //$languageTranslations = FacetFilteringTool::getTaxonomyTranslation('language'); $availableLanguages = array(); foreach (array_keys($this->app->node->object()->allLanguages()) as $locale) { if (is_array($publisherLanguages) && in_array($locale, $publisherLanguages)) { $key = LocaleTool::languageISO639Code($locale); $availableLanguages[$key] = $locale; } } } $uri = eZURI::instance(); $uriParams = $uri->UserParameters(); if(isset($uriParams['language'])) $uriLang = $uriParams['language']; if ($uriLang) { $this->app->node->setCurrentLanguage($uriLang); } if (in_array($publisherLanguages[0], $availableLanguages)){ if ($this->app->node->currentLanguage() != $publisherLanguages[0]) { $this->app->node->setCurrentLanguage($publisherLanguages[0]); } } } } if ( SolrSafeOperatorHelper::featureIsActive( "SocialSharing" ) && SolrSafeOperatorHelper::feature( "SocialSharing", "EntryExit" ) ) { $this->pushResult( "socialInfos", $this->app->getSocialInfos() ); } if ( $this->app->node instanceof eZContentObjectTreeNode ) $this->pushResult( "current_node", $this->app->node ); } else if ( $this->app->isSeo ) { $goToSpeciality = null; if ( is_null( $this->app->seoParams["speciality"] ) && $this->app->seoParams["noSpeciality"] ) { $goToSpeciality = "all/speciality"; } $this->pushResult( "seoMetas", $this->app->getSeoMetas() ); $this->pushResult( "doSpecialityRedirect", $goToSpeciality ); } }