start.php

Go to the documentation of this file.
00001 <?php
00002 
00007 class Start extends oxUBase
00008 {
00013     protected $_sThisTemplate = 'page/shop/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 
00097     public function render()
00098     {
00099         if ( oxConfig::getParameter( 'showexceptionpage' ) == '1' ) {
00100             return 'exception.tpl';
00101         }
00102 
00103         startProfile("allarticles");
00104 
00105         $myConfig = $this->getConfig();
00106         if ( $myConfig->getConfigParam( 'bl_perfLoadAktion' ) ) {
00107             $myUtilsCount = oxUtilsCount::getInstance();
00108 
00109             if ( $oArtList = $this->getCatOfferArticleList() ) {
00110                 foreach ( $oArtList as $oCatArticle ) {
00111                     $oCatArticle->oCategory = $oCatArticle->getCategory();
00112                     if ( $oCatArticle->oCategory && $myConfig->getConfigParam( 'bl_perfShowActionCatArticleCnt' ) ) {
00113                         $oCatArticle->oCategory->iArtCnt = $oCatArticle->oCategory->getNrOfArticles();
00114                         if ( $oCatArticle->oCategory->iArtCnt == -1 ) {
00115                             $oCatArticle->oCategory->iArtCnt = $myUtilsCount->getCatArticleCount( $oCatArticle->oCategory->oxcategories__oxid->value );
00116                         }
00117                     }
00118                 }
00119             }
00120         }
00121         stopProfile("allarticles");
00122 
00123         $oRss = oxNew('oxrssfeed');
00124         if ($myConfig->getConfigParam( 'iTop5Mode' ) && $myConfig->getConfigParam( 'bl_rssTopShop' ) ) {
00125             $this->addRssFeed( $oRss->getTopInShopTitle(), $oRss->getTopInShopUrl(), 'topArticles' );
00126         }
00127         if ( $myConfig->getConfigParam( 'iNewestArticlesMode' ) && $myConfig->getConfigParam( 'bl_rssNewest' ) ) {
00128             $this->addRssFeed( $oRss->getNewestArticlesTitle(), $oRss->getNewestArticlesUrl(), 'newestArticles' );
00129         }
00130         if ( $myConfig->getConfigParam( 'bl_rssBargain' ) ) {
00131             $this->addRssFeed( $oRss->getBargainTitle(), $oRss->getBargainUrl(), 'bargainArticles' );
00132         }
00133 
00134         parent::render();
00135 
00136         return $this->_sThisTemplate;
00137     }
00138 
00150     protected function _prepareMetaDescription( $sMeta, $iLength = 1024, $blDescTag = false )
00151     {
00152         if ( !$sMeta &&
00153             $this->getConfig()->getConfigParam( 'bl_perfLoadAktion' ) &&
00154             $oArt = $this->getFirstArticle() ) {
00155             $oDescField = $oArt->getArticleLongDesc();
00156             $sMeta = $oArt->oxarticles__oxtitle->value . ' - ' . $oDescField->value;
00157         }
00158         return parent::_prepareMetaDescription( $sMeta, $iLength, $blDescTag );
00159     }
00160 
00171     protected function _prepareMetaKeyword( $sKeywords, $blRemoveDuplicatedWords = true )
00172     {
00173         if ( !$sKeywords &&
00174             $this->getConfig()->getConfigParam( 'bl_perfLoadAktion' ) &&
00175             $oArt = $this->getFirstArticle() ) {
00176             $oDescField = $oArt->getArticleLongDesc();
00177             $sKeywords = $oDescField->value;
00178         }
00179 
00180         return parent::_prepareMetaKeyword( $sKeywords, $blRemoveDuplicatedWords );
00181     }
00182 
00188     protected function _getLoadActionsParam()
00189     {
00190         if ( $this->_blLoadActions === null ) {
00191             $this->_blLoadActions = false;
00192             if ( $this->getConfig()->getConfigParam( 'bl_perfLoadAktion' ) ) {
00193                 $this->_blLoadActions = true;
00194             }
00195         }
00196         return $this->_blLoadActions;
00197     }
00198 
00204     public function getArticleList()
00205     {
00206         if ( $this->_aArticleList === null ) {
00207             $this->_aArticleList = array();
00208             if ( $this->_getLoadActionsParam() ) {
00209                 // start list
00210                 $oArtList = oxNew( 'oxarticlelist' );
00211                 $oArtList->loadAktionArticles( 'OXSTART' );
00212                 if ( $oArtList->count() ) {
00213                     $this->_aArticleList = $oArtList;
00214                 }
00215             }
00216         }
00217         return $this->_aArticleList;
00218     }
00219 
00225     public function getTopArticleList()
00226     {
00227         if ( $this->_aTopArticleList === null ) {
00228             $this->_aTopArticleList = false;
00229             if ( $this->_getLoadActionsParam() ) {
00230                 // start list
00231                 $oArtList = oxNew( 'oxarticlelist' );
00232                 $oArtList->loadAktionArticles( 'OXTOPSTART' );
00233                 if ( $oArtList->count() ) {
00234                     $this->_aTopArticleList = $oArtList;
00235                 }
00236             }
00237         }
00238         return $this->_aTopArticleList;
00239     }
00240 
00241 
00242 
00243 
00249     public function getNewestArticles()
00250     {
00251         if ( $this->_aNewArticleList === null ) {
00252             $this->_aNewArticleList = array();
00253             if ( $this->_getLoadActionsParam() ) {
00254                 // newest articles
00255                 $oArtList = oxNew( 'oxarticlelist' );
00256                 $oArtList->loadNewestArticles();
00257                 if ( $oArtList->count() ) {
00258                     $this->_aNewArticleList = $oArtList;
00259                 }
00260             }
00261         }
00262         return $this->_aNewArticleList;
00263     }
00264 
00270     public function getFirstArticle()
00271     {
00272         if ( $this->_oFirstArticle === null ) {
00273             $this->_oFirstArticle = false;
00274             if ( $this->_getLoadActionsParam() ) {
00275                 // top articles ( big one )
00276                 $oArtList = oxNew( 'oxarticlelist' );
00277                 $oArtList->loadAktionArticles( 'OXFIRSTSTART' );
00278                 if ( $oArtList->count() ) {
00279                     $this->_oFirstArticle = $oArtList->current();
00280                 }
00281             }
00282         }
00283         return $this->_oFirstArticle;
00284     }
00285 
00291     public function getCatOfferArticle()
00292     {
00293         if ( $this->_oCatOfferArticle === null ) {
00294             $this->_oCatOfferArticle = false;
00295             if ( $oArtList = $this->getCatOfferArticleList() ) {
00296                 $this->_oCatOfferArticle = $oArtList->current();
00297             }
00298         }
00299         return $this->_oCatOfferArticle;
00300     }
00301 
00307     public function getCatOfferArticleList()
00308     {
00309         if ( $this->_oCatOfferArtList === null ) {
00310             $this->_oCatOfferArtList = array();
00311             if ( $this->_getLoadActionsParam() ) {
00312                 // "category offer" articles
00313                 $oArtList = oxNew( 'oxarticlelist' );
00314                 $oArtList->loadAktionArticles( 'OXCATOFFER' );
00315                 if ( $oArtList->count() ) {
00316                     $this->_oCatOfferArtList = $oArtList;
00317                 }
00318             }
00319         }
00320         return $this->_oCatOfferArtList;
00321     }
00322 
00328     public function getTagCloudManager()
00329     {
00330         return oxNew( "oxTagCloud" );
00331     }
00332 
00338     public function isMoreTagsVisible()
00339     {
00340         return true;
00341     }
00342 
00348     public function getTitleSuffix()
00349     {
00350         return $this->getConfig()->getActiveShop()->oxshops__oxstarttitle->value;
00351     }
00352 
00358     public function getCanonicalUrl()
00359     {
00360         if ( oxUtils::getInstance()->seoIsActive() && ( $oViewConf = $this->getViewConfig() ) ) {
00361             return oxUtilsUrl::getInstance()->prepareCanonicalUrl( $oViewConf->getHomeLink() );
00362         }
00363     }
00364 
00365 
00371     public function getBanners()
00372     {
00373 
00374         $oBannerList = null;
00375 
00376         if ( $this->getConfig()->getConfigParam( 'bl_perfLoadAktion' ) ) {
00377         $oBannerList = oxNew( 'oxActionList' );
00378         $oBannerList->loadBanners();
00379         }
00380 
00381         return $oBannerList;
00382     }
00383 
00389     public function getManufacturerForSlider()
00390     {
00391 
00392         $oList = null;
00393 
00394         if ( $this->getConfig()->getConfigParam( 'bl_perfLoadAktion' ) ) {
00395             $oList = $this->getManufacturerlist();
00396         }
00397 
00398         return $oList;
00399     }
00400 }