![]() |
- Developper API
2.0.5
|
00001 <?php 00010 require_once("DataObjectFactory.php"); 00011 require_once("AbstractDataObject.php"); 00012 require_once("Property.php"); 00013 require_once("Utils.php"); 00014 00015 class Winery extends AbstractDataObject 00016 { 00017 private $objects; 00018 00019 private static $properties = array( 00020 "id", 00021 "name", 00022 "website", 00023 "shop", 00024 "facebook", 00025 "twitter", 00026 "blog", 00027 "address", 00028 "postcode", 00029 "city", 00030 "country", 00031 "phone", 00032 "fax", 00033 "logo", 00034 "email", 00035 "content", 00036 "vincod" 00037 ); 00038 00047 public function __construct($id,$type,$xmlObject,$language) 00048 { 00049 parent::__construct($id,$type,$xmlObject,$language); 00050 $this->objects = array(); 00051 } 00052 00053 //Abstract Methods 00054 protected function isCustomProperties($propertyName) 00055 { 00056 return !(in_array($propertyName,Winery::$properties)); 00057 } 00058 00059 //Private Methods 00060 private function getTheValue ($value) 00061 { 00062 if ($val = $this->getTheValues ($value)) 00063 return $val[0]; 00064 return false; 00065 } 00066 00067 private function getTheValues ($value) 00068 { 00069 if(!array_key_exists($value,$this->objects)) 00070 { 00071 $this->objects[$value] = parent::getProperty($value); 00072 } 00073 00074 if(count($this->objects[$value]) > 0) 00075 { 00076 return $this->objects[$value]; 00077 } 00078 else 00079 return array(); 00080 } 00081 00082 //Class Methods 00087 public final function getName(){return $this->getTheValue ("name");} 00088 00093 public final function getWebSite(){return $this->getTheValue ("website");} 00094 00099 public final function getShop(){return $this->getTheValue ("shop");} 00100 00105 public final function getFacebook(){return $this->getTheValue ("facebook");} 00106 00111 public final function getTwitter(){return $this->getTheValue ("twitter");} 00112 00117 public final function getBlog(){return $this->getTheValue ("blog");} 00118 00123 public final function getAddress(){return $this->getTheValue ("address");} 00124 00129 public final function getPostcode(){return $this->getTheValue ("postcode");} 00130 00135 public final function getCity(){return $this->getTheValue ("city");} 00136 00141 public final function getCountry(){return $this->getTheValue ("country");} 00142 00147 public final function getPhone(){return $this->getTheValue ("phone");} 00148 00153 public final function getFax(){return $this->getTheValue ("fax");} 00154 00159 public final function getLogo(){return $this->getTheValue ("logo");} 00160 00165 public final function getEmail(){return $this->getTheValue ("email");} 00166 00171 public final function getContent(){return $this->getTheValue ("content");} 00172 00177 public final function getVincods(){return $this->getTheValues ("vincod");} 00178 00183 public final function getWines() 00184 { 00185 $id = $this->getId(); 00186 if($id) 00187 return DataObjectFactory::getWinesByWineryId($id,$this->getLanguage); 00188 00189 return array(); 00190 } 00191 00196 public final function getRanges() 00197 { 00198 $id = $this->getId(); 00199 if($id) 00200 return DataObjectFactory::getRangesByWineryId($id,$this->getLanguage); 00201 00202 return array(); 00203 } 00204 00209 public final function getOwner() 00210 { 00211 $id = $this->getId(); 00212 if($id) 00213 return DataObjectFactory::getOwnerByWineryId($id,$this->getLanguage); 00214 00215 return false; 00216 } 00217 00222 public final function getPresentation(){return $this->getTheValue ("presentation");} 00223 00224 }