oxcountry.php

Go to the documentation of this file.
00001 <?php
00002 
00003 
00008 class oxCountry extends oxI18n
00009 {
00010 
00016     protected $_sClassName = 'oxcountry';
00017 
00023     protected $_aStates = null;
00024 
00028     public function __construct()
00029     {
00030         parent::__construct();
00031         $this->init('oxcountry');
00032     }
00033 
00039     public function isForeignCountry()
00040     {
00041         return !in_array($this->getId(), $this->getConfig()->getConfigParam('aHomeCountry'));
00042     }
00043 
00049     public function isInEU()
00050     {
00051         return (bool) ($this->oxcountry__oxvatstatus->value == 1);
00052     }
00053 
00059     public function getStates()
00060     {
00061         if (!is_null($this->_aStates)) {
00062             return $this->_aStates;
00063         }
00064 
00065         $sCountryId = $this->getId();
00066         $sViewName = getViewName("oxstates", $this->getLanguage());
00067         $sQ = "select * from {$sViewName} where `oxcountryid` = '$sCountryId' order by `oxtitle`  ";
00068         $this->_aStates = oxNew("oxlist");
00069         $this->_aStates->init("oxstate");
00070         $this->_aStates->selectString($sQ);
00071 
00072         return $this->_aStates;
00073     }
00074 
00082     public function getIdByCode($sCode)
00083     {
00084         $oDb = oxDb::getDb();
00085 
00086         return $oDb->getOne("select oxid from oxcountry where oxisoalpha2 = " . $oDb->quote($sCode));
00087     }
00088 
00094     public function getVATIdentificationNumberPrefix()
00095     {
00096         return $this->oxcountry__oxvatinprefix->value;
00097     }
00098 
00099 }