148 'select' => array(
'EMAIL'),
150 '=ID' => array_slice(\CGroup::getGroupUser(1), 0, 200),
156 if ($user && $user[
'EMAIL'])
158 $email = $user[
'EMAIL'];
162 $email = Option::get(
'main',
'email_from',
'');
168 'PHRASES' => array(
'COMPANY_NAME',
'IP_NAME'),
171 'CODE' =>
'COMPANY_NAME',
176 'CODE' =>
'COMPANY_ADDRESS',
181 'CODE' =>
'PURPOSES',
183 'SHOW_BY_CHECKBOX' =>
true,
187 'CODE' =>
'THIRD_PARTIES',
189 'SHOW_BY_CHECKBOX' =>
true,
195 'PLACEHOLDER' => $email,
196 'DEFAULT_VALUE' => $email,
202 'PHRASES' => array(),
205 'CODE' =>
'COMPANY_NAME',
212 'PHRASES' => array(
'COMPANY_NAME',
'IP_NAME'),
215 'CODE' =>
'COMPANY_NAME',
220 'CODE' =>
'COMPANY_ADDRESS',
225 'CODE' =>
'PURPOSES',
227 'SHOW_BY_CHECKBOX' =>
true,
231 'CODE' =>
'THIRD_PARTIES',
233 'SHOW_BY_CHECKBOX' =>
true,
239 'PLACEHOLDER' => $email,
240 'DEFAULT_VALUE' => $email,
246 'PHRASES' => array(
'COMPANY_NAME',
'IP_NAME'),
249 'CODE' =>
'COMPANY_NAME',
254 'CODE' =>
'COMPANY_ADDRESS',
259 'CODE' =>
'PURPOSES',
261 'SHOW_BY_CHECKBOX' =>
true,
265 'CODE' =>
'THIRD_PARTIES',
267 'SHOW_BY_CHECKBOX' =>
true,
273 'PLACEHOLDER' => $email,
274 'DEFAULT_VALUE' => $email,
282 'AGREEMENT_TEXT' =>
'MAIN_USER_CONSENT_INTL_TEXT',
283 'LABEL_TEXT' =>
'MAIN_USER_CONSENT_INTL_LABEL',
284 'FIELDS_HINT' =>
'MAIN_USER_CONSENT_INTL_FIELDS_HINT',
285 'DESCRIPTION' =>
'MAIN_USER_CONSENT_INTL_DESCRIPTION',
286 'NOTIFY_TEXT' =>
'MAIN_USER_CONSENT_INTL_NOTIFY_TEXT',
289 foreach ($languages as
$languageId => $languageName)
292 if (!$item[
'AGREEMENT_TEXT'])
297 $item[
'NAME'] =
Loc::getMessage(
'MAIN_USER_CONSENT_INTL_NAME', array(
'%language_name%' => $languageName));
300 $item[
'LANGUAGE_NAME'] = $languageName;
302 $item[
'PHRASES'] = array();
305 $phraseMap = array();
306 foreach ($intl[
$languageId][
'PHRASES'] as $phraseCode)
308 $phraseMap[$phraseCode] =
"MAIN_USER_CONSENT_INTL_PHRASE_{$phraseCode}";
313 $item[
'FIELDS'] = array();
318 $messageFieldsMap = array(
319 'CAPTION' =>
"MAIN_USER_CONSENT_INTL_FIELD_{$field['CODE']}",
320 'PLACEHOLDER' =>
"MAIN_USER_CONSENT_INTL_FIELD_{$field['CODE']}_HINT",
321 'DEFAULT_VALUE' =>
"MAIN_USER_CONSENT_INTL_FIELD_{$field['CODE']}_DEFAULT",
325 if ($field[
'TYPE'] ==
'text' && $field[
'DEFAULT_VALUE'])
327 $field[
'PLACEHOLDER'] .=
"\n" .
Loc::getMessage(
'MAIN_USER_CONSENT_INTL_HINT_FIELD_DEFAULT');
328 $field[
'PLACEHOLDER'] .=
"\n" . $field[
'DEFAULT_VALUE'];
331 $item[
'FIELDS'][] = $field;
357 foreach (self::$virtualLanguageMap as $virtualLanguageId =>
$languageId)
359 $languageName =
Loc::getMessage(
'MAIN_USER_CONSENT_INTL_LANG_NAME_'.mb_strtoupper($virtualLanguageId));
362 $languageName = $virtualLanguageId;
364 $list[$virtualLanguageId] = $languageName;
368 $dirLanguages = array();
371 if (!$dir->isExists())
376 foreach($dir->getChildren() as $childDir)
378 if (!$childDir->isDirectory())
383 $dirLanguages[] = $childDir->getName();
386 if (empty($dirLanguages))
392 $listDb = LanguageTable::getList(array(
393 'select' => array(
'LID',
'NAME'),
395 '=LID' => $dirLanguages,
398 'order' => array(
'SORT' =>
'ASC')
400 while ($item = $listDb->fetch())
402 $list[$item[
'LID']] = $item[
'NAME'];
418 $virtualLanguageId =
null;
422 $languageId = self::$virtualLanguageMap[$virtualLanguageId];
430 $keys = array_keys($messages);
431 foreach ($keys as $key)
438 if ($virtualLanguageId)
440 $postfix =
'_'.mb_strtoupper($virtualLanguageId);
441 foreach ($map as $itemKey => $messageKey)
443 if (mb_substr($itemKey, -mb_strlen($postfix)) == $postfix)
445 $oldItemKey = $itemKey;
446 $itemKey = mb_substr($itemKey, 0, -mb_strlen($postfix));
447 unset($map[$oldItemKey]);
450 if (mb_substr($messageKey, -mb_strlen($postfix)) != $postfix)
452 if (isset($messages[$messageKey . $postfix]))
454 $messageKey .= $postfix;
458 $map[$itemKey] = $messageKey;
464 foreach ($map as $itemKey => $messageKey)
466 $message = $messages[$messageKey] ??
'';
467 $message = trim($message);
468 $message = $message ==
'-' ?
'' : $message;
470 $item[$itemKey] = $message;