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
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
00078 $this->_processListArticles();
00079
00080 return $this->_sThisTemplate;
00081 }
00082
00088 public function getAddUrlParams()
00089 {
00090 $sAddParams = parent::getAddUrlParams();
00091 $sAddParams .= ($sAddParams?'&':'') . "listtype={$this->_sListType}";
00092
00093 if ( $sParam = rawurlencode( oxConfig::getParameter( 'searchtag', 1 ) ) ) {
00094 $sAddParams .= "&searchtag={$sParam}";
00095 }
00096
00097 return $sAddParams;
00098 }
00099
00107 protected function _loadArticles( $oVendor )
00108 {
00109
00110 $iNrofCatArticles = (int) $this->getConfig()->getConfigParam( 'iNrofCatArticles' );
00111 $iNrofCatArticles = $iNrofCatArticles?$iNrofCatArticles:1;
00112
00113 $oArtList = oxNew( 'oxarticlelist' );
00114 $oArtList->setSqlLimit( $iNrofCatArticles * $this->getActPage(), $iNrofCatArticles );
00115 $oArtList->setCustomSorting( $this->getSortingSql( 'oxtags' ) );
00116
00117
00118 $this->_iAllArtCnt = $oArtList->loadTagArticles( $this->_sTag, oxLang::getInstance()->getBaseLanguage());
00119 $this->_iCntPages = round( $this->_iAllArtCnt / $iNrofCatArticles + 0.49 );
00120
00121 return $oArtList;
00122 }
00123
00129 protected function _getCatPathString()
00130 {
00131 return $this->_sTag;
00132 }
00133
00139 protected function _getSeoObjectId()
00140 {
00141 return md5("tag" . $this->_sTag);
00142 }
00143
00151 public function getSorting( $sCnid )
00152 {
00153 return parent::getSorting( "oxtags" );
00154 }
00155
00165 public function setItemSorting( $sCnid, $sSortBy, $sSortOrder = null )
00166 {
00167 parent::setItemSorting( "oxtags", $sSortBy, $sSortOrder );
00168 }
00169
00175 public function generatePageNavigation( )
00176 {
00177 return oxUBase::generatePageNavigation( );
00178 }
00179
00187 public function generatePageNavigationUrl( )
00188 {
00189 return oxUBase::generatePageNavigationUrl( );
00190 }
00191
00201 protected function _addPageNrParam( $sUrl, $iPage, $iLang = null)
00202 {
00203 return oxUBase::_addPageNrParam( $sUrl, $iPage, $iLang );
00204 }
00205
00211 public function getArticleList()
00212 {
00213 if ( $this->_aArticleList === null ) {
00214 if ( ( $this->getTag() ) ) {
00215 $this->_aArticleList = $this->_loadArticles( null );
00216 }
00217 }
00218 return $this->_aArticleList;
00219 }
00220
00226 public function getTag()
00227 {
00228 return $this->_sTag;
00229 }
00230
00236 public function getTitle()
00237 {
00238 if ( $this->_sTagTitle === null ) {
00239 $this->_sTagTitle = false;
00240 if ( ( $sTag = $this->getTag() ) ) {
00241 $oStr = getStr();
00242 $sTitle = $oStr->ucfirst( $sTag );
00243 $this->_sTagTitle = $oStr->htmlspecialchars( $sTitle );
00244 }
00245 }
00246 return $this->_sTagTitle;
00247 }
00248
00254 public function getTemplateLocation()
00255 {
00256 if ( $this->_sTemplateLocation === null ) {
00257 $this->_sTemplateLocation = false;
00258 if ( ( $sTag = $this->getTag() ) ) {
00259 $oStr = getStr();
00260 $sTitle = $oStr->ucfirst( $sTag );
00261 $this->_sTemplateLocation = oxLang::getInstance()->translateString('TAGS')." / ".$oStr->htmlspecialchars( $sTitle );
00262 }
00263 }
00264 return $this->_sTemplateLocation;
00265 }
00266
00272 public function getPageNavigation()
00273 {
00274 if ( $this->_oPageNavigation === null ) {
00275 $this->_oPageNavigation = false;
00276 $this->_oPageNavigation = $this->generatePageNavigation();
00277 }
00278 return $this->_oPageNavigation;
00279 }
00280
00286 public function getActiveCategory()
00287 {
00288 return $this->getActTag();
00289 }
00290
00299 protected function _prepareMetaKeyword( $sKeywords )
00300 {
00301 return parent::_collectMetaKeyword( $sKeywords );
00302 }
00303
00314 protected function _prepareMetaDescription( $sMeta, $iLength = 1024, $blDescTag = false )
00315 {
00316 return parent::_collectMetaDescription( $sMeta, $iLength, $blDescTag );
00317 }
00318 }