1
0
Fork 0
mirror of synced 2025-04-04 14:23:33 +03:00

ref #91040 Добавлен шаблон регистрации с элементом подписки

Обновлен файл updater.php
This commit is contained in:
Ivan Chaplygin 2023-07-14 16:05:04 +03:00
parent 3f084d1eee
commit ec91b57cbf
12 changed files with 471 additions and 20 deletions

View file

@ -0,0 +1,10 @@
<?
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
$arTemplateParameters = array(
"USER_PROPERTY_NAME"=>array(
"NAME" => GetMessage("USER_PROPERTY_NAME"),
"TYPE" => "STRING",
"DEFAULT" => "",
),
);
?>

View file

@ -0,0 +1,3 @@
<?
$MESS ['USER_PROPERTY_NAME'] = "User properties section title";
?>

View file

@ -0,0 +1,63 @@
<?
$MESS['AUTH_NONSECURE_NOTE'] = "The password will be sent in open form. Enable JavaScript in your web browser to enable password encryption.";
$MESS['AUTH_REGISTER'] = "Registration";
$MESS['AUTH_REQ'] = "Required fields.";
$MESS['AUTH_SECURE_NOTE'] = "The password will be encrypted before it is sent. This will prevent the password from appearing in open form over data transmission channels.";
$MESS['MAIN_REGISTER_AUTH'] = "You have been registered and authorized successfully.";
$MESS['REGISTER_CAPTCHA_PROMT'] = "CAPTCHA image characters";
$MESS['REGISTER_CAPTCHA_TITLE'] = "Spam bot protection (CAPTCHA)";
$MESS['REGISTER_EMAIL_WILL_BE_SENT'] = "A registration confirmation request will be sent to the specified e-mail address.";
$MESS['REGISTER_FIELD_AUTO_TIME_ZONE'] = "Time Zone";
$MESS['REGISTER_FIELD_CONFIRM_PASSWORD'] = "Password confirmation";
$MESS['REGISTER_FIELD_EMAIL'] = "E-mail";
$MESS['REGISTER_FIELD_LAST_NAME'] = "Last Name";
$MESS['REGISTER_FIELD_LOGIN'] = "Login (min. 3 characters)";
$MESS['REGISTER_FIELD_NAME'] = "Name";
$MESS['REGISTER_FIELD_PASSWORD'] = "Password";
$MESS['REGISTER_FIELD_PERSONAL_BIRTHDAY'] = "Birthday";
$MESS['REGISTER_FIELD_PERSONAL_CITY'] = "City";
$MESS['REGISTER_FIELD_PERSONAL_COUNTRY'] = "Country";
$MESS['REGISTER_FIELD_PERSONAL_FAX'] = "Fax";
$MESS['REGISTER_FIELD_PERSONAL_GENDER'] = "Gender";
$MESS['REGISTER_FIELD_PERSONAL_ICQ'] = "ICQ";
$MESS['REGISTER_FIELD_PERSONAL_MAILBOX'] = "Mailbox";
$MESS['REGISTER_FIELD_PERSONAL_MOBILE'] = "Mobile";
$MESS['REGISTER_FIELD_PERSONAL_NOTES'] = "Notes";
$MESS['REGISTER_FIELD_PERSONAL_PAGER'] = "Pager";
$MESS['REGISTER_FIELD_PERSONAL_PHONE'] = "Phone";
$MESS['REGISTER_FIELD_PERSONAL_PHOTO'] = "Photo";
$MESS['REGISTER_FIELD_PERSONAL_PROFESSION'] = "Job Title";
$MESS['REGISTER_FIELD_PERSONAL_STATE'] = "State";
$MESS['REGISTER_FIELD_PERSONAL_STREET'] = "Address";
$MESS['REGISTER_FIELD_PERSONAL_WWW'] = "Web page";
$MESS['REGISTER_FIELD_PERSONAL_ZIP'] = "Zip code";
$MESS['REGISTER_FIELD_PHONE_NUMBER'] = "Phone number";
$MESS['REGISTER_FIELD_SECOND_NAME'] = "Middle Name";
$MESS['REGISTER_FIELD_TITLE'] = "Salutation";
$MESS['REGISTER_FIELD_WORK_CITY'] = "City";
$MESS['REGISTER_FIELD_WORK_COMPANY'] = "Company";
$MESS['REGISTER_FIELD_WORK_COUNTRY'] = "Country";
$MESS['REGISTER_FIELD_WORK_DEPARTMENT'] = "Department";
$MESS['REGISTER_FIELD_WORK_FAX'] = "Fax";
$MESS['REGISTER_FIELD_WORK_LOGO'] = "Company logo";
$MESS['REGISTER_FIELD_WORK_MAILBOX'] = "Mailbox";
$MESS['REGISTER_FIELD_WORK_NOTES'] = "Notes";
$MESS['REGISTER_FIELD_WORK_PAGER'] = "Pager";
$MESS['REGISTER_FIELD_WORK_PHONE'] = "Phone";
$MESS['REGISTER_FIELD_WORK_POSITION'] = "Position";
$MESS['REGISTER_FIELD_WORK_PROFILE'] = "Profile";
$MESS['REGISTER_FIELD_WORK_STATE'] = "State";
$MESS['REGISTER_FIELD_WORK_STREET'] = "Address";
$MESS['REGISTER_FIELD_WORK_WWW'] = "Web page";
$MESS['REGISTER_FIELD_WORK_ZIP'] = "Zip code";
$MESS['USER_DONT_KNOW'] = "(unknown)";
$MESS['USER_FEMALE'] = "Female";
$MESS['USER_MALE'] = "Male";
$MESS['main_profile_time_zones_auto'] = "Auto Time Zone:";
$MESS['main_profile_time_zones_auto_def'] = "(default)";
$MESS['main_profile_time_zones_auto_no'] = "No, select from list";
$MESS['main_profile_time_zones_auto_yes'] = "Yes, use browser settings";
$MESS['main_profile_time_zones_zones'] = "Time Zone:";
$MESS['main_register_sms'] = "SMS confirmation code:";
$MESS['main_register_sms_send'] = "Submit";
?>

View file

@ -0,0 +1,3 @@
<?
$MESS ['USER_PROPERTY_NAME'] = "Название блока пользовательских свойств";
?>

View file

@ -0,0 +1,64 @@
<?
$MESS["AUTH_REGISTER"] = "Регистрация";
$MESS["REGISTER_CAPTCHA_TITLE"] = "Защита от автоматической регистрации";
$MESS["REGISTER_CAPTCHA_PROMT"] = "Введите слово на картинке";
$MESS["AUTH_REQ"] = "Поля, обязательные для заполнения.";
$MESS["USER_DONT_KNOW"] = "(неизвестно)";
$MESS["USER_MALE"] = "Мужской";
$MESS["USER_FEMALE"] = "Женский";
$MESS["REGISTER_FIELD_LOGIN"] = "Логин (мин. 3 символа)";
$MESS["REGISTER_FIELD_EMAIL"] = "Email";
$MESS["REGISTER_FIELD_PASSWORD"] = "Пароль";
$MESS["REGISTER_FIELD_CONFIRM_PASSWORD"] = "Подтверждение пароля";
$MESS["REGISTER_FIELD_TITLE"] = "Обращение";
$MESS["REGISTER_FIELD_NAME"] = "Имя";
$MESS["REGISTER_FIELD_SECOND_NAME"] = "Отчество";
$MESS["REGISTER_FIELD_LAST_NAME"] = "Фамилия";
$MESS["REGISTER_FIELD_AUTO_TIME_ZONE"] = "Часовой пояс";
$MESS["REGISTER_FIELD_PERSONAL_PROFESSION"] = "Профессия";
$MESS["REGISTER_FIELD_PERSONAL_WWW"] = "WWW-страница";
$MESS["REGISTER_FIELD_PERSONAL_ICQ"] = "ICQ";
$MESS["REGISTER_FIELD_PERSONAL_GENDER"] = "Пол";
$MESS["REGISTER_FIELD_PERSONAL_BIRTHDAY"] = "Дата рождения";
$MESS["REGISTER_FIELD_PERSONAL_PHOTO"] = "Фотография";
$MESS["REGISTER_FIELD_PERSONAL_PHONE"] = "Телефон";
$MESS["REGISTER_FIELD_PERSONAL_FAX"] = "Факс";
$MESS["REGISTER_FIELD_PERSONAL_MOBILE"] = "Мобильный";
$MESS["REGISTER_FIELD_PERSONAL_PAGER"] = "Пейджер";
$MESS["REGISTER_FIELD_PERSONAL_STREET"] = "Улица, дом";
$MESS["REGISTER_FIELD_PERSONAL_MAILBOX"] = "Почтовый ящик";
$MESS["REGISTER_FIELD_PERSONAL_CITY"] = "Город";
$MESS["REGISTER_FIELD_PERSONAL_STATE"] = "Область / край";
$MESS["REGISTER_FIELD_PERSONAL_ZIP"] = "Почтовый индекс";
$MESS["REGISTER_FIELD_PERSONAL_COUNTRY"] = "Страна";
$MESS["REGISTER_FIELD_PERSONAL_NOTES"] = "Дополнительные заметки";
$MESS["REGISTER_FIELD_WORK_COMPANY"] = "Наименование компании";
$MESS["REGISTER_FIELD_WORK_DEPARTMENT"] = "Департамент / Отдел";
$MESS["REGISTER_FIELD_WORK_POSITION"] = "Должность";
$MESS["REGISTER_FIELD_WORK_WWW"] = "WWW-страница (работа)";
$MESS["REGISTER_FIELD_WORK_PHONE"] = "Телефон (работа)";
$MESS["REGISTER_FIELD_WORK_FAX"] = "Факс (работа)";
$MESS["REGISTER_FIELD_WORK_PAGER"] = "Пейджер (работа)";
$MESS["REGISTER_FIELD_WORK_STREET"] = "Улица, дом (работа)";
$MESS["REGISTER_FIELD_WORK_MAILBOX"] = "Почтовый ящик (работа)";
$MESS["REGISTER_FIELD_WORK_CITY"] = "Город (работа)";
$MESS["REGISTER_FIELD_WORK_STATE"] = "Область / край (работа)";
$MESS["REGISTER_FIELD_WORK_ZIP"] = "Почтовый индекс (работа)";
$MESS["REGISTER_FIELD_WORK_COUNTRY"] = "Страна (работа)";
$MESS["REGISTER_FIELD_WORK_PROFILE"] = "Направления деятельности";
$MESS["REGISTER_FIELD_WORK_LOGO"] = "Логотип компании";
$MESS["REGISTER_FIELD_WORK_NOTES"] = "Дополнительные заметки (работа)";
$MESS["REGISTER_FIELD_PHONE_NUMBER"] = "Номер телефона";
$MESS["REGISTER_EMAIL_WILL_BE_SENT"] = "На указанный в форме email придет запрос на подтверждение регистрации.";
$MESS["MAIN_REGISTER_AUTH"] = "Вы зарегистрированы на сервере и успешно авторизованы.";
$MESS["main_profile_time_zones_auto"] = "Автоматически определять часовой пояс:";
$MESS["main_profile_time_zones_auto_def"] = "(по умолчанию)";
$MESS["main_profile_time_zones_auto_yes"] = "Да, определить по браузеру";
$MESS["main_profile_time_zones_auto_no"] = "Нет, выбрать из списка";
$MESS["main_profile_time_zones_zones"] = "Часовой пояс:";
$MESS["AUTH_SECURE_NOTE"] = "Перед отправкой формы пароль будет зашифрован в браузере. Это позволит избежать передачи пароля в открытом виде.";
$MESS["AUTH_NONSECURE_NOTE"] = "Пароль будет отправлен в открытом виде. Включите JavaScript в браузере, чтобы зашифровать пароль перед отправкой.";
$MESS["main_register_sms"] = "Код подтверждения из СМС:";
$MESS["main_register_sms_send"] = "Отправить";
$MESS["SUBSCRIBE_EMAIL"] = "Подписаться на события";
?>

View file

@ -0,0 +1,5 @@
div.bx-auth-reg input.bx-auth-input {vertical-align:middle;}
div.bx-auth-reg span.bx-auth-secure {background-color:#FFFAE3; border:1px solid #DEDBC8; padding:2px; display:inline-block; vertical-align:middle;}
div.bx-auth-reg div.bx-auth-secure-icon {background-image:url(images/sec.png); background-repeat:no-repeat; background-position:center; width:19px; height:18px;}
div.bx-auth-reg div.bx-auth-secure-unlock {background-image:url(images/sec-unlocked.png);}

View file

@ -0,0 +1 @@
div.bx-auth-reg input.bx-auth-input{vertical-align:middle}div.bx-auth-reg span.bx-auth-secure{background-color:#fffae3;border:1px solid #dedbc8;padding:2px;display:inline-block;vertical-align:middle}div.bx-auth-reg div.bx-auth-secure-icon{background-image:url(images/sec.png);background-repeat:no-repeat;background-position:center;width:19px;height:18px}div.bx-auth-reg div.bx-auth-secure-unlock{background-image:url(images/sec-unlocked.png)}

View file

@ -0,0 +1,279 @@
<?
/**
* Bitrix Framework
* @package bitrix
* @subpackage main
* @copyright 2001-2014 Bitrix
*/
/**
* Bitrix vars
* @global CMain $APPLICATION
* @global CUser $USER
* @param array $arParams
* @param array $arResult
* @param CBitrixComponentTemplate $this
*/
if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)
die();
if($arResult["SHOW_SMS_FIELD"] == true)
{
CJSCore::Init('phone_auth');
}
?>
<div class="bx-auth-reg">
<?if($USER->IsAuthorized()):?>
<p><?echo GetMessage("MAIN_REGISTER_AUTH")?></p>
<?else:?>
<?
if (!empty($arResult["ERRORS"])):
foreach ($arResult["ERRORS"] as $key => $error)
if (intval($key) == 0 && $key !== 0)
$arResult["ERRORS"][$key] = str_replace("#FIELD_NAME#", "&quot;".GetMessage("REGISTER_FIELD_".$key)."&quot;", $error);
ShowError(implode("<br />", $arResult["ERRORS"]));
elseif($arResult["USE_EMAIL_CONFIRMATION"] === "Y"):
?>
<p><?echo GetMessage("REGISTER_EMAIL_WILL_BE_SENT")?></p>
<?endif?>
<?if($arResult["SHOW_SMS_FIELD"] == true):?>
<form method="post" action="<?=POST_FORM_ACTION_URI?>" name="regform">
<?
if($arResult["BACKURL"] <> ''):
?>
<input type="hidden" name="backurl" value="<?=$arResult["BACKURL"]?>" />
<?
endif;
?>
<input type="hidden" name="SIGNED_DATA" value="<?=htmlspecialcharsbx($arResult["SIGNED_DATA"])?>" />
<table>
<tbody>
<tr>
<td><?echo GetMessage("main_register_sms")?><span class="starrequired">*</span></td>
<td><input size="30" type="text" name="SMS_CODE" value="<?=htmlspecialcharsbx($arResult["SMS_CODE"])?>" autocomplete="off" /></td>
</tr>
</tbody>
<tfoot>
<tr>
<td></td>
<td><input type="submit" name="code_submit_button" value="<?echo GetMessage("main_register_sms_send")?>" /></td>
</tr>
</tfoot>
</table>
</form>
<script>
new BX.PhoneAuth({
containerId: 'bx_register_resend',
errorContainerId: 'bx_register_error',
interval: <?=$arResult["PHONE_CODE_RESEND_INTERVAL"]?>,
data:
<?=CUtil::PhpToJSObject([
'signedData' => $arResult["SIGNED_DATA"],
])?>,
onError:
function(response)
{
var errorDiv = BX('bx_register_error');
var errorNode = BX.findChildByClassName(errorDiv, 'errortext');
errorNode.innerHTML = '';
for(var i = 0; i < response.errors.length; i++)
{
errorNode.innerHTML = errorNode.innerHTML + BX.util.htmlspecialchars(response.errors[i].message) + '<br>';
}
errorDiv.style.display = '';
}
});
</script>
<div id="bx_register_error" style="display:none"><?ShowError("error")?></div>
<div id="bx_register_resend"></div>
<?else:?>
<form method="post" action="<?=POST_FORM_ACTION_URI?>" name="regform" enctype="multipart/form-data">
<?
if($arResult["BACKURL"] <> ''):
?>
<input type="hidden" name="backurl" value="<?=$arResult["BACKURL"]?>" />
<?
endif;
?>
<table>
<thead>
<tr>
<td colspan="2"><b><?=GetMessage("AUTH_REGISTER")?></b></td>
</tr>
</thead>
<tbody>
<?foreach ($arResult["SHOW_FIELDS"] as $FIELD):?>
<?if($FIELD == "AUTO_TIME_ZONE" && $arResult["TIME_ZONE_ENABLED"] == true):?>
<tr>
<td><?echo GetMessage("main_profile_time_zones_auto")?><?if ($arResult["REQUIRED_FIELDS_FLAGS"][$FIELD] == "Y"):?><span class="starrequired">*</span><?endif?></td>
<td>
<select name="REGISTER[AUTO_TIME_ZONE]" onchange="this.form.elements['REGISTER[TIME_ZONE]'].disabled=(this.value != 'N')">
<option value=""><?echo GetMessage("main_profile_time_zones_auto_def")?></option>
<option value="Y"<?=$arResult["VALUES"][$FIELD] == "Y" ? " selected=\"selected\"" : ""?>><?echo GetMessage("main_profile_time_zones_auto_yes")?></option>
<option value="N"<?=$arResult["VALUES"][$FIELD] == "N" ? " selected=\"selected\"" : ""?>><?echo GetMessage("main_profile_time_zones_auto_no")?></option>
</select>
</td>
</tr>
<tr>
<td><?echo GetMessage("main_profile_time_zones_zones")?></td>
<td>
<select name="REGISTER[TIME_ZONE]"<?if(!isset($_REQUEST["REGISTER"]["TIME_ZONE"])) echo 'disabled="disabled"'?>>
<?foreach($arResult["TIME_ZONE_LIST"] as $tz=>$tz_name):?>
<option value="<?=htmlspecialcharsbx($tz)?>"<?=$arResult["VALUES"]["TIME_ZONE"] == $tz ? " selected=\"selected\"" : ""?>><?=htmlspecialcharsbx($tz_name)?></option>
<?endforeach?>
</select>
</td>
</tr>
<?else:?>
<tr>
<td><?=GetMessage("REGISTER_FIELD_".$FIELD)?>:<?if ($arResult["REQUIRED_FIELDS_FLAGS"][$FIELD] == "Y"):?><span class="starrequired">*</span><?endif?></td>
<td><?
switch ($FIELD)
{
case "PASSWORD":
?><input size="30" type="password" name="REGISTER[<?=$FIELD?>]" value="<?=$arResult["VALUES"][$FIELD]?>" autocomplete="off" class="bx-auth-input" />
<?if($arResult["SECURE_AUTH"]):?>
<span class="bx-auth-secure" id="bx_auth_secure" title="<?echo GetMessage("AUTH_SECURE_NOTE")?>" style="display:none">
<div class="bx-auth-secure-icon"></div>
</span>
<noscript>
<span class="bx-auth-secure" title="<?echo GetMessage("AUTH_NONSECURE_NOTE")?>">
<div class="bx-auth-secure-icon bx-auth-secure-unlock"></div>
</span>
</noscript>
<script type="text/javascript">
document.getElementById('bx_auth_secure').style.display = 'inline-block';
</script>
<?endif?>
<?
break;
case "CONFIRM_PASSWORD":
?><input size="30" type="password" name="REGISTER[<?=$FIELD?>]" value="<?=$arResult["VALUES"][$FIELD]?>" autocomplete="off" /><?
break;
case "PERSONAL_GENDER":
?><select name="REGISTER[<?=$FIELD?>]">
<option value=""><?=GetMessage("USER_DONT_KNOW")?></option>
<option value="M"<?=$arResult["VALUES"][$FIELD] == "M" ? " selected=\"selected\"" : ""?>><?=GetMessage("USER_MALE")?></option>
<option value="F"<?=$arResult["VALUES"][$FIELD] == "F" ? " selected=\"selected\"" : ""?>><?=GetMessage("USER_FEMALE")?></option>
</select><?
break;
case "PERSONAL_COUNTRY":
case "WORK_COUNTRY":
?><select name="REGISTER[<?=$FIELD?>]"><?
foreach ($arResult["COUNTRIES"]["reference_id"] as $key => $value)
{
?><option value="<?=$value?>"<?if ($value == $arResult["VALUES"][$FIELD]):?> selected="selected"<?endif?>><?=$arResult["COUNTRIES"]["reference"][$key]?></option>
<?
}
?></select><?
break;
case "PERSONAL_PHOTO":
case "WORK_LOGO":
?><input size="30" type="file" name="REGISTER_FILES_<?=$FIELD?>" /><?
break;
case "PERSONAL_NOTES":
case "WORK_NOTES":
?><textarea cols="30" rows="5" name="REGISTER[<?=$FIELD?>]"><?=$arResult["VALUES"][$FIELD]?></textarea><?
break;
default:
if ($FIELD == "PERSONAL_BIRTHDAY"):?><small><?=$arResult["DATE_FORMAT"]?></small><br /><?endif;
?><input size="30" type="text" name="REGISTER[<?=$FIELD?>]" value="<?=$arResult["VALUES"][$FIELD]?>" /><?
if ($FIELD == "PERSONAL_BIRTHDAY")
$APPLICATION->IncludeComponent(
'bitrix:main.calendar',
'',
array(
'SHOW_INPUT' => 'N',
'FORM_NAME' => 'regform',
'INPUT_NAME' => 'REGISTER[PERSONAL_BIRTHDAY]',
'SHOW_TIME' => 'N'
),
null,
array("HIDE_ICONS"=>"Y")
);
?><?
}?></td>
</tr>
<?endif?>
<?endforeach?>
<?// ********************* User properties ***************************************************?>
<?if($arResult["USER_PROPERTIES"]["SHOW"] == "Y"):?>
<tr><td colspan="2"><?=trim($arParams["USER_PROPERTY_NAME"]) <> '' ? $arParams["USER_PROPERTY_NAME"] : GetMessage("USER_TYPE_EDIT_TAB")?></td></tr>
<?foreach ($arResult["USER_PROPERTIES"]["DATA"] as $FIELD_NAME => $arUserField):?>
<tr><td><?=$arUserField["EDIT_FORM_LABEL"]?>:<?if ($arUserField["MANDATORY"]=="Y"):?><span class="starrequired">*</span><?endif;?></td><td>
<?$APPLICATION->IncludeComponent(
"bitrix:system.field.edit",
$arUserField["USER_TYPE"]["USER_TYPE_ID"],
array("bVarsFromForm" => $arResult["bVarsFromForm"], "arUserField" => $arUserField, "form_name" => "regform"), null, array("HIDE_ICONS"=>"Y"));?></td></tr>
<?endforeach;?>
<?endif;?>
<?// ******************** /User properties ***************************************************?>
<?
/* CAPTCHA */
if ($arResult["USE_CAPTCHA"] == "Y")
{
?>
<tr>
<td colspan="2"><b><?=GetMessage("REGISTER_CAPTCHA_TITLE")?></b></td>
</tr>
<tr>
<td></td>
<td>
<input type="hidden" name="captcha_sid" value="<?=$arResult["CAPTCHA_CODE"]?>" />
<img src="/bitrix/tools/captcha.php?captcha_sid=<?=$arResult["CAPTCHA_CODE"]?>" width="180" height="40" alt="CAPTCHA" />
</td>
</tr>
<tr>
<td><?=GetMessage("REGISTER_CAPTCHA_PROMT")?>:<span class="starrequired">*</span></td>
<td><input type="text" name="captcha_word" maxlength="50" value="" autocomplete="off" /></td>
</tr>
<tr>
<td></td>
<td>
<label>
<input type="checkbox" name="UF_SUBSCRIBE_USER_EMAIL" id="checkbox_UF_SUBSCRIBE_USER_EMAIL"> <?=GetMessage("SUBSCRIBE_EMAIL")?>
</label>
</td>
</tr>
<?
}
/* !CAPTCHA */
?>
</tbody>
<tfoot>
<tr>
<td></td>
<td><input type="submit" name="register_submit_button" value="<?=GetMessage("AUTH_REGISTER")?>" /></td>
</tr>
</tfoot>
</table>
</form>
<p><?echo $arResult["GROUP_POLICY"]["PASSWORD_REQUIREMENTS"];?></p>
<?endif //$arResult["SHOW_SMS_FIELD"] == true ?>
<p><span class="starrequired">*</span><?=GetMessage("AUTH_REQ")?></p>
<?endif?>
</div>

View file

@ -74,19 +74,35 @@ trait InstallerTrait
$templateNames = [
'default_loyalty' => [
'sale.order.ajax',
'sale.basket.basket',
'main.register',
0 => [
'name' => 'sale.order.ajax',
'templateDirectory' => '.default'
],
1 => [
'name' => 'sale.basket.basket',
'templateDirectory' => '.default'
],
2 => [
'name' => 'main.register',
'templateDirectory' => '.default'
],
],
'default_subscribe' => [
'sale.personal.section'
0 => [
'name' => 'sale.personal.section',
'templateDirectory' => '.default'
],
1 => [
'name' => 'main.register',
'templateDirectory' => '.default_subscribe'
]
]
];
foreach ($templateNames as $directory => $names) {
foreach ($names as $name) {
$this->copy($directory, $name);
foreach ($templateNames as $directory => $templates) {
foreach ($templates as $template) {
$this->copy($directory, $template);
}
}
}
@ -234,16 +250,16 @@ trait InstallerTrait
}
}
private function copy($directory, $name): void
private function copy($directory, $template): void
{
$templatePath = $_SERVER['DOCUMENT_ROOT']
. '/local/templates/.default/components/bitrix/' . $name . '/'. $directory;
. '/local/templates/.default/components/bitrix/' . $template['name'] . '/'. $directory;
if (!file_exists($templatePath)) {
$pathFrom = $_SERVER['DOCUMENT_ROOT']
. '/bitrix/modules/intaro.retailcrm/install/export/local/components/intaro/'
. $name
. '/templates/.default';
. $template['name']
. '/templates/' . $template['templateDirectory'];
CopyDirFiles(
$pathFrom,

View file

@ -1090,24 +1090,31 @@ class UpdateSubscribe
$templateNames = [
'default_subscribe' => [
'sale.personal.section'
0 => [
'name' => 'sale.personal.section',
'templateDirectory' => '.default'
],
1 => [
'name' => 'main.register',
'templateDirectory' => '.default_subscribe'
]
]
];
foreach ($templateNames as $directory => $names) {
foreach ($names as $name) {
$lpTemplatePath = $_SERVER['DOCUMENT_ROOT']
. '/local/templates/.default/components/bitrix/' . $name . '/' . $directory;
foreach ($templateNames as $directory => $templates) {
foreach ($templates as $template) {
$templatePath = $_SERVER['DOCUMENT_ROOT']
. '/local/templates/.default/components/bitrix/' . $template['name'] . '/' . $directory;
if (!file_exists($lpTemplatePath)) {
if (!file_exists($templatePath)) {
$pathFrom = $_SERVER['DOCUMENT_ROOT']
. '/bitrix/modules/intaro.retailcrm/install/export/local/components/intaro/'
. $name
. '/templates/.default';
. $template['name']
. '/templates/' . $template['templateDirectory'];
CopyDirFiles(
$pathFrom,
$lpTemplatePath,
$templatePath,
true,
true,
false