diff --git a/.gitattributes b/.gitattributes index 4994844..d8c517b 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2,6 +2,7 @@ /Doxyfile -text copy_this/.noencode -text copy_this/modules/d3/d3geoip/IntelliSenseHelper.php -text +copy_this/modules/d3/d3geoip/components/d3cmp_geoip.php -text copy_this/modules/d3/d3geoip/controllers/admin/d3_cfg_geoipset.php -text copy_this/modules/d3/d3geoip/controllers/admin/d3_cfg_geoipset_licence.php -text copy_this/modules/d3/d3geoip/controllers/admin/d3_cfg_geoipset_list.php -text @@ -10,8 +11,6 @@ copy_this/modules/d3/d3geoip/controllers/admin/d3_country_geoip.php -text copy_this/modules/d3/d3geoip/menu.xml -text copy_this/modules/d3/d3geoip/metadata.php -text copy_this/modules/d3/d3geoip/models/d3geoip.php -text -copy_this/modules/d3/d3geoip/modules/components/d3_oxcmp_cur_geoip.php -text -copy_this/modules/d3/d3geoip/modules/components/d3_oxcmp_lang_geoip.php -text copy_this/modules/d3/d3geoip/picture.png -text copy_this/modules/d3/d3geoip/setup/d3geoip_update.php -text copy_this/modules/d3/d3geoip/views/admin/de/d3_geoip_lang.php -text diff --git a/copy_this/.noencode b/copy_this/.noencode index 2cecf09..852e36b 100644 --- a/copy_this/.noencode +++ b/copy_this/.noencode @@ -1 +1 @@ -copyAsIsFiles = modules/d3/d3geoip/controllers, modules/d3/d3geoip/models/d3geoip_update.php, modules/d3/d3geoip/modules/components, modules/d3/d3geoip/views, modules/d3/d3geoip/d3_geoip_stub.php, modules/d3/d3geoip/metadata.php \ No newline at end of file +copyAsIsFiles = modules/d3/d3geoip/components, modules/d3/d3geoip/controllers, modules/d3/d3geoip/models/d3geoip_update.php, modules/d3/d3geoip/views, modules/d3/d3geoip/IntelliSenseHelper.php, modules/d3/d3geoip/metadata.php \ No newline at end of file diff --git a/copy_this/modules/d3/d3geoip/modules/components/d3_oxcmp_cur_geoip.php b/copy_this/modules/d3/d3geoip/components/d3cmp_geoip.php similarity index 74% rename from copy_this/modules/d3/d3geoip/modules/components/d3_oxcmp_cur_geoip.php rename to copy_this/modules/d3/d3geoip/components/d3cmp_geoip.php index 9cc7960..6cfd75f 100644 --- a/copy_this/modules/d3/d3geoip/modules/components/d3_oxcmp_cur_geoip.php +++ b/copy_this/modules/d3/d3geoip/components/d3cmp_geoip.php @@ -1,5 +1,4 @@ + * @copyright © Dł Data Development, Thomas Dartsch + * @author Dł Data Development - Daniel Seifert * @link http://www.oxidmodule.com */ -class d3_oxcmp_cur_geoip extends d3_oxcmp_cur_geoip_parent + +class d3cmp_geoip extends oxView { + /** + * Marking object as component + * + * @var bool + */ + protected $_blIsComponent = true; + private $_sModId = 'd3_geoip'; /** @@ -33,8 +40,9 @@ class d3_oxcmp_cur_geoip extends d3_oxcmp_cur_geoip_parent /** @var $oLocation d3geoip */ $oLocation = oxNew('d3geoip'); $oLocation->setCountryCurrency(); + $oLocation->setCountryLanguage(); } parent::init(); } -} +} \ No newline at end of file diff --git a/copy_this/modules/d3/d3geoip/metadata.php b/copy_this/modules/d3/d3geoip/metadata.php index 05a5a3f..6b8f39c 100644 --- a/copy_this/modules/d3/d3geoip/metadata.php +++ b/copy_this/modules/d3/d3geoip/metadata.php @@ -19,11 +19,9 @@ $aModule = array( 'author' => 'D³ Data Development (Inh.: Thomas Dartsch)', 'email' => 'support@shopmodule.com', 'url' => 'http://www.oxidmodule.com/', - 'extend' => array( - 'oxcmp_cur' => 'd3/d3geoip/modules/components/d3_oxcmp_cur_geoip', - 'oxcmp_lang' => 'd3/d3geoip/modules/components/d3_oxcmp_lang_geoip', - ), + 'extend' => array(), 'files' => array( + 'd3cmp_geoip' => 'd3/d3geoip/components/d3cmp_geoip.php', 'd3_cfg_geoipset' => 'd3/d3geoip/controllers/admin/d3_cfg_geoipset.php', 'd3_cfg_geoipset_list' => 'd3/d3geoip/controllers/admin/d3_cfg_geoipset_list.php', 'd3_cfg_geoipset_main' => 'd3/d3geoip/controllers/admin/d3_cfg_geoipset_main.php', diff --git a/copy_this/modules/d3/d3geoip/modules/components/d3_oxcmp_lang_geoip.php b/copy_this/modules/d3/d3geoip/modules/components/d3_oxcmp_lang_geoip.php deleted file mode 100644 index 6bd21e6..0000000 --- a/copy_this/modules/d3/d3geoip/modules/components/d3_oxcmp_lang_geoip.php +++ /dev/null @@ -1,34 +0,0 @@ - - * @link http://www.oxidmodule.com - */ -class d3_oxcmp_lang_geoip extends d3_oxcmp_lang_geoip_parent -{ - private $_sModId = "d3_geoip"; - - /** - * @return null - */ - public function init() - { - if (d3_cfg_mod::get($this->_sModId)->isActive()) { - /** @var $oLocation d3geoip */ - $oLocation = oxNew('d3geoip'); - $oLocation->setCountryLanguage(); - } - - parent::init(); - } -} diff --git a/copy_this/modules/d3/d3geoip/setup/d3geoip_update.php b/copy_this/modules/d3/d3geoip/setup/d3geoip_update.php index f275063..3e498a5 100644 --- a/copy_this/modules/d3/d3geoip/setup/d3geoip_update.php +++ b/copy_this/modules/d3/d3geoip/setup/d3geoip_update.php @@ -42,6 +42,8 @@ zQ9'; 'do' => 'fixIndizes'), array('check' => 'hasUnregisteredFiles', 'do' => 'showUnregisteredFiles'), + array('check' => 'checkRegisteredComponent', + 'do' => 'registerComponent'), array('check' => 'checkModCfgSameRevision', 'do' => 'updateModCfgSameRevision'), ); @@ -405,4 +407,52 @@ zQ9'; { return $this->_showUnregisteredFiles('d3geoip', array('d3FileRegister')); } + + /** + * @return bool + */ + public function checkRegisteredComponent() + { + $sVarName = 'aUserComponentNames'; + $sModuleId = ''; + /** @var $oShop oxshop */ + foreach ($this->getShopListByActiveModule('d3geoip') as $oShop) { + /** @var array $aUserComponents */ + $aUserComponents = oxRegistry::getConfig()->getShopConfVar($sVarName, $oShop->getId(), $sModuleId); + + if (false == $aUserComponents + || false == $aUserComponents['d3cmp_geoip'] + ) { + return true; + } + } + + return false; + } + + /** + * @return bool + */ + public function registerComponent() + { + $blRet = true; + $sVarName = 'aUserComponentNames'; + $sModuleId = ''; + + /** @var $oShop oxshop */ + foreach ($this->getShopList() as $oShop) { + $aUserComponents = oxRegistry::getConfig()->getShopConfVar($sVarName, $oShop->getId(), $sModuleId); + if (false == $aUserComponents) { + $aUserComponents = array(); + } + + if (false == $aUserComponents['d3cmp_geoip']) { + $blDontUseCache = 1; + $aUserComponents['d3cmp_geoip'] = $blDontUseCache; + $this->fixOxconfigVariable($sVarName, $oShop->getId(), '', $aUserComponents, 'arr'); + } + } + + return $blRet; + } }