- Developper API  2.0.5
developerApi_2.0.5/Owner.php
Go to the documentation of this file.
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 Owner extends AbstractDataObject
00016 {
00017         private $objects;
00018         
00019         private static $properties = array(
00020                 "id",
00021                 "email",
00022                 "company",
00023                 "address",
00024                 "postcode",
00025                 "city",
00026                 "phone",
00027                 "fax",
00028                 "website",
00029                 "facebook",
00030                 "twitter",
00031                 "logo",
00032                 "presentation"
00033         );
00034         
00043         public function __construct($id,$type,$xmlObject,$language)
00044         {
00045                 parent::__construct($id,$type,$xmlObject,$language);
00046                 $this->objects = array();
00047         }
00048 
00049         protected function isCustomProperties($label)
00050         {
00051                 return !(in_array($propertyName,Owner::$properties));
00052         }
00053         
00054         //Private Method
00055         private function getTheValue ($value)           
00056         {
00057                 if(!array_key_exists($value,$this->objects))
00058                 {
00059                         $this->objects[$value] = parent::getProperty($value);
00060                 }
00061 
00062                 if(count($this->objects[$value]) > 0)
00063                 {
00064                         $value = $this->objects[$value];
00065                         return $value[0];
00066                 }
00067                 else
00068                         return false;
00069         }
00070 
00071         //Class Methods
00076         public final function getEmail(){return $this-> getTheValue ("email");}
00077         
00082         public final function getCompany(){return $this-> getTheValue ("company");}
00083         
00088         public final function getAdress(){return $this-> getTheValue ("adress");}
00089         
00094         public final function getPostcode(){return $this-> getTheValue ("postcode");}
00095         
00100         public final function getCity(){return $this-> getTheValue ("city");}
00101         
00106         public final function getPhone(){return $this-> getTheValue ("phone");}
00107         
00112         public final function getFax(){return $this-> getTheValue ("fax");}
00113         
00118         public final function getWebsite(){return $this-> getTheValue ("website");}
00119         
00124         public final function getFacebook(){return $this-> getTheValue ("facebook");}
00125         
00130         public final function getTwitter(){return $this-> getTheValue ("twitter");}
00131         
00136         public final function getLogo(){return $this-> getTheValue ("logo");}
00137         
00142         public final function getPresentation(){return $this-> getTheValue ("presentation");}
00143         
00148         public final function getRanges()
00149         {
00150         $id = $this->getId();
00151         if($id)
00152           return DataObjectFactory::getRangesByOwnerId($id,$this->getLanguage);
00153 
00154         return array();  
00155         }
00156         
00161         public final function getWineries()
00162         {
00163         $id = $this->getId();
00164         if($id)
00165           return DataObjectFactory::getWineriesByOwnerId($id,$this->getLanguage);
00166 
00167         return array(); 
00168         }
00169         
00174         public final function getWines()
00175         {
00176         $id = $this->getId();
00177         if($id)
00178           return DataObjectFactory::getWinesByOwnerId($id,$this->getLanguage);
00179 
00180         return array();  
00181         }
00182 }