Go to the documentation of this file.00001 <?php
00002
00006 class Rss extends oxUBase
00007 {
00012 protected $_oRss = null;
00013
00018 protected $_oChannel = null;
00019
00024 protected $_aXmlDef = null;
00025
00030 protected $_sThisTemplate = 'rss.tpl';
00031
00038 public function init()
00039 {
00040 if (null !== ($iCur = oxConfig::getParameter('cur'))) {
00041 oxSession::setVar('currency', (int) $iCur);
00042 }
00043 parent::init();
00044 }
00045
00051 protected function _getRssFeed()
00052 {
00053 if (!$this->_oRss) {
00054 $this->_oRss = oxNew('oxRssFeed');
00055 }
00056 return $this->_oRss;
00057 }
00058
00067 public function render()
00068 {
00069 parent::render();
00070
00071 $oSmarty = oxUtilsView::getInstance()->getSmarty();
00072
00073 foreach ( array_keys( $this->_aViewData ) as $sViewName ) {
00074 $oSmarty->assign_by_ref( $sViewName, $this->_aViewData[$sViewName] );
00075 }
00076
00077 $oSmarty->assign('channel', $this->getChannel());
00078 $oSmarty->assign('xmldef', $this->getXmlDef());
00079
00080
00081 oxUtils::getInstance()->setHeader( "Content-Type: text/xml; charset=".oxLang::getInstance()->translateString( "charset" ) );
00082 oxUtils::getInstance()->showMessageAndExit(
00083 $this->_processOutput(
00084 $oSmarty->fetch('rss.tpl', $this->getViewId())
00085 )
00086 );
00087 }
00088
00096 protected function _processOutput( $sInput )
00097 {
00098 return getStr()->recodeEntities( $sInput );
00099 }
00100
00107 public function topshop()
00108 {
00109 if ($this->getConfig()->getConfigParam( 'bl_rssTopShop' )) {
00110 $this->_getRssFeed()->loadTopInShop();
00111 } else {
00112 error_404_handler();
00113 }
00114 }
00115
00122 public function newarts()
00123 {
00124 if ($this->getConfig()->getConfigParam( 'bl_rssNewest' )) {
00125 $this->_getRssFeed()->loadNewestArticles();
00126 } else {
00127 error_404_handler();
00128 }
00129 }
00130
00137 public function catarts()
00138 {
00139 if ($this->getConfig()->getConfigParam( 'bl_rssCategories' )) {
00140 $oCat = oxNew('oxCategory');
00141 if ($oCat->load(oxConfig::getParameter('cat'))) {
00142 $this->_getRssFeed()->loadCategoryArticles($oCat);
00143 }
00144 } else {
00145 error_404_handler();
00146 }
00147 }
00148
00155 public function searcharts()
00156 {
00157 if ($this->getConfig()->getConfigParam( 'bl_rssSearch' )) {
00158 $this->_getRssFeed()->loadSearchArticles( oxConfig::getParameter('searchparam', true), oxConfig::getParameter('searchcnid'), oxConfig::getParameter('searchvendor'), oxConfig::getParameter('searchmanufacturer'));
00159 } else {
00160 error_404_handler();
00161 }
00162 }
00163
00170 public function recommlists()
00171 {
00172 if ($this->getViewConfig()->getShowListmania() && $this->getConfig()->getConfigParam( 'bl_rssRecommLists' )) {
00173 $oArticle = oxNew('oxarticle');
00174 if ($oArticle->load(oxConfig::getParameter('anid'))) {
00175 $this->_getRssFeed()->loadRecommLists($oArticle);
00176 return;
00177 }
00178 }
00179 error_404_handler();
00180 }
00181
00188 public function recommlistarts()
00189 {
00190 if ($this->getConfig()->getConfigParam( 'bl_rssRecommListArts' )) {
00191 $oRecommList = oxNew('oxrecommlist');
00192 if ($oRecommList->load(oxConfig::getParameter('recommid'))) {
00193 $this->_getRssFeed()->loadRecommListArticles($oRecommList);
00194 return;
00195 }
00196 }
00197 error_404_handler();
00198 }
00199
00206 public function bargain()
00207 {
00208 if ($this->getConfig()->getConfigParam( 'bl_rssBargain' )) {
00209 $this->_getRssFeed()->loadBargain();
00210 } else {
00211 error_404_handler();
00212 }
00213 }
00214
00220 public function getChannel()
00221 {
00222 if ( $this->_oChannel === null ) {
00223 $this->_oChannel = $this->_getRssFeed()->getChannel();
00224 }
00225 return $this->_oChannel;
00226 }
00227
00233 public function getXmlDef()
00234 {
00235 if ( $this->_aXmlDef === null ) {
00236 $this->_aXmlDef = false;
00237 $this->_aXmlDef = array('start'=>'<?xml', 'end'=>'?>');
00238 }
00239 return $this->_aXmlDef;
00240 }
00241
00242 }