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
00118
00119
00120
00121 if ( $oArt = $this->getFirstArticle() ) {
00122 $sLongDescr = $oArt->oxarticles__oxlongdesc->value;
00123 $this->setMetaKeywords( $sLongDescr );
00124 $this->setMetaDescription( $oArt->oxarticles__oxtitle->value . ' - ' . $sLongDescr, 200, true );
00125 }
00126
00127 if ( $oArtList = $this->getCatOfferArticleList() ) {
00128 foreach ( $oArtList as $oCatArticle ) {
00129 $oCatArticle->oCategory = $oCatArticle->getCategory();
00130 if ( $oCatArticle->oCategory && $myConfig->getConfigParam( 'bl_perfShowActionCatArticleCnt' ) ) {
00131 $oCatArticle->oCategory->iArtCnt = $oCatArticle->oCategory->getNrOfArticles();
00132 if ( $oCatArticle->oCategory->iArtCnt == -1 ) {
00133 $oCatArticle->oCategory->iArtCnt = oxUtilsCount::getInstance()->getCatArticleCount( $oCatArticle->oCategory->oxcategories__oxid->value );
00134 }
00135 }
00136 }
00137 }
00138 }
00139
00140 $this->_aViewData['articlelist'] = $this->getArticleList();
00141 $this->_aViewData['toparticlelist'] = $this->getTopArticleList();
00142 $this->_aViewData['aNewestArticles'] = $this->getNewestArticles();
00143 $this->_aViewData['firstarticle'] = $this->getFirstArticle();
00144
00145 $this->_aViewData['articlecatofferlist'] = $this->getCatOfferArticleList();
00146 $this->_aViewData['articlecatoffer'] = $this->getCatOfferArticle();
00147
00148 stopProfile("allarticles");
00149
00150 startProfile("tagCloud");
00151 $this->_aViewData['tagCloud'] = $this->getTagCloud();
00152 $this->_aViewData['blMoreTags'] = $this->isMoreTagsVisible();
00153 stopProfile("tagCloud");
00154
00155 $aRssSelected = $myConfig->getConfigParam( 'aRssSelected' );
00156 $oRss = oxNew('oxrssfeed');
00157 if ( is_array( $aRssSelected ) ) {
00158 if ($myConfig->getConfigParam( 'iTop5Mode' ) && in_array( 'oxrss_topshop', $aRssSelected ) ) {
00159 $this->addRssFeed( $oRss->getTopInShopTitle(), $oRss->getTopInShopUrl(), 'topArticles' );
00160 }
00161 if ( $myConfig->getConfigParam( 'iNewestArticlesMode' ) && in_array( 'oxrss_newest', $aRssSelected ) ) {
00162 $this->addRssFeed( $oRss->getNewestArticlesTitle(), $oRss->getNewestArticlesUrl(), 'newestArticles' );
00163 }
00164 if ( in_array( 'oxrss_bargain', $aRssSelected ) ) {
00165 $this->addRssFeed( $oRss->getBargainTitle(), $oRss->getBargainUrl(), 'bargainArticles' );
00166 }
00167 }
00168
00169 parent::render();
00170
00171 return $this->_sThisTemplate;
00172 }
00173
00185 public function setMetaDescription ( $sInput, $iLength = 1024, $blDescTag = false )
00186 {
00187 $oContent = oxNew( 'oxcontent' );
00188 if ( $oContent->loadByIdent( $this->_sMetaDescriptionIdent ) && $oContent->oxcontents__oxactive->value ) {
00189 $sInput = $oContent->oxcontents__oxcontent->value;
00190 }
00191
00192 return parent::setMetaDescription ( $sInput, $iLength, $blDescTag );
00193 }
00194
00204 public function setMetaKeywords( $sInput )
00205 {
00206 $oContent = oxNew( 'oxcontent' );
00207 if ( $oContent->loadByIdent( $this->_sMetaKeywordsIdent ) && $oContent->oxcontents__oxactive->value ) {
00208 $sInput = $oContent->oxcontents__oxcontent->value;
00209 }
00210
00211 return parent::setMetaKeywords( $sInput );
00212 }
00213
00219 public function _getLoadActionsParam()
00220 {
00221 if ( $this->_blLoadActions === null ) {
00222 $this->_blLoadActions = false;
00223 if ( $this->getConfig()->getConfigParam( 'bl_perfLoadAktion' ) ) {
00224 $this->_blLoadActions = true;
00225 }
00226 }
00227 return $this->_blLoadActions;
00228 }
00229
00235 public function getArticleList()
00236 {
00237 if ( $this->_aArticleList === null ) {
00238 $this->_aArticleList = array();
00239 if ( $this->_getLoadActionsParam() ) {
00240
00241 $oArtList = oxNew( 'oxarticlelist' );
00242 $oArtList->loadAktionArticles( 'OXSTART' );
00243 if ( $oArtList->count() ) {
00244 $this->_aArticleList = $oArtList;
00245 }
00246 }
00247 }
00248 return $this->_aArticleList;
00249 }
00250
00256 public function getTopArticleList()
00257 {
00258 if ( $this->_aTopArticleList === null ) {
00259 $this->_aTopArticleList = false;
00260 if ( $this->_getLoadActionsParam() ) {
00261
00262 $oArtList = oxNew( 'oxarticlelist' );
00263 $oArtList->loadAktionArticles( 'OXTOPSTART' );
00264 if ( $oArtList->count() ) {
00265 $this->_aTopArticleList = $oArtList;
00266 }
00267 }
00268 }
00269 return $this->_aTopArticleList;
00270 }
00271
00277 public function getNewestArticles()
00278 {
00279 if ( $this->_aNewArticleList === null ) {
00280 $this->_aNewArticleList = array();
00281 if ( $this->_getLoadActionsParam() ) {
00282
00283 $oArtList = oxNew( 'oxarticlelist' );
00284 $oArtList->loadNewestArticles();
00285 if ( $oArtList->count() ) {
00286 $this->_aNewArticleList = $oArtList;
00287 }
00288 }
00289 }
00290 return $this->_aNewArticleList;
00291 }
00292
00298 public function getFirstArticle()
00299 {
00300 if ( $this->_oFirstArticle === null ) {
00301 $this->_oFirstArticle = false;
00302 if ( $this->_getLoadActionsParam() ) {
00303
00304 $oArtList = oxNew( 'oxarticlelist' );
00305 $oArtList->loadAktionArticles( 'OXFIRSTSTART' );
00306 if ( $oArtList->count() ) {
00307 $this->_oFirstArticle = $oArtList->current();
00308 }
00309 }
00310 }
00311 return $this->_oFirstArticle;
00312 }
00313
00319 public function getCatOfferArticle()
00320 {
00321 if ( $this->_oCatOfferArticle === null ) {
00322 $this->_oCatOfferArticle = false;
00323 if ( $oArtList = $this->getCatOfferArticleList() ) {
00324 $this->_oCatOfferArticle = $oArtList->current();
00325 }
00326 }
00327 return $this->_oCatOfferArticle;
00328 }
00329
00335 public function getCatOfferArticleList()
00336 {
00337 if ( $this->_oCatOfferArtList === null ) {
00338 $this->_oCatOfferArtList = array();
00339 if ( $this->_getLoadActionsParam() ) {
00340
00341 $oArtList = oxNew( 'oxarticlelist' );
00342 $oArtList->loadAktionArticles( 'OXCATOFFER' );
00343 if ( $oArtList->count() ) {
00344 $this->_oCatOfferArtList = $oArtList;
00345 }
00346 }
00347 }
00348 return $this->_oCatOfferArtList;
00349 }
00350
00356 public function getTagCloud()
00357 {
00358 if ( $this->_sTagCloud === null ) {
00359 $this->_sTagCloud = false;
00360 $oTagHandler = oxNew('oxTagCloud');
00361 $this->_sTagCloud = $oTagHandler->getTagCloud();
00362 }
00363 return $this->_sTagCloud;
00364 }
00365
00371 public function isMoreTagsVisible()
00372 {
00373 return true;
00374 }
00375
00381 public function getTitleSuffix()
00382 {
00383 return $this->getConfig()->getActiveShop()->oxshops__oxstarttitle->value;
00384 }
00385
00386 }