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
00208 protected function _prepareMetaKeyword( $sKeywords )
00209 {
00210 if ( !$sKeywords &&
00211 $this->getConfig()->getConfigParam( 'bl_perfLoadAktion' ) &&
00212 $oArt = $this->getFirstArticle() ) {
00213 $oDescField = $oArt->getArticleLongDesc();
00214 $sKeywords = $oDescField->value;
00215 }
00216 return parent::_prepareMetaKeyword( $sKeywords );
00217 }
00218
00224 protected function _getLoadActionsParam()
00225 {
00226 if ( $this->_blLoadActions === null ) {
00227 $this->_blLoadActions = false;
00228 if ( $this->getConfig()->getConfigParam( 'bl_perfLoadAktion' ) ) {
00229 $this->_blLoadActions = true;
00230 }
00231 }
00232 return $this->_blLoadActions;
00233 }
00234
00240 public function getArticleList()
00241 {
00242 if ( $this->_aArticleList === null ) {
00243 $this->_aArticleList = array();
00244 if ( $this->_getLoadActionsParam() ) {
00245
00246 $oArtList = oxNew( 'oxarticlelist' );
00247 $oArtList->loadAktionArticles( 'OXSTART' );
00248 if ( $oArtList->count() ) {
00249 $this->_aArticleList = $oArtList;
00250 }
00251 }
00252 }
00253 return $this->_aArticleList;
00254 }
00255
00261 public function getTopArticleList()
00262 {
00263 if ( $this->_aTopArticleList === null ) {
00264 $this->_aTopArticleList = false;
00265 if ( $this->_getLoadActionsParam() ) {
00266
00267 $oArtList = oxNew( 'oxarticlelist' );
00268 $oArtList->loadAktionArticles( 'OXTOPSTART' );
00269 if ( $oArtList->count() ) {
00270 $this->_aTopArticleList = $oArtList;
00271 }
00272 }
00273 }
00274 return $this->_aTopArticleList;
00275 }
00276
00282 public function getNewestArticles()
00283 {
00284 if ( $this->_aNewArticleList === null ) {
00285 $this->_aNewArticleList = array();
00286 if ( $this->_getLoadActionsParam() ) {
00287
00288 $oArtList = oxNew( 'oxarticlelist' );
00289 $oArtList->loadNewestArticles();
00290 if ( $oArtList->count() ) {
00291 $this->_aNewArticleList = $oArtList;
00292 }
00293 }
00294 }
00295 return $this->_aNewArticleList;
00296 }
00297
00303 public function getFirstArticle()
00304 {
00305 if ( $this->_oFirstArticle === null ) {
00306 $this->_oFirstArticle = false;
00307 if ( $this->_getLoadActionsParam() ) {
00308
00309 $oArtList = oxNew( 'oxarticlelist' );
00310 $oArtList->loadAktionArticles( 'OXFIRSTSTART' );
00311 if ( $oArtList->count() ) {
00312 $this->_oFirstArticle = $oArtList->current();
00313 }
00314 }
00315 }
00316 return $this->_oFirstArticle;
00317 }
00318
00324 public function getCatOfferArticle()
00325 {
00326 if ( $this->_oCatOfferArticle === null ) {
00327 $this->_oCatOfferArticle = false;
00328 if ( $oArtList = $this->getCatOfferArticleList() ) {
00329 $this->_oCatOfferArticle = $oArtList->current();
00330 }
00331 }
00332 return $this->_oCatOfferArticle;
00333 }
00334
00340 public function getCatOfferArticleList()
00341 {
00342 if ( $this->_oCatOfferArtList === null ) {
00343 $this->_oCatOfferArtList = array();
00344 if ( $this->_getLoadActionsParam() ) {
00345
00346 $oArtList = oxNew( 'oxarticlelist' );
00347 $oArtList->loadAktionArticles( 'OXCATOFFER' );
00348 if ( $oArtList->count() ) {
00349 $this->_oCatOfferArtList = $oArtList;
00350 }
00351 }
00352 }
00353 return $this->_oCatOfferArtList;
00354 }
00355
00361 public function getTagCloud()
00362 {
00363 if ( $this->_sTagCloud === null ) {
00364 $this->_sTagCloud = false;
00365 $oTagHandler = oxNew('oxTagCloud');
00366 $this->_sTagCloud = $oTagHandler->getTagCloud();
00367 }
00368 return $this->_sTagCloud;
00369 }
00370
00376 public function isMoreTagsVisible()
00377 {
00378 return true;
00379 }
00380
00386 public function getTitleSuffix()
00387 {
00388 return $this->getConfig()->getActiveShop()->oxshops__oxstarttitle->value;
00389 }
00390
00391 }