start.php

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             // loading actions
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         $aRssSelected = $myConfig->getConfigParam( 'aRssSelected' );
00144         $oRss = oxNew('oxrssfeed');
00145         if ( is_array( $aRssSelected ) ) {
00146             if ($myConfig->getConfigParam( 'iTop5Mode' ) && in_array( 'oxrss_topshop', $aRssSelected ) ) {
00147                 $this->addRssFeed( $oRss->getTopInShopTitle(), $oRss->getTopInShopUrl(), 'topArticles' );
00148             }
00149             if ( $myConfig->getConfigParam( 'iNewestArticlesMode' ) && in_array( 'oxrss_newest', $aRssSelected ) ) {
00150                 $this->addRssFeed( $oRss->getNewestArticlesTitle(), $oRss->getNewestArticlesUrl(), 'newestArticles' );
00151             }
00152             if ( in_array( 'oxrss_bargain', $aRssSelected ) ) {
00153                 $this->addRssFeed( $oRss->getBargainTitle(), $oRss->getBargainUrl(), 'bargainArticles' );
00154             }
00155         }
00156 
00157         parent::render();
00158 
00159         return $this->_sThisTemplate;
00160     }
00161 
00173     protected function _prepareMetaDescription( $sMeta, $iLength = 1024, $blDescTag = false )
00174     {
00175         if ( !$sMeta &&
00176             $this->getConfig()->getConfigParam( 'bl_perfLoadAktion' ) &&
00177             $oArt = $this->getFirstArticle() ) {
00178             $oDescField = $oArt->getArticleLongDesc();
00179             $sMeta = $oArt->oxarticles__oxtitle->value . ' - ' . $oDescField->value;
00180         }
00181         return parent::_prepareMetaDescription( $sMeta, $iLength, $blDescTag );
00182     }
00183 
00194     protected function _prepareMetaKeyword( $sKeywords, $blRemoveDuplicatedWords = true )
00195     {
00196         if ( !$sKeywords &&
00197             $this->getConfig()->getConfigParam( 'bl_perfLoadAktion' ) &&
00198             $oArt = $this->getFirstArticle() ) {
00199             $oDescField = $oArt->getArticleLongDesc();
00200             $sKeywords = $oDescField->value;
00201         }
00202 
00203         return parent::_prepareMetaKeyword( $sKeywords, $blRemoveDuplicatedWords );
00204     }
00205 
00211     protected function _getLoadActionsParam()
00212     {
00213         if ( $this->_blLoadActions === null ) {
00214             $this->_blLoadActions = false;
00215             if ( $this->getConfig()->getConfigParam( 'bl_perfLoadAktion' ) ) {
00216                 $this->_blLoadActions = true;
00217             }
00218         }
00219         return $this->_blLoadActions;
00220     }
00221 
00227     public function getArticleList()
00228     {
00229         if ( $this->_aArticleList === null ) {
00230             $this->_aArticleList = array();
00231             if ( $this->_getLoadActionsParam() ) {
00232                 // start list
00233                 $oArtList = oxNew( 'oxarticlelist' );
00234                 $oArtList->loadAktionArticles( 'OXSTART' );
00235                 if ( $oArtList->count() ) {
00236                     $this->_aArticleList = $oArtList;
00237                 }
00238             }
00239         }
00240         return $this->_aArticleList;
00241     }
00242 
00248     public function getTopArticleList()
00249     {
00250         if ( $this->_aTopArticleList === null ) {
00251             $this->_aTopArticleList = false;
00252             if ( $this->_getLoadActionsParam() ) {
00253                 // start list
00254                 $oArtList = oxNew( 'oxarticlelist' );
00255                 $oArtList->loadAktionArticles( 'OXTOPSTART' );
00256                 if ( $oArtList->count() ) {
00257                     $this->_aTopArticleList = $oArtList;
00258                 }
00259             }
00260         }
00261         return $this->_aTopArticleList;
00262     }
00263 
00269     public function getNewestArticles()
00270     {
00271         if ( $this->_aNewArticleList === null ) {
00272             $this->_aNewArticleList = array();
00273             if ( $this->_getLoadActionsParam() ) {
00274                 // newest articles
00275                 $oArtList = oxNew( 'oxarticlelist' );
00276                 $oArtList->loadNewestArticles();
00277                 if ( $oArtList->count() ) {
00278                     $this->_aNewArticleList = $oArtList;
00279                 }
00280             }
00281         }
00282         return $this->_aNewArticleList;
00283     }
00284 
00290     public function getFirstArticle()
00291     {
00292         if ( $this->_oFirstArticle === null ) {
00293             $this->_oFirstArticle = false;
00294             if ( $this->_getLoadActionsParam() ) {
00295                 // top articles ( big one )
00296                 $oArtList = oxNew( 'oxarticlelist' );
00297                 $oArtList->loadAktionArticles( 'OXFIRSTSTART' );
00298                 if ( $oArtList->count() ) {
00299                     $this->_oFirstArticle = $oArtList->current();
00300                 }
00301             }
00302         }
00303         return $this->_oFirstArticle;
00304     }
00305 
00311     public function getCatOfferArticle()
00312     {
00313         if ( $this->_oCatOfferArticle === null ) {
00314             $this->_oCatOfferArticle = false;
00315             if ( $oArtList = $this->getCatOfferArticleList() ) {
00316                 $this->_oCatOfferArticle = $oArtList->current();
00317             }
00318         }
00319         return $this->_oCatOfferArticle;
00320     }
00321 
00327     public function getCatOfferArticleList()
00328     {
00329         if ( $this->_oCatOfferArtList === null ) {
00330             $this->_oCatOfferArtList = array();
00331             if ( $this->_getLoadActionsParam() ) {
00332                 // "category offer" articles
00333                 $oArtList = oxNew( 'oxarticlelist' );
00334                 $oArtList->loadAktionArticles( 'OXCATOFFER' );
00335                 if ( $oArtList->count() ) {
00336                     $this->_oCatOfferArtList = $oArtList;
00337                 }
00338             }
00339         }
00340         return $this->_oCatOfferArtList;
00341     }
00342 
00348     public function getTagCloud()
00349     {
00350         if ( $this->_sTagCloud === null ) {
00351             $this->_sTagCloud = false;
00352             $oTagHandler = oxNew('oxTagCloud');
00353             $this->_sTagCloud = $oTagHandler->getTagCloud();
00354         }
00355         return $this->_sTagCloud;
00356     }
00357 
00363     public function isMoreTagsVisible()
00364     {
00365         return true;
00366     }
00367 
00373     public function getTitleSuffix()
00374     {
00375         return $this->getConfig()->getActiveShop()->oxshops__oxstarttitle->value;
00376     }
00377 
00383     public function getCanonicalUrl()
00384     {
00385         if ( oxUtils::getInstance()->seoIsActive() && ( $oViewConf = $this->getViewConfig() ) ) {
00386             return $oViewConf->getHomeLink();
00387         }
00388     }
00389 }

Generated on Mon Oct 26 20:07:20 2009 for OXID eShop CE by  doxygen 1.5.5