$availableWorkspace = getWorkspacesAvailable (); //Translations //$Translations = G::getModel("Translation"); <-- ugly way to get a class require_once "classes/model/Translation.php"; $Translations = new Translation(); $translationsTable = $Translations->getTranslationEnvironments(); $availableLangArray = array (); $availableLangArray [] = array ('LANG_ID' => 'char', 'LANG_NAME' => 'char'); foreach ($translationsTable as $locale) { $aFields['LANG_ID'] = $locale['LOCALE']; if ($locale['COUNTRY'] != '.') {
public function getLanguagesList() { $Translations = new Translation(); $translationsTable = $Translations->getTranslationEnvironments(); if (($languagesList = $this->memcache->get('languagesList')) === false) { $languagesList = array(); foreach ($translationsTable as $locale) { $LANG_ID = $locale['LOCALE']; if ($locale['COUNTRY'] != '.') { $LANG_NAME = $locale['LANGUAGE'] . ' (' . ucwords(strtolower($locale['COUNTRY'])) . ')'; } else { $LANG_NAME = $locale['LANGUAGE']; } $languagesList[] = array($LANG_ID, $LANG_NAME); } $this->memcache->set('languagesList', $languagesList, 1 * 3600); } return $languagesList; }
/** * Upgrade this workspace Content. */ public function upgradeContent($workSpace = SYS_SYS) { $this->initPropel(true); require_once 'classes/model/Translation.php'; $translation = new Translation(); $information = $translation->getTranslationEnvironments(); $arrayLang = array(); foreach ($information as $key => $value) { $arrayLang[] = trim($value['LOCALE']); } require_once 'classes/model/Content.php'; $regenerateContent = new Content(); $regenerateContent->regenerateContent($arrayLang, $workSpace); }
<?php $request = isset($_REQUEST['request']) ? $_REQUEST['request'] : null; switch ($request) { case 'getLangList': $Translations = new Translation(); $result = new stdClass(); $result->rows = array(); $langs = $Translations->getTranslationEnvironments(); foreach ($langs as $lang) { $result->rows[] = array('LAN_ID' => $lang['LOCALE'], 'LAN_NAME' => $lang['LANGUAGE']); } $result->rows[] = array("LAN_ID" => "", "LAN_NAME" => G::LoadTranslation("ID_USE_LANGUAGE_URL")); print G::json_encode($result); break; case 'saveSettings': $memcache =& PMmemcached::getSingleton(defined('SYS_SYS') ? SYS_SYS : ''); G::LoadClass('configuration'); $conf = new Configurations(); $conf->loadConfig($obj, 'ENVIRONMENT_SETTINGS', ''); $conf->aConfig['login_enableForgotPassword'] = isset($_REQUEST['forgotPasswd']); $conf->aConfig['login_enableVirtualKeyboard'] = isset($_REQUEST['virtualKeyboad']); $conf->aConfig['login_defaultLanguage'] = isset($_REQUEST['lang']) ? $_REQUEST['lang'] : 'en'; $conf->saveConfig('ENVIRONMENT_SETTINGS', ''); $lang = isset($_REQUEST['lang']) ? $_REQUEST['lang'] : 'en'; //remove from memcache when this value is updated/created $memcache->delete('flagForgotPassword'); $response = new stdclass(); $response->success = true; $messEnableForgotPassword = isset($conf->aConfig["login_enableForgotPassword"]) && $conf->aConfig["login_enableForgotPassword"] == "1" ? G::LoadTranslation("ID_YES") : G::LoadTranslation("ID_NO"); G::auditLog("UpdateLoginSettings", "DefaultLanguage-> " . $lang . " EnableForgotPassword-> " . $messEnableForgotPassword);
/** * Set Language */ public static function setLanguage() { $acceptLanguage = isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : 'en'; if (!defined('SYS_LANG')) { $Translations = new \Translation(); $translationsTable = $Translations->getTranslationEnvironments(); $inLang = false; foreach ($translationsTable as $locale) { if ($locale['LOCALE'] == $acceptLanguage) { $inLang = true; break; } } $lang = $inLang ? $acceptLanguage : 'en'; define("SYS_LANG", $lang); } }
/** * Get configuration * @return mixed */ public function getConfiguration() { $sysConf = \System::getSystemConfiguration( PATH_CONFIG . 'env.ini' ); $offset = timezone_offset_get( new \DateTimeZone( $sysConf['time_zone'] ), new \DateTime() ); $response['timeZone'] = sprintf( "GMT%s%02d:%02d", ( $offset >= 0 ) ? '+' : '-', abs( $offset / 3600 ), abs( ($offset % 3600) / 60 ) ); $fields = \System::getSysInfo(); $response['version'] = $fields['PM_VERSION']; $Translations = new \Translation; $translationsTable = $Translations->getTranslationEnvironments(); $languagesList = array (); foreach ($translationsTable as $locale) { $LANG_ID = $locale['LOCALE']; if ($locale['COUNTRY'] != '.') { $LANG_NAME = $locale['LANGUAGE'] . ' (' . (ucwords( strtolower( $locale['COUNTRY'] ) )) . ')'; } else { $LANG_NAME = $locale['LANGUAGE']; } $languages["L10n"] = $LANG_ID; $languages["label"] = $LANG_NAME; $languagesList[] = $languages; } $response['listLanguage'] = $languagesList; return $response; }
die; if (isset($meta['LAN_ID']) && $meta['LAN_ID'] == $_POST['lang']) { echo 'The Setting was saved successfully!'; } else { echo 'Some error occured while the setting was being save, try later please.'; } break; case 'languagesList': require_once 'classes/model/Language.php'; require_once 'classes/model/IsoCountry.php'; require_once 'classes/model/Translation.php'; G::loadClass('configuration'); $isoCountry = new isoCountry(); $translationRow = new Translation(); $response = new stdClass(); $translationsEnvList = $translationRow->getTranslationEnvironments(); //print_r($translationsEnvList); die; $i = 0; foreach ($translationsEnvList as $locale => $translationRow) { $COUNTRY_ID = $translationRow['IC_UID']; if ($COUNTRY_ID != '') { $isoCountryRecord = $isoCountry->findById(strtoupper($COUNTRY_ID)); $flag = strtolower($isoCountryRecord['IC_UID']); $countryName = $translationRow['HEADERS']['X-Poedit-Country']; } else { $flag = 'international'; $countryName = G::LoadTranslation('ID_INTERNATIONAL'); } G::LoadClass('configuration'); $conf = new Configurations(); $confCasesList = $conf->getConfiguration('casesList', 'todo');
/** * Get configuration * @return mixed */ public function getConfiguration() { $sysConf = \System::getSystemConfiguration('', '', SYS_SYS); $offset = timezone_offset_get(new \DateTimeZone($sysConf['time_zone']), new \DateTime()); $response['timeZone'] = sprintf("GMT%s%02d:%02d", $offset >= 0 ? '+' : '-', abs($offset / 3600), abs($offset % 3600 / 60)); $response['multiTimeZone'] = isset($sysConf['system_utc_time_zone']) && $sysConf['system_utc_time_zone'] ? true : false; $fields = \System::getSysInfo(); $response['version'] = $fields['PM_VERSION']; $buildType = 'Community'; /*----------------------------------********---------------------------------*/ $response['buildType'] = $buildType; $conf = new \Configurations(); $confEnvironment = $conf->getFormats(); $response['environment'] = array(); if (is_array($confEnvironment)) { $response['environment']['format'] = isset($confEnvironment['format']) ? $confEnvironment['format'] : ''; $response['environment']['dateFormat'] = isset($confEnvironment['dateFormat']) ? $confEnvironment['dateFormat'] : ''; $response['environment']['casesListDateFormat'] = isset($confEnvironment['casesListDateFormat']) ? $confEnvironment['casesListDateFormat'] : ''; } $Translations = new \Translation(); $translationsTable = $Translations->getTranslationEnvironments(); $languagesList = array(); foreach ($translationsTable as $locale) { $LANG_ID = $locale['LOCALE']; if ($locale['COUNTRY'] != '.') { $LANG_NAME = $locale['LANGUAGE'] . ' (' . ucwords(strtolower($locale['COUNTRY'])) . ')'; } else { $LANG_NAME = $locale['LANGUAGE']; } $languages["L10n"] = $LANG_ID; $languages["label"] = $LANG_NAME; $languagesList[] = $languages; } $response['listLanguage'] = $languagesList; return $response; }