Go to the documentation of this file.00001 <?php
00002
00007 class Start extends oxUBase
00008 {
00013 protected $_sThisTemplate = 'start.tpl';
00014
00020 protected $_sMetaDescriptionIdent = 'oxstartmetadescription';
00021
00027 protected $_sMetaKeywordsIdent = 'oxstartmetakeywords';
00028
00034 protected $_blLoadActions = null;
00035
00041 protected $_aTopArticleList = null;
00042
00048 protected $_aNewArticleList = null;
00049
00055 protected $_oFirstArticle = null;
00056
00062 protected $_oCatOfferArticle = null;
00063
00069 protected $_oCatOfferArtList = null;
00070
00076 protected $_sTagCloud = null;
00077
00082 protected $_blTop5Action = true;
00083
00088 protected $_blBargainAction = true;
00089
00101 public function render()
00102 {
00103 if ( oxConfig::getParameter( 'showexceptionpage' ) == '1' ) {
00104 return 'exception.tpl';
00105 }
00106
00107 startProfile("allarticles");
00108
00109 $myConfig = $this->getConfig();
00110 if ( $myConfig->getConfigParam( 'bl_perfLoadAktion' ) ) {
00111
00112 $this->_loadActions();
00113 $myUtilsCount = oxUtilsCount::getInstance();
00114
00115 if ( $oArtList = $this->getCatOfferArticleList() ) {
00116 foreach ( $oArtList as $oCatArticle ) {
00117 $oCatArticle->oCategory = $oCatArticle->getCategory();
00118 if ( $oCatArticle->oCategory && $myConfig->getConfigParam( 'bl_perfShowActionCatArticleCnt' ) ) {
00119 $oCatArticle->oCategory->iArtCnt = $oCatArticle->oCategory->getNrOfArticles();
00120 if ( $oCatArticle->oCategory->iArtCnt == -1 ) {
00121 $oCatArticle->oCategory->iArtCnt = $myUtilsCount->getCatArticleCount( $oCatArticle->oCategory->oxcategories__oxid->value );
00122 }
00123 }
00124 }
00125 }
00126 }
00127
00128 $this->_aViewData['articlelist'] = $this->getArticleList();
00129 $this->_aViewData['toparticlelist'] = $this->getTopArticleList();
00130 $this->_aViewData['aNewestArticles'] = $this->getNewestArticles();
00131 $this->_aViewData['firstarticle'] = $this->getFirstArticle();
00132
00133 $this->_aViewData['articlecatofferlist'] = $this->getCatOfferArticleList();
00134 $this->_aViewData['articlecatoffer'] = $this->getCatOfferArticle();
00135
00136 stopProfile("allarticles");
00137
00138 startProfile("tagCloud");
00139 $this->_aViewData['tagCloud'] = $this->getTagCloud();
00140 $this->_aViewData['blMoreTags'] = $this->isMoreTagsVisible();
00141 stopProfile("tagCloud");
00142
00143 $oRss = oxNew('oxrssfeed');
00144 if ($myConfig->getConfigParam( 'iTop5Mode' ) && $myConfig->getConfigParam( 'bl_rssTopShop' ) ) {
00145 $this->addRssFeed( $oRss->getTopInShopTitle(), $oRss->getTopInShopUrl(), 'topArticles' );
00146 }
00147 if ( $myConfig->getConfigParam( 'iNewestArticlesMode' ) && $myConfig->getConfigParam( 'bl_rssNewest' ) ) {
00148 $this->addRssFeed( $oRss->getNewestArticlesTitle(), $oRss->getNewestArticlesUrl(), 'newestArticles' );
00149 }
00150 if ( $myConfig->getConfigParam( 'bl_rssBargain' ) ) {
00151 $this->addRssFeed( $oRss->getBargainTitle(), $oRss->getBargainUrl(), 'bargainArticles' );
00152 }
00153
00154 parent::render();
00155
00156 return $this->_sThisTemplate;
00157 }
00158
00170 protected function _prepareMetaDescription( $sMeta, $iLength = 1024, $blDescTag = false )
00171 {
00172 if ( !$sMeta &&
00173 $this->getConfig()->getConfigParam( 'bl_perfLoadAktion' ) &&
00174 $oArt = $this->getFirstArticle() ) {
00175 $oDescField = $oArt->getArticleLongDesc();
00176 $sMeta = $oArt->oxarticles__oxtitle->value . ' - ' . $oDescField->value;
00177 }
00178 return parent::_prepareMetaDescription( $sMeta, $iLength, $blDescTag );
00179 }
00180
00191 protected function _prepareMetaKeyword( $sKeywords, $blRemoveDuplicatedWords = true )
00192 {
00193 if ( !$sKeywords &&
00194 $this->getConfig()->getConfigParam( 'bl_perfLoadAktion' ) &&
00195 $oArt = $this->getFirstArticle() ) {
00196 $oDescField = $oArt->getArticleLongDesc();
00197 $sKeywords = $oDescField->value;
00198 }
00199
00200 return parent::_prepareMetaKeyword( $sKeywords, $blRemoveDuplicatedWords );
00201 }
00202
00208 protected function _getLoadActionsParam()
00209 {
00210 if ( $this->_blLoadActions === null ) {
00211 $this->_blLoadActions = false;
00212 if ( $this->getConfig()->getConfigParam( 'bl_perfLoadAktion' ) ) {
00213 $this->_blLoadActions = true;
00214 }
00215 }
00216 return $this->_blLoadActions;
00217 }
00218
00224 public function getArticleList()
00225 {
00226 if ( $this->_aArticleList === null ) {
00227 $this->_aArticleList = array();
00228 if ( $this->_getLoadActionsParam() ) {
00229
00230 $oArtList = oxNew( 'oxarticlelist' );
00231 $oArtList->loadAktionArticles( 'OXSTART' );
00232 if ( $oArtList->count() ) {
00233 $this->_aArticleList = $oArtList;
00234 }
00235 }
00236 }
00237 return $this->_aArticleList;
00238 }
00239
00245 public function getTopArticleList()
00246 {
00247 if ( $this->_aTopArticleList === null ) {
00248 $this->_aTopArticleList = false;
00249 if ( $this->_getLoadActionsParam() ) {
00250
00251 $oArtList = oxNew( 'oxarticlelist' );
00252 $oArtList->loadAktionArticles( 'OXTOPSTART' );
00253 if ( $oArtList->count() ) {
00254 $this->_aTopArticleList = $oArtList;
00255 }
00256 }
00257 }
00258 return $this->_aTopArticleList;
00259 }
00260
00266 public function getNewestArticles()
00267 {
00268 if ( $this->_aNewArticleList === null ) {
00269 $this->_aNewArticleList = array();
00270 if ( $this->_getLoadActionsParam() ) {
00271
00272 $oArtList = oxNew( 'oxarticlelist' );
00273 $oArtList->loadNewestArticles();
00274 if ( $oArtList->count() ) {
00275 $this->_aNewArticleList = $oArtList;
00276 }
00277 }
00278 }
00279 return $this->_aNewArticleList;
00280 }
00281
00287 public function getFirstArticle()
00288 {
00289 if ( $this->_oFirstArticle === null ) {
00290 $this->_oFirstArticle = false;
00291 if ( $this->_getLoadActionsParam() ) {
00292
00293 $oArtList = oxNew( 'oxarticlelist' );
00294 $oArtList->loadAktionArticles( 'OXFIRSTSTART' );
00295 if ( $oArtList->count() ) {
00296 $this->_oFirstArticle = $oArtList->current();
00297 }
00298 }
00299 }
00300 return $this->_oFirstArticle;
00301 }
00302
00308 public function getCatOfferArticle()
00309 {
00310 if ( $this->_oCatOfferArticle === null ) {
00311 $this->_oCatOfferArticle = false;
00312 if ( $oArtList = $this->getCatOfferArticleList() ) {
00313 $this->_oCatOfferArticle = $oArtList->current();
00314 }
00315 }
00316 return $this->_oCatOfferArticle;
00317 }
00318
00324 public function getCatOfferArticleList()
00325 {
00326 if ( $this->_oCatOfferArtList === null ) {
00327 $this->_oCatOfferArtList = array();
00328 if ( $this->_getLoadActionsParam() ) {
00329
00330 $oArtList = oxNew( 'oxarticlelist' );
00331 $oArtList->loadAktionArticles( 'OXCATOFFER' );
00332 if ( $oArtList->count() ) {
00333 $this->_oCatOfferArtList = $oArtList;
00334 }
00335 }
00336 }
00337 return $this->_oCatOfferArtList;
00338 }
00339
00347 public function getTagCloud()
00348 {
00349 if ( $this->_sTagCloud === null ) {
00350 $this->_sTagCloud = false;
00351 $oTagHandler = oxNew('oxTagCloud');
00352 $this->_sTagCloud = $oTagHandler->getTagCloud();
00353 }
00354 return $this->_sTagCloud;
00355 }
00356
00362 public function getTagCloudManager()
00363 {
00364 return oxNew( "oxTagCloud" );
00365 }
00366
00372 public function isMoreTagsVisible()
00373 {
00374 return true;
00375 }
00376
00382 public function getTitleSuffix()
00383 {
00384 return $this->getConfig()->getActiveShop()->oxshops__oxstarttitle->value;
00385 }
00386
00392 public function getCanonicalUrl()
00393 {
00394 if ( oxUtils::getInstance()->seoIsActive() && ( $oViewConf = $this->getViewConfig() ) ) {
00395 return oxUtilsUrl::getInstance()->prepareCanonicalUrl( $oViewConf->getHomeLink() );
00396 }
00397 }
00398 }