Go to the documentation of this file.00001 <?php
00002
00005 class oxManufacturer extends oxI18n implements oxIUrl
00006 {
00007
00008 protected static $_aRootManufacturer = array();
00012 protected $_sCoreTbl = 'oxmanufacturers';
00013
00017 protected $_sClassName = 'oxmanufacturer';
00018
00024 protected $_blShowArticleCnt = false;
00025
00031 protected $_iNrOfArticles = -1;
00032
00038 protected $_blIsSeoObject = true;
00039
00045 protected $_blIsVisible;
00046
00052 protected $_blHasVisibleSubCats;
00053
00059 protected $_aSeoUrls = array();
00060
00064 public function __construct()
00065 {
00066 $this->setShowArticleCnt( $this->getConfig()->getConfigParam( 'bl_perfShowActionCatArticleCnt' ) );
00067 parent::__construct();
00068 $this->init( 'oxmanufacturers');
00069 }
00070
00078 public function __get( $sName )
00079 {
00080 switch ( $sName ) {
00081 case 'oxurl':
00082 case 'openlink':
00083 case 'closelink':
00084 case 'link':
00085 $sValue = $this->getLink();
00086 break;
00087 case 'iArtCnt':
00088 $sValue = $this->getNrOfArticles();
00089 break;
00090 case 'isVisible':
00091 $sValue = $this->getIsVisible();
00092 break;
00093 case 'hasVisibleSubCats':
00094 $sValue = $this->getHasVisibleSubCats();
00095 break;
00096 default:
00097 $sValue = parent::__get( $sName );
00098 break;
00099 }
00100 return $sValue;
00101 }
00102
00110 public function setShowArticleCnt( $blShowArticleCount = false )
00111 {
00112 $this->_blShowArticleCnt = $blShowArticleCount;
00113 }
00114
00122 public function assign( $dbRecord )
00123 {
00124 parent::assign( $dbRecord );
00125
00126
00127 if ( $this->_blShowArticleCnt && !$this->isAdmin() ) {
00128 $this->_iNrOfArticles = oxUtilsCount::getInstance()->getManufacturerArticleCount( $this->getId() );
00129 }
00130
00131 $this->oxmanufacturers__oxnrofarticles = new oxField($this->_iNrOfArticles, oxField::T_RAW);
00132 }
00133
00142 public function load( $sOxid )
00143 {
00144 if ( $sOxid == 'root' ) {
00145 return $this->_setRootObjectData();
00146 }
00147 return parent::load( $sOxid );
00148 }
00149
00155 protected function _setRootObjectData()
00156 {
00157 $this->setId( 'root' );
00158 $this->oxmanufacturers__oxicon = new oxField( '', oxField::T_RAW );
00159 $this->oxmanufacturers__oxtitle = new oxField( oxLang::getInstance()->translateString( 'byManufacturer', $this->getLanguage(), false ), oxField::T_RAW );
00160 $this->oxmanufacturers__oxshortdesc = new oxField( '', oxField::T_RAW );
00161
00162 return true;
00163 }
00164
00173 public function getBaseSeoLink( $iLang, $iPage = 0 )
00174 {
00175 $oEncoder = oxSeoEncoderManufacturer::getInstance();
00176 if ( !$iPage ) {
00177 return $oEncoder->getManufacturerUrl( $this, $iLang );
00178 }
00179 return $oEncoder->getManufacturerPageUrl( $this, $iPage, $iLang );
00180 }
00181
00189 public function getLink( $iLang = null )
00190 {
00191 if ( !oxUtils::getInstance()->seoIsActive() ) {
00192 return $this->getStdLink( $iLang );
00193 }
00194
00195 if ( $iLang === null ) {
00196 $iLang = $this->getLanguage();
00197 }
00198
00199 if ( !isset( $this->_aSeoUrls[$iLang] ) ) {
00200 $this->_aSeoUrls[$iLang] = $this->getBaseSeoLink( $iLang );
00201 }
00202
00203 return $this->_aSeoUrls[$iLang];
00204 }
00205
00215 public function getBaseStdLink( $iLang, $blAddId = true, $blFull = true )
00216 {
00217 $sUrl = '';
00218 if ( $blFull ) {
00219
00220 $sUrl = $this->getConfig()->getShopUrl( $iLang, false );
00221 }
00222
00223 return $sUrl . "index.php?cl=manufacturerlist" . ( $blAddId ? "&mnid=".$this->getId() : "" );
00224 }
00225
00234 public function getStdLink( $iLang = null, $aParams = array() )
00235 {
00236 if ( $iLang === null ) {
00237 $iLang = $this->getLanguage();
00238 }
00239
00240 return oxUtilsUrl::getInstance()->processUrl( $this->getBaseStdLink( $iLang ), true, $aParams, $iLang);
00241 }
00242
00248 public function getNrOfArticles()
00249 {
00250 if ( !$this->_blShowArticleCnt || $this->isAdmin() ) {
00251 return -1;
00252 }
00253
00254 return $this->_iNrOfArticles;
00255 }
00256
00262 public function getSubCats()
00263 {
00264 }
00265
00271 public function getIsVisible()
00272 {
00273 return $this->_blIsVisible;
00274 }
00275
00283 public function setIsVisible( $blVisible )
00284 {
00285 $this->_blIsVisible = $blVisible;
00286 }
00287
00293 public function getHasVisibleSubCats()
00294 {
00295 if ( !isset( $this->_blHasVisibleSubCats ) ) {
00296 $this->_blHasVisibleSubCats = false;
00297 }
00298
00299 return $this->_blHasVisibleSubCats;
00300 }
00301
00309 public function setHasVisibleSubCats( $blHasVisibleSubcats )
00310 {
00311 $this->_blHasVisibleSubCats = $blHasVisibleSubcats;
00312 }
00313
00319 public function getContentCats()
00320 {
00321 }
00322
00330 public function delete( $sOXID = null)
00331 {
00332 if ( parent::delete( $sOXID ) ) {
00333 oxSeoEncoderManufacturer::getInstance()->onDeleteManufacturer( $this );
00334 return true;
00335 }
00336 return false;
00337 }
00338
00344 public function getIconUrl()
00345 {
00346 if ( ( $sIcon = $this->oxmanufacturers__oxicon->value ) ) {
00347 $oConfig = $this->getConfig();
00348 $sSize = $oConfig->getConfigParam( 'sManufacturerIconsize' );
00349 if ( !$sSize ) {
00350 $sSize = $oConfig->getConfigParam( 'sIconsize' );
00351 }
00352
00353 return oxPictureHandler::getInstance()->getPicUrl( "manufacturer/icon/", $sIcon, $sSize );
00354 }
00355 }
00356
00362 public function getThumbUrl()
00363 {
00364 return false;
00365 }
00366
00372 public function getTitle()
00373 {
00374 return $this->oxmanufacturers__oxtitle->value;
00375 }
00376 }