61 if ($sOxId !=
"-1" && isset($sOxId)) {
65 return "language_main.tpl";
83 if (!isset($aParams[
'active'])) {
84 $aParams[
'active'] = 0;
87 if (!isset($aParams[
'default'])) {
88 $aParams[
'default'] =
false;
91 if (empty($aParams[
'sort'])) {
92 $aParams[
'sort'] =
'99999';
102 $blViewError =
false;
105 if ($sOxId != -1 && $sOxId != $aParams[
'abbr']) {
107 if ((
int) $this->_aLangData[
'params'][$sOxId][
'baseId'] == 0) {
108 $oEx =
oxNew(
"oxExceptionToDisplay");
109 $oEx->setMessage(
'LANGUAGE_ABBRCHANGEMAINLANG_WARNING');
111 $aParams[
'abbr'] = $sOxId;
114 $sOxId = $aParams[
'abbr'];
122 if ($blNewLanguage = ($sOxId == -1)) {
123 $sOxId = $aParams[
'abbr'];
129 $this->_aLangData[
'lang'][$sOxId] = $aParams[
'desc'];
132 $this->_aLangData[
'params'][$sOxId][
'active'] = $aParams[
'active'];
133 $this->_aLangData[
'params'][$sOxId][
'default'] = $aParams[
'default'];
134 $this->_aLangData[
'params'][$sOxId][
'sort'] = $aParams[
'sort'];
137 if ($aParams[
'default'] ==
'1') {
142 $iBaseId = $this->_aLangData[
'params'][$sOxId][
'baseId'];
143 $this->_aLangData[
'urls'][$iBaseId] = $aParams[
'baseurl'];
144 $this->_aLangData[
'sslUrls'][$iBaseId] = $aParams[
'basesslurl'];
149 $this->_aViewData[
"updatelist"] =
"1";
152 $this->
getConfig()->saveShopConfVar(
'aarr',
'aLanguageParams', $this->_aLangData[
'params']);
153 $this->
getConfig()->saveShopConfVar(
'aarr',
'aLanguages', $this->_aLangData[
'lang']);
154 $this->
getConfig()->saveShopConfVar(
'arr',
'aLanguageURLs', $this->_aLangData[
'urls']);
155 $this->
getConfig()->saveShopConfVar(
'arr',
'aLanguageSSLURLs', $this->_aLangData[
'sslUrls']);
159 if ($blNewLanguage) {
169 $oEx =
oxNew(
'oxExceptionToDisplay');
170 $oEx->setMessage(
'LANGUAGE_ERRORGENERATEVIEWS');
184 $sDefaultLang = $this->
getConfig()->getConfigParam(
'sDefaultLang');
186 $aLangData = $this->_aLangData[
'params'][$sOxId];
187 $aLangData[
'abbr'] = $sOxId;
188 $aLangData[
'desc'] = $this->_aLangData[
'lang'][$sOxId];
189 $aLangData[
'baseurl'] = $this->_aLangData[
'urls'][$aLangData[
'baseId']];
190 $aLangData[
'basesslurl'] = $this->_aLangData[
'sslUrls'][$aLangData[
'baseId']];
191 $aLangData[
'default'] = ($this->_aLangData[
'params'][$sOxId][
"baseId"] == $sDefaultLang) ?
true :
false;
203 $this->_aLangData = $aLangData;
215 $aLangData[
'params'] = $this->
getConfig()->getConfigParam(
'aLanguageParams');
216 $aLangData[
'lang'] = $this->
getConfig()->getConfigParam(
'aLanguages');
217 $aLangData[
'urls'] = $this->
getConfig()->getConfigParam(
'aLanguageURLs');
218 $aLangData[
'sslUrls'] = $this->
getConfig()->getConfigParam(
'aLanguageSSLURLs');
221 if (!is_array($aLangData[
'params'])) {
236 foreach (array_keys($this->_aLangData) as $sTypeKey) {
238 if (is_array($this->_aLangData[$sTypeKey]) && count($this->_aLangData[$sTypeKey]) > 0) {
240 if ($sTypeKey ==
'urls' || $sTypeKey ==
'sslUrls') {
244 $aKeys = array_keys($this->_aLangData[$sTypeKey]);
245 $aValues = array_values($this->_aLangData[$sTypeKey]);
247 $iReplaceId = array_search($sOldId, $aKeys);
248 $aKeys[$iReplaceId] = $sNewId;
250 $this->_aLangData[$sTypeKey] = array_combine($aKeys, $aValues);
265 uasort($this->_aLangData[
'params'], array($this,
'_sortLangParamsByBaseIdCallback'));
267 foreach ($this->_aLangData[
'params'] as $sAbbr => $aParams) {
268 $iId = (int) $aParams[
'baseId'];
269 $aUrls[$iId] = $this->_aLangData[
'urls'][$iId];
270 $aSslUrls[$iId] = $this->_aLangData[
'sslUrls'][$iId];
271 $aLanguages[$sAbbr] = $this->_aLangData[
'lang'][$sAbbr];
275 $this->_aLangData[
'urls'] = $aUrls;
276 $this->_aLangData[
'sslUrls'] = $aSslUrls;
292 $aParams[$sOxId][
'baseId'] = $iBaseId;
293 $aParams[$sOxId][
'active'] = 1;
294 $aParams[$sOxId][
'sort'] = $iBaseId + 1;
309 $sDefaultId = $this->_aLangData[
'params'][$sOxId][
'baseId'];
310 $this->
getConfig()->saveShopConfVar(
'str',
'sDefaultLang', $sDefaultId);
321 foreach ($this->_aLangData[
'params'] as
$aLang) {
322 $aBaseId[] = $aLang[
'baseId'];
327 $iTotal = count($aBaseId);
330 while ($iNewId <= $iTotal) {
331 if ($iNewId !== $aBaseId[$iNewId]) {
350 $sDir = dirname(
$myConfig->getTranslationsDir(
'lang.php', $sOxId));
353 $oEx =
oxNew(
"oxExceptionToDisplay");
354 $oEx->setMessage(
'LANGUAGE_NOTRANSLATIONS_WARNING');
368 $iBaseId = $this->_aLangData[
'params'][$sOxId][
'baseId'];
369 $sTable = getLangTableName(
'oxarticles', $iBaseId);
372 $oDbMetadata =
oxNew(
'oxDbMetaDataHandler');
374 return $oDbMetadata->tableExists($sTable) && $oDbMetadata->fieldExists($sColumn, $sTable);
388 $oDbMeta =
oxNew(
"oxDbMetaDataHandler");
391 $oDbMeta->addNewLangToDb();
397 echo $oEx->getMessage();
398 $oEx =
oxNew(
"oxExceptionToDisplay");
399 $oEx->setMessage(
'LANGUAGE_ERROR_ADDING_MULTILANG_FIELDS');
418 $aAbbrs = array_keys($this->_aLangData[
'lang']);
420 if (in_array($sAbbr, $aAbbrs)) {
438 return ($oLang1[
'baseId'] < $oLang2[
'baseId']) ? -1 : 1;
457 $oEx =
oxNew(
'oxExceptionToDisplay');
458 $oEx->setMessage(
'LANGUAGE_ALREADYEXISTS_ERROR');
465 if (empty($aParams[
'desc'])) {
466 $oEx =
oxNew(
'oxExceptionToDisplay');
467 $oEx->setMessage(
'LANGUAGE_EMPTYLANGUAGENAME_ERROR');