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 
00052     public function init()
00053     {
00054         if ( oxUtils::getInstance()->seoIsActive() ) {
00055             // cleaning category id tracked by SEO
00056             $this->setSessionCategoryId( null );
00057         }
00058 
00059         $this->_sTag = oxConfig::getParameter("searchtag", 1);
00060         return parent::init();
00061     }
00062 
00072     public function render()
00073     {
00074         oxUBase::render();
00075 
00076         $myConfig = $this->getConfig();
00077 
00078         // load vendor
00079         $this->_aViewData['articlelist']       = $this->getArticleList();
00080         $this->_aViewData['title']             = $this->getTitle();
00081         $this->_aViewData['template_location'] = $this->getTemplateLocation();
00082         $this->_aViewData['searchtag']         = $this->getTag();
00083 
00084         $this->_aViewData['pageNavigation']    = $this->getPageNavigation();
00085         $this->_aViewData['actCategory']    = $this->getActiveCategory();
00086 
00087         // processing list articles
00088         $this->_processListArticles();
00089 
00090         return $this->_sThisTemplate;
00091     }
00092 
00098     public function getAddUrlParams()
00099     {
00100         $sAddParams  = parent::getAddUrlParams();
00101         $sAddParams .= ($sAddParams?'&amp;':'') . "listtype={$this->_sListType}";
00102 
00103         if ( $sParam = rawurlencode( oxConfig::getParameter( 'searchtag', 1 ) ) ) {
00104             $sAddParams .= "&amp;searchtag={$sParam}";
00105         }
00106 
00107         return $sAddParams;
00108     }
00109 
00117     protected function _loadArticles( $oVendor )
00118     {
00119         // load only articles which we show on screen
00120         $iNrofCatArticles = (int) $this->getConfig()->getConfigParam( 'iNrofCatArticles' );
00121         $iNrofCatArticles = $iNrofCatArticles?$iNrofCatArticles:1;
00122 
00123         $oArtList = oxNew( 'oxarticlelist' );
00124         $oArtList->setSqlLimit( $iNrofCatArticles * $this->getActPage(), $iNrofCatArticles );
00125         $oArtList->setCustomSorting( $this->getSortingSql( 'oxtags' ) );
00126 
00127         // load the articles
00128         $this->_iAllArtCnt = $oArtList->loadTagArticles( $this->_sTag, oxLang::getInstance()->getBaseLanguage());
00129         $this->_iCntPages  = round( $this->_iAllArtCnt / $iNrofCatArticles + 0.49 );
00130 
00131         return $oArtList;
00132     }
00133 
00139     protected function _getCatPathString()
00140     {
00141         return $this->_sTag;
00142     }
00143 
00149     protected function _getSeoObjectId()
00150     {
00151         return md5("tag" . $this->_sTag);
00152     }
00153 
00161     public function getSorting( $sCnid )
00162     {
00163         return parent::getSorting( "oxtags" );
00164     }
00165 
00175     public function setItemSorting( $sCnid, $sSortBy, $sSortOrder  = null )
00176     {
00177         parent::setItemSorting( "oxtags", $sSortBy, $sSortOrder );
00178     }
00179 
00185     public function generatePageNavigation( )
00186     {
00187         return oxUBase::generatePageNavigation( );
00188     }
00189 
00195     public function generatePageNavigationUrl( )
00196     {
00197         return oxUBase::generatePageNavigationUrl( );
00198     }
00199 
00209     protected function _addPageNrParam( $sUrl, $iPage, $iLang = null)
00210     {
00211         return oxUBase::_addPageNrParam( $sUrl, $iPage, $iLang );
00212     }
00213 
00219     public function getArticleList()
00220     {
00221         if ( $this->_aArticleList === null ) {
00222             if ( ( $this->getTag() ) ) {
00223                 $this->_aArticleList = $this->_loadArticles( null );
00224             }
00225         }
00226         return $this->_aArticleList;
00227     }
00228 
00234     public function getTag()
00235     {
00236         return $this->_sTag;
00237     }
00238 
00244     public function getTitle()
00245     {
00246         if ( $this->_sTagTitle === null ) {
00247             $this->_sTagTitle = false;
00248             if ( ( $sTag = $this->getTag() ) ) {
00249                 $oStr = getStr();
00250                 $sTitle = $oStr->ucfirst( $sTag );
00251                 $this->_sTagTitle = $oStr->htmlspecialchars( $sTitle );
00252             }
00253         }
00254         return $this->_sTagTitle;
00255     }
00256 
00262     public function getTemplateLocation()
00263     {
00264         if ( $this->_sTemplateLocation === null ) {
00265             $this->_sTemplateLocation = false;
00266             if ( ( $sTag = $this->getTag() ) ) {
00267                 $oStr = getStr();
00268                 $sTitle = $oStr->ucfirst( $sTag );
00269                 $this->_sTemplateLocation = oxLang::getInstance()->translateString('TAGS')." / ".$oStr->htmlspecialchars( $sTitle );
00270             }
00271         }
00272         return $this->_sTemplateLocation;
00273     }
00274 
00280     public function getPageNavigation()
00281     {
00282         if ( $this->_oPageNavigation === null ) {
00283             $this->_oPageNavigation = false;
00284             $this->_oPageNavigation = $this->generatePageNavigation();
00285         }
00286         return $this->_oPageNavigation;
00287     }
00288 
00294     public function getActiveCategory()
00295     {
00296         return $this->getActTag();
00297     }
00298 
00307     protected function _prepareMetaKeyword( $sKeywords )
00308     {
00309         return parent::_collectMetaKeyword( $sKeywords );
00310     }
00311 
00322     protected function _prepareMetaDescription( $sMeta, $iLength = 1024, $blDescTag = false )
00323     {
00324         return parent::_collectMetaDescription( $sMeta, $iLength, $blDescTag );
00325     }
00326 }

Generated on Wed Apr 22 12:26:32 2009 for OXID eShop CE by  doxygen 1.5.5