* @link http://www.oxidmodule.com */ class d3_cfg_geoipset_main extends d3_cfg_mod_main { protected $_sModId = 'd3_geoip'; protected $_sThisTemplate = "d3_cfg_geoipset_main.tpl"; protected $_blHasDebugSwitch = true; protected $_sDebugHelpTextIdent = 'D3_GEOIP_SET_DEBUG_DESC'; protected $_sMenuItemTitle = 'd3mxgeoip'; protected $_sMenuSubItemTitle = 'd3mxgeoip_settings'; public $oCountryList; /** * @param $sIP * @return string * @throws \D3\ModCfg\Application\Model\Exception\d3ShopCompatibilityAdapterException * @throws \D3\ModCfg\Application\Model\Exception\d3_cfg_mod_exception * @throws \Doctrine\DBAL\DBALException * @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException * @throws \OxidEsales\Eshop\Core\Exception\DatabaseErrorException * @throws \OxidEsales\Eshop\Core\Exception\StandardException */ public function getIpCountry($sIP) { startProfile(__METHOD__); /** @var $oD3GeoIP d3geoip */ $oD3GeoIP = oxNew(d3geoip::class); $oCountry = $oD3GeoIP->getUserLocationCountryObject($sIP); if ($oCountry->getId()) { $sTitle = $oCountry->getFieldData('oxtitle'); } else { $sTitle = Registry::getLang()->translateString('D3_GEOIP_SET_IP_CHECKIP_NOTSET'); } stopProfile(__METHOD__); return $sTitle; } /** * @return CountryList */ public function getIPCountryList() { if ($this->oCountryList) { return $this->oCountryList; } startProfile(__METHOD__); /** @var $oGeoIp d3geoip */ $oGeoIp = oxNew(d3geoip::class); /** @var $oCountryList CountryList */ $this->oCountryList = oxNew(CountryList::class); $oListObject = $this->oCountryList->getBaseObject(); $sFieldList = $oListObject->getSelectFields(); $sQ = "select (SELECT d3startip FROM ".$oGeoIp->getViewName(). " WHERE D3ISO = " .$oListObject->getViewName(). ". oxisoalpha2 LIMIT 1) as IP, $sFieldList from " . $oListObject->getViewName(); $sQ.= " ORDER BY oxactive DESC, oxtitle"; $this->oCountryList->selectString($sQ); stopProfile(__METHOD__); return $this->oCountryList; } }