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
00083 public function init()
00084 {
00085 if ( oxUtils::getInstance()->seoIsActive() ) {
00086
00087 $this->setSessionCategoryId( null );
00088 }
00089
00090 parent::init();
00091 }
00092
00104 public function render()
00105 {
00106 if ( oxConfig::getParameter( 'showexceptionpage' ) == '1' ) {
00107 return 'exception.tpl';
00108 }
00109
00110 startProfile("allarticles");
00111
00112 $myConfig = $this->getConfig();
00113 if ( $myConfig->getConfigParam( 'bl_perfLoadAktion' ) ) {
00114
00115 $this->_loadActions();
00116
00117 $sMetaDescription = '';
00118 $sMetaKeywords = '';
00119 $blDescTag = false;
00120
00121
00122
00123
00124
00125 if ( $oArt = $this->getFirstArticle() ) {
00126 $sMetaKeywords = $oArt->oxarticles__oxlongdesc->value;
00127 $sMetaDescription = $oArt->oxarticles__oxtitle->value . ' - ' . $sMetaKeywords;
00128 $blDescTag = true;
00129 }
00130
00131 $this->setMetaKeywords( $sMetaKeywords );
00132 $this->setMetaDescription( $sMetaDescription, 200, $blDescTag );
00133
00134 if ( $oArtList = $this->getCatOfferArticleList() ) {
00135 foreach ( $oArtList as $oCatArticle ) {
00136 $oCatArticle->oCategory = $oCatArticle->getCategory();
00137 if ( $oCatArticle->oCategory && $myConfig->getConfigParam( 'bl_perfShowActionCatArticleCnt' ) ) {
00138 $oCatArticle->oCategory->iArtCnt = $oCatArticle->oCategory->getNrOfArticles();
00139 if ( $oCatArticle->oCategory->iArtCnt == -1 ) {
00140 $oCatArticle->oCategory->iArtCnt = oxUtilsCount::getInstance()->getCatArticleCount( $oCatArticle->oCategory->oxcategories__oxid->value );
00141 }
00142 }
00143 }
00144 }
00145 }
00146
00147 $this->_aViewData['articlelist'] = $this->getArticleList();
00148 $this->_aViewData['toparticlelist'] = $this->getTopArticleList();
00149 $this->_aViewData['aNewestArticles'] = $this->getNewestArticles();
00150 $this->_aViewData['firstarticle'] = $this->getFirstArticle();
00151
00152 $this->_aViewData['articlecatofferlist'] = $this->getCatOfferArticleList();
00153 $this->_aViewData['articlecatoffer'] = $this->getCatOfferArticle();
00154
00155 stopProfile("allarticles");
00156
00157 startProfile("tagCloud");
00158 $this->_aViewData['tagCloud'] = $this->getTagCloud();
00159 $this->_aViewData['blMoreTags'] = $this->isMoreTagsVisible();
00160 stopProfile("tagCloud");
00161
00162 $aRssSelected = $myConfig->getConfigParam( 'aRssSelected' );
00163 $oRss = oxNew('oxrssfeed');
00164 if ( is_array( $aRssSelected ) ) {
00165 if ($myConfig->getConfigParam( 'iTop5Mode' ) && in_array( 'oxrss_topshop', $aRssSelected ) ) {
00166 $this->addRssFeed( $oRss->getTopInShopTitle(), $oRss->getTopInShopUrl(), 'topArticles' );
00167 }
00168 if ( $myConfig->getConfigParam( 'iNewestArticlesMode' ) && in_array( 'oxrss_newest', $aRssSelected ) ) {
00169 $this->addRssFeed( $oRss->getNewestArticlesTitle(), $oRss->getNewestArticlesUrl(), 'newestArticles' );
00170 }
00171 if ( in_array( 'oxrss_bargain', $aRssSelected ) ) {
00172 $this->addRssFeed( $oRss->getBargainTitle(), $oRss->getBargainUrl(), 'bargainArticles' );
00173 }
00174 }
00175
00176 parent::render();
00177
00178 return $this->_sThisTemplate;
00179 }
00180
00192 public function setMetaDescription ( $sInput, $iLength = 1024, $blDescTag = false )
00193 {
00194 $oContent = oxNew( 'oxcontent' );
00195 if ( $oContent->loadByIdent( $this->_sMetaDescriptionIdent ) && $oContent->oxcontents__oxactive->value ) {
00196 $sInput = $oContent->oxcontents__oxcontent->value;
00197 }
00198
00199 return parent::setMetaDescription ( $sInput, $iLength, $blDescTag );
00200 }
00201
00211 public function setMetaKeywords( $sInput )
00212 {
00213 $oContent = oxNew( 'oxcontent' );
00214 if ( $oContent->loadByIdent( $this->_sMetaKeywordsIdent ) && $oContent->oxcontents__oxactive->value ) {
00215 $sInput = $oContent->oxcontents__oxcontent->value;
00216 }
00217
00218 return parent::setMetaKeywords( $sInput );
00219 }
00220
00226 public 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 }