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
00095 public function init()
00096 {
00097 if ( oxUtils::getInstance()->seoIsActive() ) {
00098
00099 $this->setSessionCategoryId( null );
00100 }
00101
00102 parent::init();
00103 }
00104
00116 public function render()
00117 {
00118 if ( oxConfig::getParameter( 'showexceptionpage' ) == '1' ) {
00119 return 'exception.tpl';
00120 }
00121
00122 startProfile("allarticles");
00123
00124 $myConfig = $this->getConfig();
00125 if ( $myConfig->getConfigParam( 'bl_perfLoadAktion' ) ) {
00126
00127 $this->_loadActions();
00128 $myUtilsCount = oxUtilsCount::getInstance();
00129
00130 if ( $oArtList = $this->getCatOfferArticleList() ) {
00131 foreach ( $oArtList as $oCatArticle ) {
00132 $oCatArticle->oCategory = $oCatArticle->getCategory();
00133 if ( $oCatArticle->oCategory && $myConfig->getConfigParam( 'bl_perfShowActionCatArticleCnt' ) ) {
00134 $oCatArticle->oCategory->iArtCnt = $oCatArticle->oCategory->getNrOfArticles();
00135 if ( $oCatArticle->oCategory->iArtCnt == -1 ) {
00136 $oCatArticle->oCategory->iArtCnt = $myUtilsCount->getCatArticleCount( $oCatArticle->oCategory->oxcategories__oxid->value );
00137 }
00138 }
00139 }
00140 }
00141 }
00142
00143 $this->_aViewData['articlelist'] = $this->getArticleList();
00144 $this->_aViewData['toparticlelist'] = $this->getTopArticleList();
00145 $this->_aViewData['aNewestArticles'] = $this->getNewestArticles();
00146 $this->_aViewData['firstarticle'] = $this->getFirstArticle();
00147
00148 $this->_aViewData['articlecatofferlist'] = $this->getCatOfferArticleList();
00149 $this->_aViewData['articlecatoffer'] = $this->getCatOfferArticle();
00150
00151 stopProfile("allarticles");
00152
00153 startProfile("tagCloud");
00154 $this->_aViewData['tagCloud'] = $this->getTagCloud();
00155 $this->_aViewData['blMoreTags'] = $this->isMoreTagsVisible();
00156 stopProfile("tagCloud");
00157
00158 $aRssSelected = $myConfig->getConfigParam( 'aRssSelected' );
00159 $oRss = oxNew('oxrssfeed');
00160 if ( is_array( $aRssSelected ) ) {
00161 if ($myConfig->getConfigParam( 'iTop5Mode' ) && in_array( 'oxrss_topshop', $aRssSelected ) ) {
00162 $this->addRssFeed( $oRss->getTopInShopTitle(), $oRss->getTopInShopUrl(), 'topArticles' );
00163 }
00164 if ( $myConfig->getConfigParam( 'iNewestArticlesMode' ) && in_array( 'oxrss_newest', $aRssSelected ) ) {
00165 $this->addRssFeed( $oRss->getNewestArticlesTitle(), $oRss->getNewestArticlesUrl(), 'newestArticles' );
00166 }
00167 if ( in_array( 'oxrss_bargain', $aRssSelected ) ) {
00168 $this->addRssFeed( $oRss->getBargainTitle(), $oRss->getBargainUrl(), 'bargainArticles' );
00169 }
00170 }
00171
00172 parent::render();
00173
00174 return $this->_sThisTemplate;
00175 }
00176
00188 protected function _prepareMetaDescription( $sMeta, $iLength = 1024, $blDescTag = false )
00189 {
00190 if ( !$sMeta &&
00191 $this->getConfig()->getConfigParam( 'bl_perfLoadAktion' ) &&
00192 $oArt = $this->getFirstArticle() ) {
00193 $oDescField = $oArt->getArticleLongDesc();
00194 $sMeta = $oArt->oxarticles__oxtitle->value . ' - ' . $oDescField->value;
00195 }
00196 return parent::_prepareMetaDescription( $sMeta, $iLength, $blDescTag );
00197 }
00198
00209 protected function _prepareMetaKeyword( $sKeywords, $blRemoveDuplicatedWords = true )
00210 {
00211 if ( !$sKeywords &&
00212 $this->getConfig()->getConfigParam( 'bl_perfLoadAktion' ) &&
00213 $oArt = $this->getFirstArticle() ) {
00214 $oDescField = $oArt->getArticleLongDesc();
00215 $sKeywords = $oDescField->value;
00216 }
00217
00218 return parent::_prepareMetaKeyword( $sKeywords, $blRemoveDuplicatedWords );
00219 }
00220
00226 protected function _getLoadActionsParam()
00227 {
00228 if ( $this->_blLoadActions === null ) {
00229 $this->_blLoadActions = false;
00230 if ( $this->getConfig()->getConfigParam( 'bl_perfLoadAktion' ) ) {
00231 $this->_blLoadActions = true;
00232 }
00233 }
00234 return $this->_blLoadActions;
00235 }
00236
00242 public function getArticleList()
00243 {
00244 if ( $this->_aArticleList === null ) {
00245 $this->_aArticleList = array();
00246 if ( $this->_getLoadActionsParam() ) {
00247
00248 $oArtList = oxNew( 'oxarticlelist' );
00249 $oArtList->loadAktionArticles( 'OXSTART' );
00250 if ( $oArtList->count() ) {
00251 $this->_aArticleList = $oArtList;
00252 }
00253 }
00254 }
00255 return $this->_aArticleList;
00256 }
00257
00263 public function getTopArticleList()
00264 {
00265 if ( $this->_aTopArticleList === null ) {
00266 $this->_aTopArticleList = false;
00267 if ( $this->_getLoadActionsParam() ) {
00268
00269 $oArtList = oxNew( 'oxarticlelist' );
00270 $oArtList->loadAktionArticles( 'OXTOPSTART' );
00271 if ( $oArtList->count() ) {
00272 $this->_aTopArticleList = $oArtList;
00273 }
00274 }
00275 }
00276 return $this->_aTopArticleList;
00277 }
00278
00284 public function getNewestArticles()
00285 {
00286 if ( $this->_aNewArticleList === null ) {
00287 $this->_aNewArticleList = array();
00288 if ( $this->_getLoadActionsParam() ) {
00289
00290 $oArtList = oxNew( 'oxarticlelist' );
00291 $oArtList->loadNewestArticles();
00292 if ( $oArtList->count() ) {
00293 $this->_aNewArticleList = $oArtList;
00294 }
00295 }
00296 }
00297 return $this->_aNewArticleList;
00298 }
00299
00305 public function getFirstArticle()
00306 {
00307 if ( $this->_oFirstArticle === null ) {
00308 $this->_oFirstArticle = false;
00309 if ( $this->_getLoadActionsParam() ) {
00310
00311 $oArtList = oxNew( 'oxarticlelist' );
00312 $oArtList->loadAktionArticles( 'OXFIRSTSTART' );
00313 if ( $oArtList->count() ) {
00314 $this->_oFirstArticle = $oArtList->current();
00315 }
00316 }
00317 }
00318 return $this->_oFirstArticle;
00319 }
00320
00326 public function getCatOfferArticle()
00327 {
00328 if ( $this->_oCatOfferArticle === null ) {
00329 $this->_oCatOfferArticle = false;
00330 if ( $oArtList = $this->getCatOfferArticleList() ) {
00331 $this->_oCatOfferArticle = $oArtList->current();
00332 }
00333 }
00334 return $this->_oCatOfferArticle;
00335 }
00336
00342 public function getCatOfferArticleList()
00343 {
00344 if ( $this->_oCatOfferArtList === null ) {
00345 $this->_oCatOfferArtList = array();
00346 if ( $this->_getLoadActionsParam() ) {
00347
00348 $oArtList = oxNew( 'oxarticlelist' );
00349 $oArtList->loadAktionArticles( 'OXCATOFFER' );
00350 if ( $oArtList->count() ) {
00351 $this->_oCatOfferArtList = $oArtList;
00352 }
00353 }
00354 }
00355 return $this->_oCatOfferArtList;
00356 }
00357
00363 public function getTagCloud()
00364 {
00365 if ( $this->_sTagCloud === null ) {
00366 $this->_sTagCloud = false;
00367 $oTagHandler = oxNew('oxTagCloud');
00368 $this->_sTagCloud = $oTagHandler->getTagCloud();
00369 }
00370 return $this->_sTagCloud;
00371 }
00372
00378 public function isMoreTagsVisible()
00379 {
00380 return true;
00381 }
00382
00388 public function getTitleSuffix()
00389 {
00390 return $this->getConfig()->getActiveShop()->oxshops__oxstarttitle->value;
00391 }
00392
00393 }