function main_localization($eventData) { global $wuiMainFrame, $wuiTitleBar, $innomaticLocale, $actionDispatcher, $wuiMainStatus; $eventData = $actionDispatcher->getEventData(); $countryLocale = new \Innomatic\Locale\LocaleCatalog('innomatic::localization', \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getLanguage()); $selectedCountry = ''; if (isset($eventData['country'])) { $selectedCountry = $eventData['country']; } $wuiVGroup = new WuiVertgroup('vgroup'); $countryQuery = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getDataAccess()->execute('SELECT * FROM locale_countries'); while (!$countryQuery->eof) { $countries[$countryQuery->getFields('countryname')] = $countryLocale->getStr($countryQuery->getFields('countryname')); $countryQuery->moveNext(); } $wuiLocaleGrid = new WuiGrid('localegrid', array('rows' => '1', 'cols' => '3')); $wuiLocaleGrid->addChild(new WuiLabel('countrylabel', array('label' => $innomaticLocale->getStr('country_label'))), 0, 0); $wuiLocaleGrid->addChild(new WuiComboBox('country', array('disp' => 'action', 'elements' => $countries, 'default' => $selectedCountry ? $selectedCountry : \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getCountry())), 0, 1); $wuiLocaleGrid->addChild(new WuiSubmit('submit1', array('caption' => $innomaticLocale->getStr('country_submit'))), 0, 2); $wuiVGroup->addChild($wuiLocaleGrid); $formEventsCall = new \Innomatic\Wui\Dispatch\WuiEventsCall(); $formEventsCall->addEvent(new \Innomatic\Wui\Dispatch\WuiEvent('action', 'setcountry', '')); $formEventsCall->addEvent(new \Innomatic\Wui\Dispatch\WuiEvent('view', 'localization', '')); $wuiForm = new WuiForm('countryform', array('action' => $formEventsCall->getEventsCallString())); $wuiForm->addChild($wuiVGroup); $wuiMainFrame->addChild($wuiForm); $locCountry = new \Innomatic\Locale\LocaleCountry(\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getCountry()); $countryLanguage = $locCountry->Language(); $languageLocale = new \Innomatic\Locale\LocaleCatalog('innomatic::localization', \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getLanguage()); $selectedLanguage = ''; if (isset($eventData['language'])) { $selectedLanguage = $eventData['language']; } $wuiVGroup = new WuiVertgroup('vgroup'); $languageQuery = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getDataAccess()->execute('SELECT * FROM locale_languages'); while (!$languageQuery->eof) { $languages[$languageQuery->getFields('langshort')] = $languageLocale->getStr($languageQuery->getFields('langname')); $languageQuery->moveNext(); } $wuiLocaleGrid = new WuiGrid('localegrid', array('rows' => '1', 'cols' => '3')); $wuiLocaleGrid->addChild(new WuiLabel('languagelabel', array('label' => $innomaticLocale->getStr('language_label'))), 0, 0); $wuiLocaleGrid->addChild(new WuiComboBox('language', array('disp' => 'action', 'elements' => $languages, 'default' => $selectedLanguage ? $selectedLanguage : \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getLanguage())), 0, 1); $wuiLocaleGrid->addChild(new WuiSubmit('submit1', array('caption' => $innomaticLocale->getStr('language_submit'))), 0, 2); $wuiVGroup->addChild($wuiLocaleGrid); $wuiVGroup->addChild(new WuiHorizBar('horizbar1')); $wuiVGroup->addChild(new WuiLabel('deflanglabel', array('label' => sprintf($innomaticLocale->getStr('countrylanguage_label'), $languages[$countryLanguage])))); $formEventsCall = new \Innomatic\Wui\Dispatch\WuiEventsCall(); $formEventsCall->addEvent(new \Innomatic\Wui\Dispatch\WuiEvent('action', 'setlanguage', '')); $formEventsCall->addEvent(new \Innomatic\Wui\Dispatch\WuiEvent('view', 'localization', '')); $wuiForm = new WuiForm('languageform', array('action' => $formEventsCall->getEventsCallString())); $wuiForm->addChild($wuiVGroup); $wuiMainFrame->addChild($wuiForm); $wuiTitleBar->mTitle .= ' - ' . $innomaticLocale->getStr('country_title'); }
$country = isset($pass_data['country']) ? $pass_data['country'] : ''; if (!strlen($country)) { $country = $container->getCountry(); } $args['dbname'] = $container->getConfig()->value('RootDatabaseName'); $args['dbhost'] = $container->getConfig()->value('RootDatabaseHost'); $args['dbport'] = $container->getConfig()->value('RootDatabasePort'); $args['dbuser'] = $container->getConfig()->value('RootDatabaseUser'); $args['dbpass'] = $container->getConfig()->value('RootDatabasePassword'); $args['dbtype'] = $container->getConfig()->value('RootDatabaseType'); $args['dblog'] = $container->getHome() . 'core/log/innomatic_root_db.log'; $dasn_string = $args['dbtype'] . '://' . $args['dbuser'] . ':' . $args['dbpass'] . '@' . $args['dbhost'] . ':' . $args['dbport'] . '/' . $args['dbname'] . '?' . 'logfile=' . $args['dblog']; $tmpdb = \Innomatic\Dataaccess\DataAccessFactory::getDataAccess(new \Innomatic\Dataaccess\DataAccessSourceName($dasn_string)); if ($tmpdb->Connect()) { $loc_country = new \Innomatic\Locale\LocaleCountry($country); $country_language = $loc_country->Language(); $language_locale = new \Innomatic\Locale\LocaleCatalog('innomatic::localization', $container->getLanguage()); $selected_language = $actionDispatcher->getEventData(); if (isset($selected_language['language'])) { $selected_language = $selected_language['language']; } else { $selected_language = false; } $wui_vgroup = new WuiVertgroup('vgroup'); $language_query = $tmpdb->execute('SELECT * FROM locale_languages'); while (!$language_query->eof) { $languages[$language_query->getFields('langshort')] = $language_locale->getStr($language_query->getFields('langname')); $language_query->moveNext(); } $wui_locale_grid = new WuiGrid('localegrid'); $wui_locale_grid->addChild(new WuiLabel('languagelabel', array('label' => $innomaticLocale->getStr('language_label'))), 0, 0);