Go to the documentation of this file.00001 <?php
00002
00005 class oxManufacturer extends oxI18n implements oxIUrl
00006 {
00007
00008 protected static $_aRootManufacturer = array();
00009
00013 protected $_sClassName = 'oxmanufacturer';
00014
00020 protected $_blShowArticleCnt = false;
00021
00027 protected $_iNrOfArticles = -1;
00028
00034 protected $_blIsSeoObject = true;
00035
00041 protected $_blIsVisible;
00042
00048 protected $_blHasVisibleSubCats;
00049
00055 protected $_aSeoUrls = array();
00056
00060 public function __construct()
00061 {
00062 $this->setShowArticleCnt( $this->getConfig()->getConfigParam( 'bl_perfShowActionCatArticleCnt' ) );
00063 parent::__construct();
00064 $this->init( 'oxmanufacturers');
00065 }
00066
00074 public function __get( $sName )
00075 {
00076 switch ( $sName ) {
00077 case 'oxurl':
00078 case 'openlink':
00079 case 'closelink':
00080 case 'link':
00081 $sValue = $this->getLink();
00082 break;
00083 case 'iArtCnt':
00084 $sValue = $this->getNrOfArticles();
00085 break;
00086 case 'isVisible':
00087 $sValue = $this->getIsVisible();
00088 break;
00089 case 'hasVisibleSubCats':
00090 $sValue = $this->getHasVisibleSubCats();
00091 break;
00092 default:
00093 $sValue = parent::__get( $sName );
00094 break;
00095 }
00096 return $sValue;
00097 }
00098
00106 public function setShowArticleCnt( $blShowArticleCount = false )
00107 {
00108 $this->_blShowArticleCnt = $blShowArticleCount;
00109 }
00110
00118 public function assign( $dbRecord )
00119 {
00120 parent::assign( $dbRecord );
00121
00122
00123 if ( $this->_blShowArticleCnt && !$this->isAdmin() ) {
00124 $this->_iNrOfArticles = oxUtilsCount::getInstance()->getManufacturerArticleCount( $this->getId() );
00125 }
00126
00127 $this->oxmanufacturers__oxnrofarticles = new oxField($this->_iNrOfArticles, oxField::T_RAW);
00128 }
00129
00138 public function load( $sOxid )
00139 {
00140 if ( $sOxid == 'root' ) {
00141 return $this->_setRootObjectData();
00142 }
00143 return parent::load( $sOxid );
00144 }
00145
00151 protected function _setRootObjectData()
00152 {
00153 $this->setId( 'root' );
00154 $this->oxmanufacturers__oxicon = new oxField( '', oxField::T_RAW );
00155 $this->oxmanufacturers__oxtitle = new oxField( oxLang::getInstance()->translateString( 'byManufacturer', $this->getLanguage(), false ), oxField::T_RAW );
00156 $this->oxmanufacturers__oxshortdesc = new oxField( '', oxField::T_RAW );
00157
00158 return true;
00159 }
00160
00169 public function getBaseSeoLink( $iLang, $iPage = 0 )
00170 {
00171 $oEncoder = oxSeoEncoderManufacturer::getInstance();
00172 if ( !$iPage ) {
00173 return $oEncoder->getManufacturerUrl( $this, $iLang );
00174 }
00175 return $oEncoder->getManufacturerPageUrl( $this, $iPage, $iLang );
00176 }
00177
00185 public function getLink( $iLang = null )
00186 {
00187 if ( !oxUtils::getInstance()->seoIsActive() ) {
00188 return $this->getStdLink( $iLang );
00189 }
00190
00191 if ( $iLang === null ) {
00192 $iLang = $this->getLanguage();
00193 }
00194
00195 if ( !isset( $this->_aSeoUrls[$iLang] ) ) {
00196 $this->_aSeoUrls[$iLang] = $this->getBaseSeoLink( $iLang );
00197 }
00198
00199 return $this->_aSeoUrls[$iLang];
00200 }
00201
00211 public function getBaseStdLink( $iLang, $blAddId = true, $blFull = true )
00212 {
00213 $sUrl = '';
00214 if ( $blFull ) {
00215
00216 $sUrl = $this->getConfig()->getShopUrl( $iLang, false );
00217 }
00218
00219 return $sUrl . "index.php?cl=manufacturerlist" . ( $blAddId ? "&mnid=".$this->getId() : "" );
00220 }
00221
00230 public function getStdLink( $iLang = null, $aParams = array() )
00231 {
00232 if ( $iLang === null ) {
00233 $iLang = $this->getLanguage();
00234 }
00235
00236 return oxUtilsUrl::getInstance()->processUrl( $this->getBaseStdLink( $iLang ), true, $aParams, $iLang);
00237 }
00238
00244 public function getNrOfArticles()
00245 {
00246 if ( !$this->_blShowArticleCnt || $this->isAdmin() ) {
00247 return -1;
00248 }
00249
00250 return $this->_iNrOfArticles;
00251 }
00252
00258 public function getSubCats()
00259 {
00260 }
00261
00267 public function getIsVisible()
00268 {
00269 return $this->_blIsVisible;
00270 }
00271
00279 public function setIsVisible( $blVisible )
00280 {
00281 $this->_blIsVisible = $blVisible;
00282 }
00283
00289 public function getHasVisibleSubCats()
00290 {
00291 if ( !isset( $this->_blHasVisibleSubCats ) ) {
00292 $this->_blHasVisibleSubCats = false;
00293 }
00294
00295 return $this->_blHasVisibleSubCats;
00296 }
00297
00305 public function setHasVisibleSubCats( $blHasVisibleSubcats )
00306 {
00307 $this->_blHasVisibleSubCats = $blHasVisibleSubcats;
00308 }
00309
00315 public function getContentCats()
00316 {
00317 }
00318
00326 public function delete( $sOXID = null)
00327 {
00328 if ( parent::delete( $sOXID ) ) {
00329 oxSeoEncoderManufacturer::getInstance()->onDeleteManufacturer( $this );
00330 return true;
00331 }
00332 return false;
00333 }
00334
00340 public function getIconUrl()
00341 {
00342 if ( ( $sIcon = $this->oxmanufacturers__oxicon->value ) ) {
00343 $oConfig = $this->getConfig();
00344 $sSize = $oConfig->getConfigParam( 'sManufacturerIconsize' );
00345 if ( !$sSize ) {
00346 $sSize = $oConfig->getConfigParam( 'sIconsize' );
00347 }
00348
00349 return oxPictureHandler::getInstance()->getPicUrl( "manufacturer/icon/", $sIcon, $sSize );
00350 }
00351 }
00352
00358 public function getThumbUrl()
00359 {
00360 return false;
00361 }
00362
00368 public function getTitle()
00369 {
00370 return $this->oxmanufacturers__oxtitle->value;
00371 }
00372 }