Go to the documentation of this file.00001 <?php
00002
00003
00006 class oxCountry extends oxI18n
00007 {
00013 protected $_sClassName = 'oxcountry';
00014
00020 protected $_aStates = null;
00021
00025 public function __construct()
00026 {
00027 parent::__construct();
00028 $this->init( 'oxcountry' );
00029 }
00030
00036 public function isForeignCountry()
00037 {
00038 return !in_array($this->getId(), $this->getConfig()->getConfigParam( 'aHomeCountry' ));
00039 }
00040
00046 public function isInEU()
00047 {
00048 return (bool) ($this->oxcountry__oxvatstatus->value == 1);
00049 }
00050
00056 public function getStates()
00057 {
00058 if (!is_null($this->_aStates))
00059 return $this->_aStates;
00060
00061 $sCountryId = $this->getId();
00062 $sViewName = getViewName( "oxstates", $this->getLanguage() );
00063 $sQ = "select * from {$sViewName} where oxcountryid = '$sCountryId' ";
00064 $this->_aStates = oxNew("oxlist");
00065 $this->_aStates->init("oxstate");
00066 $this->_aStates->selectString($sQ);
00067
00068 return $this->_aStates;
00069 }
00070
00078 public function getIdByCode( $sCode )
00079 {
00080 $oDb = oxDb::getDb();
00081 return $oDb->getOne( "select oxid from oxcountry where oxisoalpha2 = " . $oDb->quote( $sCode ) );
00082 }
00083 }