Example #1
0
 static function includePage($sPageName, $sCurrentLang, $bAutoLoadTranslatedPage = true, $bUseCache = true, $sCacheKey = "")
 {
     //$oPage = new AnwPageByName($sPageName);
     $oPage = AnwStorage::getPageByName($sPageName, false, false, $sCurrentLang);
     //load translation if available
     if ($bAutoLoadTranslatedPage && $oPage->getLang() != $sCurrentLang) {
         $oPage = $oPage->getPageGroup()->getPreferedPage($sCurrentLang);
     }
     //check ACL
     if (!AnwCurrentSession::isActionAllowed($oPage->getName(), 'view', $oPage->getLang())) {
         throw new AnwAclException();
     }
     $oOutputHtml = $oPage->toHtml($bUseCache, $sCacheKey);
     $sReturn = $oOutputHtml->runBody();
     //$sContentHtmlDir = AnwComponent::g_("local_html_dir", array(), $oPage->getLang());
     //$sReturn = '<div dir="'.$sContentHtmlDir.'">'.$sReturn.'</div>';
     return $sReturn;
 }
Example #2
0
 protected function getMenuPage()
 {
     $oPage = null;
     try {
         $sMenuPageName = $this->getMenuPageName();
         $sActionLang = AnwAction::getActionLang();
         $oPage = AnwStorage::getPageByName($sMenuPageName, false, false, $sActionLang);
         // we don't check ACLs for better performances...
         // load translation if available
         if ($oPage->getLang() != $sActionLang) {
             $oPage = $oPage->getPageGroup()->getPreferedPage($sActionLang);
         }
     } catch (AnwException $e) {
     }
     return $oPage;
 }
Example #3
0
 function loadInfo()
 {
     if ($this->bInfoLoaded) {
         return;
     }
     try {
         $this->debug("Loading page info..." . ($this->bSkipLoadingTranslationsContent ? "(boost)" : "") . ($this->bSkipLoadingContent ? "(superboost)" : ""));
         if (!$this->isArchive()) {
             $oPage = AnwStorage::getPageByName($this->sName, $this->bSkipLoadingTranslationsContent, $this->bSkipLoadingContent);
         } else {
             $oPage = AnwStorage::getPageArchiveByName($this->sName, $this->nChangeId, $this->bSkipLoadingTranslationsContent, $this->bSkipLoadingContent);
         }
         $this->nId = $oPage->getId();
         parent::doLoadInfo($oPage);
     } catch (AnwPageNotFoundException $e) {
         //page doesn't exist
         $this->bExists = false;
     }
     $this->bInfoLoaded = true;
 }