2012-01-31 23:21:28 +01:00
< ? php
2013-04-22 11:40:11 +02:00
/**
* This Software is the property of Data Development and is protected
* by copyright law - it is NOT Freeware .
*
* Any unauthorized use of this software without a valid license
* is a violation of the license agreement and will be prosecuted by
* civil and criminal law .
*
* http :// www . shopmodule . com
*
* @ copyright ( C ) D3 Data Development ( Inh . Thomas Dartsch )
* @ author D3 Data Development - Daniel Seifert < ds @ shopmodule . com >
* @ link http :// www . oxidmodule . com
*/
2012-01-31 23:21:28 +01:00
class d3_cfg_geoipset_main extends d3_cfg_mod_main
{
protected $_sModId = 'd3_geoip' ;
protected $_sThisTemplate = " d3_cfg_geoipset_main.tpl " ;
2013-04-22 11:40:11 +02:00
protected $_blHasDebugSwitch = TRUE ;
protected $_sDebugHelpTextIdent = 'D3_GEOIP_SET_DEBUG_DESC' ;
2013-04-22 11:25:27 +02:00
2013-04-22 11:40:11 +02:00
/**
* @ param $sIP
* @ return string
*/
2012-01-31 23:21:28 +01:00
public function getIpCountry ( $sIP )
{
2013-04-22 11:40:11 +02:00
startProfile ( __METHOD__ );
/** @var $oD3GeoIP d3geoip */
2012-01-31 23:21:28 +01:00
$oD3GeoIP = oxNew ( 'd3geoip' );
$oCountry = $oD3GeoIP -> getUserLocationCountryObject ( $sIP );
if ( $oCountry -> getId ())
2013-04-22 11:40:11 +02:00
{
2012-01-31 23:21:28 +01:00
$sTitle = $oCountry -> getFieldData ( 'oxtitle' );
2013-04-22 11:40:11 +02:00
}
2012-01-31 23:21:28 +01:00
else
2013-04-22 11:40:11 +02:00
{
$sTitle = oxRegistry :: getLang () -> translateString ( 'D3_GEOIP_SET_IP_CHECKIP_NOTSET' );
}
stopProfile ( __METHOD__ );
2012-01-31 23:21:28 +01:00
return $sTitle ;
}
2013-04-22 11:25:27 +02:00
2013-04-22 11:40:11 +02:00
/**
* @ return oxcountrylist
*/
2012-02-15 14:17:42 +01:00
public function getCountryList ()
{
2013-04-22 11:40:11 +02:00
startProfile ( __METHOD__ );
/** @var $oCountryList oxcountrylist */
2012-02-15 14:17:42 +01:00
$oCountryList = oxNew ( 'oxcountrylist' );
$oListObject = $oCountryList -> getBaseObject ();
$sFieldList = $oListObject -> getSelectFields ();
$sQ = " select $sFieldList from " . $oListObject -> getViewName ();
$oCountryList -> selectString ( $sQ );
2013-04-22 11:40:11 +02:00
stopProfile ( __METHOD__ );
2012-02-15 14:17:42 +01:00
return $oCountryList ;
}
2013-04-22 11:25:27 +02:00
2013-04-22 11:40:11 +02:00
/**
* @ return oxcountrylist
*/
2013-04-22 11:25:27 +02:00
public function getIPCountryList ()
{
2013-04-22 11:40:11 +02:00
startProfile ( __METHOD__ );
/** @var $oGeoIp d3geoip */
2013-04-22 11:25:27 +02:00
$oGeoIp = oxNew ( 'd3geoip' );
2013-04-22 11:40:11 +02:00
/** @var $oCountryList oxcountrylist */
2013-04-22 11:25:27 +02:00
$oCountryList = oxNew ( 'oxcountrylist' );
$oListObject = $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 ();
$oCountryList -> selectString ( $sQ );
2013-04-22 11:40:11 +02:00
stopProfile ( __METHOD__ );
2013-04-22 11:25:27 +02:00
return $oCountryList ;
}
2012-01-31 23:21:28 +01:00
}