tag.php

Go to the documentation of this file.
00001 <?php
00002 
00006 class Tag extends aList
00007 {
00012     protected $_sListType = 'tag';
00013 
00018     protected $_blShowSorting = true;
00019 
00025     protected $_sTag;
00026 
00032     protected $_sTagTitle;
00033 
00038     protected $_oPageNavigation = null;
00039 
00045     protected $_sTemplateLocation;
00046 
00047     public function init()
00048     {
00049         $this->_sTag = oxConfig::getParameter("searchtag", 1);
00050         return parent::init();
00051     }
00052 
00062     public function render()
00063     {
00064         oxUBase::render();
00065 
00066         $myConfig = $this->getConfig();
00067 
00068         // load vendor
00069         $this->_aViewData['articlelist']       = $this->getArticleList();
00070         $this->_aViewData['title']             = $this->getTitle();
00071         $this->_aViewData['template_location'] = $this->getTemplateLocation();
00072         $this->_aViewData['searchtag']         = $this->getTag();
00073 
00074         $this->_aViewData['pageNavigation']    = $this->getPageNavigation();
00075         $this->_aViewData['actCategory']    = $this->getActiveCategory();
00076 
00077         // processing list articles
00078         $this->_processListArticles();
00079 
00080         // generating meta info
00081         $this->setMetaDescription( null );
00082         $this->setMetaKeywords( null );
00083 
00084         return $this->_sThisTemplate;
00085     }
00086 
00092     public function getAddUrlParams()
00093     {
00094         $sAddParams  = parent::getAddUrlParams();
00095         $sAddParams .= ($sAddParams?'&amp;':'') . "listtype={$this->_sListType}";
00096 
00097         if ( $sParam = rawurlencode( oxConfig::getParameter( 'searchtag', 1 ) ) ) {
00098             $sAddParams .= "&amp;searchtag={$sParam}";
00099         }
00100 
00101         return $sAddParams;
00102     }
00103 
00111     protected function _loadArticles( $oVendor )
00112     {
00113         // load only articles which we show on screen
00114         $iNrofCatArticles = (int) $this->getConfig()->getConfigParam( 'iNrofCatArticles' );
00115         $iNrofCatArticles = $iNrofCatArticles?$iNrofCatArticles:1;
00116 
00117         $oArtList = oxNew( 'oxarticlelist' );
00118         $oArtList->setSqlLimit( $iNrofCatArticles * $this->getActPage(), $iNrofCatArticles );
00119         $oArtList->setCustomSorting( $this->getSortingSql( 'oxtags' ) );
00120 
00121         // load the articles
00122         $this->_iAllArtCnt = $oArtList->loadTagArticles( $this->_sTag, oxLang::getInstance()->getBaseLanguage());
00123         $this->_iCntPages  = round( $this->_iAllArtCnt / $iNrofCatArticles + 0.49 );
00124 
00125         return $oArtList;
00126     }
00127 
00133     protected function _getCatPathString()
00134     {
00135         return $this->_sTag;
00136     }
00137 
00143     protected function _getSeoObjectId()
00144     {
00145         return md5("tag" . $this->_sTag);
00146     }
00147 
00155     public function getSorting( $sCnid )
00156     {
00157         return parent::getSorting( "oxtags" );
00158     }
00159 
00169     public function setItemSorting( $sCnid, $sSortBy, $sSortOrder  = null )
00170     {
00171         parent::setItemSorting( "oxtags", $sSortBy, $sSortOrder );
00172     }
00173 
00179     public function generatePageNavigation( )
00180     {
00181         return oxUBase::generatePageNavigation( );
00182     }
00183 
00191     public function generatePageNavigationUrl( )
00192     {
00193         return oxUBase::generatePageNavigationUrl( );
00194     }
00195 
00205     protected function _addPageNrParam( $sUrl, $iPage, $iLang = null)
00206     {
00207         return oxUBase::_addPageNrParam( $sUrl, $iPage, $iLang );
00208     }
00209 
00215     public function getArticleList()
00216     {
00217         if ( $this->_aArticleList === null ) {
00218             if ( ( $this->getTag() ) ) {
00219                 $this->_aArticleList = $this->_loadArticles( null );
00220             }
00221         }
00222         return $this->_aArticleList;
00223     }
00224 
00230     public function getTag()
00231     {
00232         return $this->_sTag;
00233     }
00234 
00240     public function getTitle()
00241     {
00242         if ( $this->_sTagTitle === null ) {
00243             $this->_sTagTitle = false;
00244             if ( ( $sTag = $this->getTag() ) ) {
00245                 $sTitle = ucfirst( $sTag );
00246                 $this->_sTagTitle = htmlspecialchars($sTitle);
00247             }
00248         }
00249         return $this->_sTagTitle;
00250     }
00251 
00257     public function getTemplateLocation()
00258     {
00259         if ( $this->_sTemplateLocation === null ) {
00260             $this->_sTemplateLocation = false;
00261             if ( ( $sTag = $this->getTag() ) ) {
00262                 $sTitle = ucfirst( $sTag );
00263                 $this->_sTemplateLocation = oxLang::getInstance()->translateString('TAGS')." / ".htmlspecialchars($sTitle);
00264             }
00265         }
00266         return $this->_sTemplateLocation;
00267     }
00268 
00274     public function getPageNavigation()
00275     {
00276         if ( $this->_oPageNavigation === null ) {
00277             $this->_oPageNavigation = false;
00278             $this->_oPageNavigation = $this->generatePageNavigation();
00279         }
00280         return $this->_oPageNavigation;
00281     }
00282 
00288     public function getActiveCategory()
00289     {
00290         return $this->getActTag();
00291     }
00292 
00300     protected function _prepareMetaKeyword( $aCatPath )
00301     {
00302         return parent::_collectMetaKeyword( $aCatPath );
00303     }
00304 
00317     protected function _prepareMetaDescription( $aCatPath, $iLength = 1024, $blDescTag = false )
00318     {
00319         return parent::_collectMetaDescription( $aCatPath, $iLength, $blDescTag );
00320     }
00321 }

Generated on Fri Dec 19 14:20:30 2008 for OXID eShop CE by  doxygen 1.5.5