Go to the documentation of this file.00001 <?php
00002
00007 class oxManufacturer extends oxI18n implements oxIUrl
00008 {
00009
00010 protected static $_aRootManufacturer = array();
00011
00015 protected $_sClassName = 'oxmanufacturer';
00016
00022 protected $_blShowArticleCnt = false;
00023
00029 protected $_iNrOfArticles = -1;
00030
00036 protected $_blIsSeoObject = true;
00037
00043 protected $_blIsVisible;
00044
00050 protected $_blHasVisibleSubCats;
00051
00057 protected $_aSeoUrls = array();
00058
00062 public function __construct()
00063 {
00064 $this->setShowArticleCnt($this->getConfig()->getConfigParam('bl_perfShowActionCatArticleCnt'));
00065 parent::__construct();
00066 $this->init('oxmanufacturers');
00067 }
00068
00076 public function __get($sName)
00077 {
00078 switch ($sName) {
00079 case 'oxurl':
00080 case 'openlink':
00081 case 'closelink':
00082 case 'link':
00083 $sValue = $this->getLink();
00084 break;
00085 case 'iArtCnt':
00086 $sValue = $this->getNrOfArticles();
00087 break;
00088 case 'isVisible':
00089 $sValue = $this->getIsVisible();
00090 break;
00091 case 'hasVisibleSubCats':
00092 $sValue = $this->getHasVisibleSubCats();
00093 break;
00094 default:
00095 $sValue = parent::__get($sName);
00096 break;
00097 }
00098 return $sValue;
00099 }
00100
00106 public function setShowArticleCnt($blShowArticleCount = false)
00107 {
00108 $this->_blShowArticleCnt = $blShowArticleCount;
00109 }
00110
00116 public function assign($dbRecord)
00117 {
00118 parent::assign($dbRecord);
00119
00120
00121 if ($this->_blShowArticleCnt && !$this->isAdmin()) {
00122 $this->_iNrOfArticles = oxRegistry::get("oxUtilsCount")->getManufacturerArticleCount($this->getId());
00123 }
00124
00125 $this->oxmanufacturers__oxnrofarticles = new oxField($this->_iNrOfArticles, oxField::T_RAW);
00126 }
00127
00136 public function load($sOxid)
00137 {
00138 if ($sOxid == 'root') {
00139 return $this->_setRootObjectData();
00140 }
00141
00142 return parent::load($sOxid);
00143 }
00144
00150 protected function _setRootObjectData()
00151 {
00152 $this->setId('root');
00153 $this->oxmanufacturers__oxicon = new oxField('', oxField::T_RAW);
00154 $this->oxmanufacturers__oxtitle = new oxField(oxRegistry::getLang()->translateString('BY_MANUFACTURER', $this->getLanguage(), false), oxField::T_RAW);
00155 $this->oxmanufacturers__oxshortdesc = new oxField('', oxField::T_RAW);
00156
00157 return true;
00158 }
00159
00168 public function getBaseSeoLink($iLang, $iPage = 0)
00169 {
00170 $oEncoder = oxRegistry::get("oxSeoEncoderManufacturer");
00171 if (!$iPage) {
00172 return $oEncoder->getManufacturerUrl($this, $iLang);
00173 }
00174
00175 return $oEncoder->getManufacturerPageUrl($this, $iPage, $iLang);
00176 }
00177
00185 public function getLink($iLang = null)
00186 {
00187 if (!oxRegistry::getUtils()->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 oxRegistry::get("oxUtilsUrl")->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
00256 public function getSubCats()
00257 {
00258 }
00259
00265 public function getIsVisible()
00266 {
00267 return $this->_blIsVisible;
00268 }
00269
00275 public function setIsVisible($blVisible)
00276 {
00277 $this->_blIsVisible = $blVisible;
00278 }
00279
00285 public function getHasVisibleSubCats()
00286 {
00287 if (!isset($this->_blHasVisibleSubCats)) {
00288 $this->_blHasVisibleSubCats = false;
00289 }
00290
00291 return $this->_blHasVisibleSubCats;
00292 }
00293
00299 public function setHasVisibleSubCats($blHasVisibleSubcats)
00300 {
00301 $this->_blHasVisibleSubCats = $blHasVisibleSubcats;
00302 }
00303
00307 public function getContentCats()
00308 {
00309 }
00310
00318 public function delete($sOXID = null)
00319 {
00320 if (parent::delete($sOXID)) {
00321 oxRegistry::get("oxSeoEncoderManufacturer")->onDeleteManufacturer($this);
00322
00323 return true;
00324 }
00325
00326 return false;
00327 }
00328
00334 public function getIconUrl()
00335 {
00336 if (($sIcon = $this->oxmanufacturers__oxicon->value)) {
00337 $oConfig = $this->getConfig();
00338 $sSize = $oConfig->getConfigParam('sManufacturerIconsize');
00339 if (!$sSize) {
00340 $sSize = $oConfig->getConfigParam('sIconsize');
00341 }
00342
00343 return oxRegistry::get("oxPictureHandler")->getPicUrl("manufacturer/icon/", $sIcon, $sSize);
00344 }
00345 }
00346
00352 public function getThumbUrl()
00353 {
00354 return false;
00355 }
00356
00362 public function getTitle()
00363 {
00364 return $this->oxmanufacturers__oxtitle->value;
00365 }
00366
00372 public function getShortDescription()
00373 {
00374 return $this->oxmanufacturers__oxshortdesc->value;
00375 }
00376
00377 }