start.php

Go to the documentation of this file.
00001 <?php
00002 
00007 class Start extends oxUBase
00008 {
00014     protected $_sListDisplayType = null;
00015 
00020     protected $_sThisTemplate = 'page/shop/start.tpl';
00021 
00027     protected $_sMetaDescriptionIdent = 'oxstartmetadescription';
00028 
00034     protected $_sMetaKeywordsIdent = 'oxstartmetakeywords';
00035 
00041     protected $_blLoadActions = null;
00042 
00048     protected $_aTopArticleList = null;
00049 
00055     protected $_aNewArticleList = null;
00056 
00062     protected $_oFirstArticle = null;
00063 
00069     protected $_oCatOfferArticle = null;
00070 
00076     protected $_oCatOfferArtList = null;
00077 
00083     protected $_sTagCloud = null;
00084 
00089     protected $_blTop5Action = true;
00090 
00095     protected $_blBargainAction = true;
00096 
00097 
00105     public function render()
00106     {
00107         if ( oxConfig::getParameter( 'showexceptionpage' ) == '1' ) {
00108             return 'message/exception.tpl';
00109         }
00110 
00111         $myConfig = $this->getConfig();
00112 
00113         $oRss = oxNew('oxrssfeed');
00114         if ($myConfig->getConfigParam( 'iTop5Mode' ) && $myConfig->getConfigParam( 'bl_rssTopShop' ) ) {
00115             $this->addRssFeed( $oRss->getTopInShopTitle(), $oRss->getTopInShopUrl(), 'topArticles' );
00116         }
00117         if ( $myConfig->getConfigParam( 'iNewestArticlesMode' ) && $myConfig->getConfigParam( 'bl_rssNewest' ) ) {
00118             $this->addRssFeed( $oRss->getNewestArticlesTitle(), $oRss->getNewestArticlesUrl(), 'newestArticles' );
00119         }
00120         if ( $myConfig->getConfigParam( 'bl_rssBargain' ) ) {
00121             $this->addRssFeed( $oRss->getBargainTitle(), $oRss->getBargainUrl(), 'bargainArticles' );
00122         }
00123 
00124         parent::render();
00125 
00126         return $this->_sThisTemplate;
00127     }
00128 
00140     protected function _prepareMetaDescription( $sMeta, $iLength = 1024, $blDescTag = false )
00141     {
00142         if ( !$sMeta &&
00143             $this->getConfig()->getConfigParam( 'bl_perfLoadAktion' ) &&
00144             $oArt = $this->getFirstArticle() ) {
00145             $oDescField = $oArt->getLongDescription();
00146             $sMeta = $oArt->oxarticles__oxtitle->value . ' - ' . $oDescField->value;
00147         }
00148         return parent::_prepareMetaDescription( $sMeta, $iLength, $blDescTag );
00149     }
00150 
00161     protected function _prepareMetaKeyword( $sKeywords, $blRemoveDuplicatedWords = true )
00162     {
00163         if ( !$sKeywords &&
00164             $this->getConfig()->getConfigParam( 'bl_perfLoadAktion' ) &&
00165             $oArt = $this->getFirstArticle() ) {
00166             $oDescField = $oArt->getLongDescription();
00167             $sKeywords = $oDescField->value;
00168         }
00169 
00170         return parent::_prepareMetaKeyword( $sKeywords, $blRemoveDuplicatedWords );
00171     }
00172 
00178     protected function _getLoadActionsParam()
00179     {
00180         if ( $this->_blLoadActions === null ) {
00181             $this->_blLoadActions = false;
00182             if ( $this->getConfig()->getConfigParam( 'bl_perfLoadAktion' ) ) {
00183                 $this->_blLoadActions = true;
00184             }
00185         }
00186         return $this->_blLoadActions;
00187     }
00188 
00194     public function getArticleList()
00195     {
00196         if ( $this->_aArticleList === null ) {
00197             $this->_aArticleList = array();
00198             if ( $this->_getLoadActionsParam() ) {
00199                 // start list
00200                 $oArtList = oxNew( 'oxarticlelist' );
00201                 $oArtList->loadActionArticles( 'OXSTART' );
00202                 if ( $oArtList->count() ) {
00203                     $this->_aArticleList = $oArtList;
00204                 }
00205             }
00206         }
00207         return $this->_aArticleList;
00208     }
00209 
00215     public function getTopArticleList()
00216     {
00217         if ( $this->_aTopArticleList === null ) {
00218             $this->_aTopArticleList = false;
00219             if ( $this->_getLoadActionsParam() ) {
00220                 // start list
00221                 $oArtList = oxNew( 'oxarticlelist' );
00222                 $oArtList->loadActionArticles( 'OXTOPSTART' );
00223                 if ( $oArtList->count() ) {
00224                     $this->_aTopArticleList = $oArtList;
00225                 }
00226             }
00227         }
00228         return $this->_aTopArticleList;
00229     }
00230 
00231 
00232 
00233 
00239     public function getNewestArticles()
00240     {
00241         if ( $this->_aNewArticleList === null ) {
00242             $this->_aNewArticleList = array();
00243             if ( $this->_getLoadActionsParam() ) {
00244                 // newest articles
00245                 $oArtList = oxNew( 'oxarticlelist' );
00246                 $oArtList->loadNewestArticles();
00247                 if ( $oArtList->count() ) {
00248                     $this->_aNewArticleList = $oArtList;
00249                 }
00250             }
00251         }
00252         return $this->_aNewArticleList;
00253     }
00254 
00260     public function getFirstArticle()
00261     {
00262         if ( $this->_oFirstArticle === null ) {
00263             $this->_oFirstArticle = false;
00264             if ( $this->_getLoadActionsParam() ) {
00265                 // top articles ( big one )
00266                 $oArtList = oxNew( 'oxarticlelist' );
00267                 $oArtList->loadActionArticles( 'OXFIRSTSTART' );
00268                 if ( $oArtList->count() ) {
00269                     $this->_oFirstArticle = $oArtList->current();
00270                 }
00271             }
00272         }
00273         return $this->_oFirstArticle;
00274     }
00275 
00281     public function getCatOfferArticle()
00282     {
00283         if ( $this->_oCatOfferArticle === null ) {
00284             $this->_oCatOfferArticle = false;
00285             if ( $oArtList = $this->getCatOfferArticleList() ) {
00286                 $this->_oCatOfferArticle = $oArtList->current();
00287             }
00288         }
00289         return $this->_oCatOfferArticle;
00290     }
00291 
00297     public function getCatOfferArticleList()
00298     {
00299         if ( $this->_oCatOfferArtList === null ) {
00300             $this->_oCatOfferArtList = array();
00301             if ( $this->_getLoadActionsParam() ) {
00302                 // "category offer" articles
00303                 $oArtList = oxNew( 'oxarticlelist' );
00304                 $oArtList->loadActionArticles( 'OXCATOFFER' );
00305                 if ( $oArtList->count() ) {
00306                     $this->_oCatOfferArtList = $oArtList;
00307                 }
00308             }
00309         }
00310         return $this->_oCatOfferArtList;
00311     }
00312 
00318     public function getTitleSuffix()
00319     {
00320         return $this->getConfig()->getActiveShop()->oxshops__oxstarttitle->value;
00321     }
00322 
00328     public function getCanonicalUrl()
00329     {
00330         if ( oxRegistry::getUtils()->seoIsActive() && ( $oViewConf = $this->getViewConfig() ) ) {
00331             return oxRegistry::get("oxUtilsUrl")->prepareCanonicalUrl( $oViewConf->getHomeLink() );
00332         }
00333     }
00334 
00335 
00341     public function getBanners()
00342     {
00343 
00344         $oBannerList = null;
00345 
00346         if ( $this->getConfig()->getConfigParam( 'bl_perfLoadAktion' ) ) {
00347         $oBannerList = oxNew( 'oxActionList' );
00348         $oBannerList->loadBanners();
00349         }
00350 
00351         return $oBannerList;
00352     }
00353 
00359     public function getManufacturerForSlider()
00360     {
00361 
00362         $oList = null;
00363 
00364         if ( $this->getConfig()->getConfigParam( 'bl_perfLoadAktion' ) ) {
00365             $oList = $this->getManufacturerlist();
00366         }
00367 
00368         return $oList;
00369     }
00370 
00371 }