protected function showCurrentPage() { //prepare content for display try { $oOutputHtml = $this->getoPage()->toHtml(); } catch (AnwException $e) { $oOutputHtml = new AnwOutputHtml($this->getoPage()); $oOutputHtml->setBody(self::g_("err_rendercontent"), false); AnwDebug::reportError($e); } $this->head($oOutputHtml->runHead()); $this->title = $oOutputHtml->runTitle(); $sBody = $oOutputHtml->runBody(); //if the translation is not complete, display a notice if (!$this->getoPage()->isTranslated() && $this->getoPage()->isActionAllowed('translate')) { $sNotice = $this->t_("local_notice_incomplete", array("lnkopen" => '<a href="' . AnwUtils::link($this->getoPage(), "translate") . '">', "lnkclose" => '</a>')); $this->out .= $this->tpl()->drawNotice($sNotice); } //page translations $aoTranslations = array(); $aoPages = $this->getoPage()->getPageGroup()->getPages(); foreach ($aoPages as $oPage) { if ($oPage->isActionAllowed('view')) { $bCurrent = $oPage->getName() == $this->getoPage()->getName(); $bTranslatedPercentEnough = $oPage->getTranslatedPercent() >= self::globalCfgViewUntranslatedMinpercent() ? true : false; $aoTranslations[] = array('current' => $bCurrent, 'page' => $oPage, 'online' => $bTranslatedPercentEnough); } } //display page content $this->out .= $this->tpl()->viewPage(self::g_("local_html_dir", array(), AnwAction::getActionLang()), AnwUtils::cssViewContent($this->getoPage()), $this->title, $sBody, str_replace(',', ' ', Anwi18n::dateTime($this->getoPage()->getTime(), AnwAction::getActionLang())), $aoTranslations); }
function toHtml($oContent, $oPage) { $oOutputHtml = new AnwOutputHtml($oPage); $oOutputHtml->setTitle($oContent->getContentFieldValue(self::FIELD_TITLE)); $sNewsCategoryTitle = $oContent->getContentFieldValue(self::FIELD_TITLE); $sNewsCategoryIntro = $oContent->getContentFieldValue(self::FIELD_DESCRIPTION); //try{$aoNewsList = $this->getNewsList($oPage);}catch(Exception $e){print_r($e);} //render news list $aoNewsList = self::getNewsList($oPage); $sHtmlNewsList = ""; if (count($aoNewsList) > 0) { $sHtmlNewsList .= $this->tpl()->newsListStart(); foreach ($aoNewsList as $oNewsPage) { $oNewsContent = $oNewsPage->getContent(); $sNewsTitle = $oNewsContent->getContentFieldValue(AnwContentClassPageDefault_news::FIELD_TITLE); $sNewsIntro = $oNewsContent->getContentFieldValue(AnwContentClassPageDefault_news::FIELD_INTRO); $sNewsDate = Anwi18n::date(AnwUtils::dateToTime($oNewsContent->getContentFieldValue(AnwContentClassPageDefault_news::FIELD_DATE)), $oPage->getLang()); $sNewsUrl = AnwUtils::link($oNewsPage); $sHtmlNewsList .= $this->tpl()->newsListItem($sNewsTitle, $sNewsIntro, $sNewsDate, $sNewsUrl, $oNewsPage->getLang()); } $sHtmlNewsList .= $this->tpl()->newsListEnd(); } unset($aoNewsList); //render the newscategory $sHtmlBody = $this->tpl()->showNewscategory($sNewsCategoryTitle, $sNewsCategoryIntro, $sHtmlNewsList, $oPage->getLang()); $oOutputHtml->setBody($sHtmlBody); return $oOutputHtml; }
function toHtml($oContent, $oPage) { $oOutputHtml = new AnwOutputHtml($oPage); $oOutputHtml->setTitle($oContent->getContentFieldValue(self::FIELD_TITLE)); //load contentclass CSS $oOutputHtml->setHead($this->getCssSrcComponent(self::CSS_FILE)); $sNewsTitle = $oContent->getContentFieldValue(self::FIELD_TITLE); $sNewsIntro = $oContent->getContentFieldValue(self::FIELD_INTRO); $sNewsBody = $oContent->getContentFieldValue(self::FIELD_BODY); $sNewsDate = Anwi18n::date(AnwUtils::dateToTime($oContent->getContentFieldValue(self::FIELD_DATE)), $oPage->getLang()); //render categories $aoCategoriesPages = self::getCategoriesPages($oContent, $oPage); $sHtmlCategories = ""; if (count($aoCategoriesPages) > 0) { $sHtmlCategories .= $this->tpl()->categoriesStart(); foreach ($aoCategoriesPages as $oCategoryPage) { $oCategoryContent = $oCategoryPage->getContent(); $sCategoryTitle = $oCategoryContent->getContentFieldValue(AnwContentClassPageDefault_newscategory::FIELD_TITLE); $sCategoryUrl = AnwUtils::link($oCategoryPage); $sHtmlCategories .= $this->tpl()->categoriesItem($sCategoryTitle, $sCategoryUrl); } $sHtmlCategories .= $this->tpl()->categoriesEnd(); } unset($aoCategoriesPages); //render the news $sHtmlBody = $this->tpl()->showNews($sNewsTitle, $sNewsIntro, $sNewsBody, $sNewsDate, $sHtmlCategories, $oPage->getLang()); $oOutputHtml->setBody($sHtmlBody); return $oOutputHtml; }
function toHtml($oContent, $oPage) { $sFileName = $oContent->getContentFieldValue(self::FIELD_NAME); $oOutputHtml = new AnwOutputHtml($oPage); $oOutputHtml->setTitle($this->t_('local_title', array('name' => $sFileName), $oPage->getLang())); $sHtmlBody = ""; $sHtmlBody .= $this->tpl()->startTrfile($sFileName, $oPage->getLang()); $aoContentsTrfileItems = $oContent->getSubContents(self::FIELD_ITEMS); foreach ($aoContentsTrfileItems as $oContentTrfileItem) { $sTranslationId = $oContentTrfileItem->getContentFieldValue(AnwContentFieldPage_trfileItem::FIELD_ID, 0, true); $sTranslationValue = $oContentTrfileItem->getContentFieldValue(AnwContentFieldPage_trfileItem::FIELD_VALUE); $sHtmlBody .= $this->tpl()->translationItem($sTranslationId, $sTranslationValue); } $sHtmlBody .= $this->tpl()->stopTrfile(); $oOutputHtml->setBody($sHtmlBody); return $oOutputHtml; }
function toHtml($oContent, $oPage) { $oOutputHtml = new AnwOutputHtml($oPage); $sTitleValue = $oContent->getContentFieldOutput(self::FIELD_TITLE); $sHeadValue = $oContent->getContentFieldOutput(self::FIELD_HEAD); $sBodyValue = $oContent->getContentFieldOutput(self::FIELD_BODY); $oOutputHtml->setTitle($sTitleValue); $oOutputHtml->setHead($this->tpl()->toHtmlHead($sHeadValue, $sTitleValue)); $oOutputHtml->setBody($this->tpl()->toHtmlBody($sBodyValue, $sTitleValue)); $oOutputHtml->setTitleDependancy($this->getContentField(self::FIELD_TITLE)); $oOutputHtml->setHeadDependancy($this->getContentField(self::FIELD_HEAD)); $oOutputHtml->setBodyDependancy($this->getContentField(self::FIELD_BODY)); //$oOutputHtml->setTitle( self::getTitleForOutput($oContent, $oPage, $oOutputHtml) ); //$oOutputHtml->setHead( self::getHeadForOutput($oContent, $oPage, $oOutputHtml) ); //$oOutputHtml->setBody( self::getBodyForOutput($oContent, $oPage, $oOutputHtml) ); return $oOutputHtml; }
protected function getCachedOutput($oPage, $sCallbackName) { // use callback name as cacheKey + currentpage $sCacheKey = $sCallbackName . "-currentpage-" . AnwActionPage::getCurrentPageName(); try { $oOutputHtml = $oPage->getCachedOutputHtml($sCacheKey); } catch (AnwCacheNotFoundException $e) { // render now... $oContent = $oPage->getContent(); $sRender = $this->{$sCallbackName}($oContent); // build outputhtml... $oOutputHtml = new AnwOutputHtml($oPage); $oOutputHtml->setTitle($oContent->getContentFieldValue(self::FIELD_TITLE, 0, true)); $oOutputHtml->setBody($sRender); // put in cache... $oOutputHtml->putCachedOutputHtml($sCacheKey); } return $oOutputHtml; }
function toHtml($oContent, $oPage) { $aoContentClasses = array(); $asContentClassNames = $oContent->getContentFieldValues(self::FIELD_CONTENTCLASS); foreach ($asContentClassNames as $sContentClassName) { $oContentClass = AnwContentClasses::getContentClass($sContentClassName); $aoContentClasses[] = $oContentClass; } unset($asContentClassNames); //get feed items $aoMatchingPages = AnwStorage::fetchPages($oContent->getContentFieldValues(self::FIELD_MATCH, true), $aoContentClasses, array($oPage->getLang()), $oContent->getContentFieldValue(self::FIELD_LIMIT), AnwUtils::SORT_BY_TIME, AnwUtils::SORTORDER_DESC); $aoFeedItems = array(); foreach ($aoMatchingPages as $oMatchingPage) { $oFeedItem = $oMatchingPage->toFeedItem(); $aoFeedItems[] = $oFeedItem; } if (AnwEnv::_GET(self::GET_FEED) != AnwFeed::TYPE_RSS2) { $sUrlRss = AnwUtils::link($oPage, "view", array(self::GET_FEED => AnwFeed::TYPE_RSS2)); //show feed info $oOutputHtml = new AnwOutputHtml($oPage); $oOutputHtml->setTitle($oContent->getContentFieldValue(self::FIELD_TITLE)); $sHtmlItems = ""; foreach ($aoFeedItems as $oFeedItem) { $sHtmlItems .= $this->tpl()->feedItem($oFeedItem->getTitle(), $oFeedItem->getLink()); } $sHtmlBody = $this->tpl()->feedInfo($oContent->getContentFieldValue(self::FIELD_TITLE), $oContent->getContentFieldValue(self::FIELD_DESCRIPTION), $sUrlRss, $sHtmlItems, $oPage->getLang()); $oOutputHtml->setBody($sHtmlBody); // load contentclass CSS $sHtmlHead = $this->getCssSrcComponent(self::CSS_FILE); $sHtmlHead .= $this->tpl()->headRss($sUrlRss, $oContent->getContentFieldValue(self::FIELD_TITLE)); $oOutputHtml->setHead($sHtmlHead); } else { $sUrlRss = AnwUtils::linkAbsolute($oPage, "view", array(self::GET_FEED => AnwFeed::TYPE_RSS2)); //export to rss $oFeed = new AnwFeed(AnwFeed::TYPE_RSS2, $oContent->getContentFieldValue(self::FIELD_TITLE), $sUrlRss, $oContent->getContentFieldValue(self::FIELD_DESCRIPTION)); foreach ($aoFeedItems as $oFeedItem) { $oFeed->addItem($oFeedItem); } $oFeed->output(); } return $oOutputHtml; }