rss.php

Go to the documentation of this file.
00001 <?php
00002 
00006 class Rss extends oxView
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         $this->_oRss = oxNew('oxRssFeed');
00045     }
00046 
00055     public function render()
00056     {
00057         parent::render();
00058 
00059         $oSmarty = oxUtilsView::getInstance()->getSmarty();
00060 
00061         foreach ( array_keys( $this->_aViewData ) as $sViewName ) {
00062             $oSmarty->assign_by_ref( $sViewName, $this->_aViewData[$sViewName] );
00063         }
00064 
00065         $oSmarty->assign('channel', $this->getChannel());
00066         $oSmarty->assign('xmldef', $this->getXmlDef());
00067 
00068         header ("content-type: text/xml");
00069 
00070 
00071         echo $oSmarty->fetch('rss.tpl', $this->getViewId()) ;
00072 
00073         // returned rss xml: no further processing
00074         exit (0);
00075     }
00076 
00083     public function topshop()
00084     {
00085         if (in_array('oxrss_topshop', oxConfig::getInstance()->getConfigParam( 'aRssSelected' ))) {
00086             $this->_oRss->loadTopInShop();
00087         } else {
00088             error_404_handler();
00089         }
00090     }
00091 
00098     public function newarts()
00099     {
00100         if (in_array('oxrss_newest', oxConfig::getInstance()->getConfigParam( 'aRssSelected' ))) {
00101             $this->_oRss->loadNewestArticles();
00102         } else {
00103             error_404_handler();
00104         }
00105     }
00106 
00113     public function catarts()
00114     {
00115         if (in_array('oxrss_categories', oxConfig::getInstance()->getConfigParam( 'aRssSelected' ))) {
00116             $oCat = oxNew('oxCategory');
00117             if ($oCat->load(oxConfig::getParameter('cat'))) {
00118                 $this->_oRss->loadCategoryArticles($oCat);
00119             }
00120         } else {
00121             error_404_handler();
00122         }
00123     }
00124 
00131     public function searcharts()
00132     {
00133         if (in_array('oxrss_search', oxConfig::getInstance()->getConfigParam( 'aRssSelected' ))) {
00134             $this->_oRss->loadSearchArticles(oxConfig::getParameter('searchparam', true), oxConfig::getParameter('searchcnid'), oxConfig::getParameter('searchvendor'));
00135         } else {
00136             error_404_handler();
00137         }
00138     }
00139 
00146     public function recommlists()
00147     {
00148         if (in_array('oxrss_recommlists', oxConfig::getInstance()->getConfigParam( 'aRssSelected' ))) {
00149             $oArticle = oxNew('oxarticle');
00150             if ($oArticle->load(oxConfig::getParameter('anid'))) {
00151                 $this->_oRss->loadRecommLists($oArticle);
00152                 return;
00153             }
00154         }
00155         error_404_handler();
00156     }
00157 
00164     public function recommlistarts()
00165     {
00166         if (in_array('oxrss_recommlistarts', oxConfig::getInstance()->getConfigParam( 'aRssSelected' ))) {
00167             $oRecommList = oxNew('oxrecommlist');
00168             if ($oRecommList->load(oxConfig::getParameter('recommid'))) {
00169                 $this->_oRss->loadRecommListArticles($oRecommList);
00170                 return;
00171             }
00172         }
00173         error_404_handler();
00174     }
00175 
00182     public function bargain()
00183     {
00184         if (in_array('oxrss_bargain', oxConfig::getInstance()->getConfigParam( 'aRssSelected' ))) {
00185             $this->_oRss->loadBargain();
00186         } else {
00187             error_404_handler();
00188         }
00189     }
00190 
00196     public function getChannel()
00197     {
00198         if ( $this->_oChannel === null ) {
00199             $this->_oChannel = false;
00200             if ( $this->_oRss ) {
00201                 $this->_oChannel = $this->_oRss->getChannel();
00202             }
00203         }
00204         return $this->_oChannel;
00205     }
00206 
00212     public function getXmlDef()
00213     {
00214         if ( $this->_aXmlDef === null ) {
00215             $this->_aXmlDef = false;
00216             $this->_aXmlDef = array('start'=>'<?xml', 'end'=>'?>');
00217         }
00218         return $this->_aXmlDef;
00219     }
00220 
00221 }

Generated on Thu Dec 4 12:04:57 2008 for OXID eShop CE by  doxygen 1.5.5