This commit is contained in:
merelendor 2022-09-08 14:23:22 +03:00
parent df30f5b6f2
commit b539e0086c
12 changed files with 574 additions and 221 deletions

View File

@ -1260,6 +1260,29 @@ switch($PARAM_1)
} }
break; break;
case "vizitka":
{
//define("LOG_FILENAME", $_SERVER["DOCUMENT_ROOT"]."/vizitka/tmp/log.txt");
//AddMessage2Log("_REQUEST['guid'] => ".$_REQUEST['guid'], "my_module_id");
$c = curl_init();
curl_setopt($c, CURLOPT_URL, API_HOST."/site/GetUserBusinessCard/?guid=".$_REQUEST['guid']);
curl_setopt($c, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($c, CURLOPT_TIMEOUT, 30);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($c, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($c, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
$response = curl_exec($c) or die(curl_error($c));
curl_close($c);
print $response;
die();
}
break;
default: default:
{ {
print json_encode([]); print json_encode([]);

View File

@ -1 +1 @@
<pre>1 => MO1</pre><pre>2 => SP1</pre><pre>3 => BN1</pre><pre>4 => BG1</pre><pre>5 => VL1</pre><pre>6 => VR1</pre><pre>7 => EK1</pre><pre>8 => IR1</pre><pre>9 => KZ1</pre><pre>10 => KG1</pre><pre>11 => KL1</pre><pre>12 => KM1</pre><pre>13 => KR1</pre><pre>14 => KS2</pre><pre>15 => KS1</pre><pre>16 => LP1</pre><pre>17 => NC1</pre><pre>18 => NN1</pre><pre>19 => NV1</pre><pre>20 => NR1</pre><pre>21 => NS1</pre><pre>22 => OM1</pre><pre>23 => OR1</pre><pre>24 => PR1</pre><pre>25 => RD1</pre><pre>26 => RZ1</pre><pre>27 => SM1</pre><pre>28 => SR1</pre><pre>29 => SC1</pre><pre>30 => SK1</pre><pre>31 => ST1</pre><pre>32 => SG1</pre><pre>33 => TL1</pre><pre>34 => TM1</pre><pre>35 => UF1</pre><pre>36 => CB1</pre><pre>37 => CL1</pre><pre>38 => YR1</pre><pre></pre><pre></pre>Ok! Сохранено по <a href='https://www.evoleasing.ru/upload/docs/yasprav.xml'>ссылке!</a> 29.08.2022 <pre>1 => MO1</pre><pre>2 => SP1</pre><pre>3 => BN1</pre><pre>4 => BG1</pre><pre>5 => VL1</pre><pre>6 => VR1</pre><pre>7 => EK1</pre><pre>8 => IR1</pre><pre>9 => KZ1</pre><pre>10 => KG1</pre><pre>11 => KL1</pre><pre>12 => KM1</pre><pre>13 => KR1</pre><pre>14 => KS2</pre><pre>15 => KS1</pre><pre>16 => LP1</pre><pre>17 => NC1</pre><pre>18 => NN1</pre><pre>19 => NV1</pre><pre>20 => NR1</pre><pre>21 => NS1</pre><pre>22 => OM1</pre><pre>23 => OR1</pre><pre>24 => PR1</pre><pre>25 => RD1</pre><pre>26 => RZ1</pre><pre>27 => SM1</pre><pre>28 => SR1</pre><pre>29 => SC1</pre><pre>30 => SK1</pre><pre>31 => ST1</pre><pre>32 => SG1</pre><pre>33 => TL1</pre><pre>34 => TU1</pre><pre>35 => TM1</pre><pre>36 => UF1</pre><pre>37 => CB1</pre><pre>38 => CL1</pre><pre>39 => YR1</pre><pre></pre><pre></pre>Ok! Сохранено по <a href='https://www.evoleasing.ru/upload/docs/yasprav.xml'>ссылке!</a> 08.09.2022

View File

@ -0,0 +1,116 @@
<?
if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true) die();
/** @var CBitrixComponent $this */
/** @var array $arParams */
/** @var array $arResult */
/** @var string $componentPath */
/** @var string $componentName */
/** @var string $componentTemplate */
/** @global CDatabase $DB */
/** @global CUser $USER */
/** @global CMain $APPLICATION */
use Bitrix\Main\Context,
Bitrix\Main\Type\DateTime,
Bitrix\Main\Loader,
Bitrix\Iblock;
require_once($_SERVER["DOCUMENT_ROOT"].'/bitrix/php_interface/phpqrcode/qrlib.php');
$object = json_decode(file_get_contents("https://evoleasing.ru/api/vizitka/?guid=".$arParams['guid']));
//define("LOG_FILENAME", $_SERVER["DOCUMENT_ROOT"]."/vizitka/tmp/log2.txt");
//AddMessage2Log("object => ".print_r($object, true)."\narParams => ".print_r($arParams, true), "my_module_id");
//$ourData = file_get_contents($_SERVER["DOCUMENT_ROOT"]."/vizitka/data.json");
//$object = json_decode($ourData);
//Очищаем временную директорию от файлоы старше 2 дней
$tmpfolders = $_SERVER["DOCUMENT_ROOT"].'/vizitka/tmp/';
$fileSystemIterator = new FilesystemIterator($tmpfolders);
$now = time();
foreach ($fileSystemIterator as $file) {
if ($now - $file->getCTime() >= 60 * 60 * 24 * 2) // 2 days
unlink($tmpfolders.$file->getFilename());
}
//Разбираем данные из json
//if ($arParams["guid"] & $object->firstName) {
if ($object->firstName) {
$arParams["name"] = $object->firstName;
$arParams["family"] = $object->secondName;
$arParams["post"] = $object->post;
$arParams["dept"] = $object->department;
$arParams["company"] = "Эволюция Автолизинга";
$arParams["mob"] = $object->mobilePhone;
$arParams["mobcl"] = preg_replace('/[^0-9]/', '', $arParams["mob"]);
$arParams["tel"] = $object->workPhone;
$arParams["telcl"] = preg_replace('/[^0-9]/', '', $arParams["tel"]);
$arParams["teladd"] = $object->workPhoneCode;
$arParams["mail"] = $object->email;
$arParams["address"] = $object->address;
$arParams["whatsapp"] = $object->whatsAppOn;
$arParams["telegram"] = $object->telegram;
$arParams["www"] = "https://www.evoleasing.ru";
$arParams["image"] = $object->image;
//VCF для QR кода
$qrtext = 'BEGIN:VCARD
VERSION:4.0
N;CHARSET=UTF-8:'.$arParams["family"].';'.$arParams["name"].';;;
FN;CHARSET=UTF-8:'.$arParams["name"].' '.$arParams["family"].'
TITLE;CHARSET=UTF-8:'.$arParams["post"].'
EMAIL:'.$arParams["mail"].'
ORG;CHARSET=UTF-8:'.$arParams["company"].';'.$arParams["dept"].'
TEL;type=CELL:'.$arParams["mob"].'
URL;type=PREF:'.$arParams["www"].'
LANG:ru-RU
END:VCARD';
$qrimg = QRcode::png($qrtext, $_SERVER["DOCUMENT_ROOT"].'/vizitka/tmp/'.$arParams["guid"].'.png', 'L', 3, 2);
//$im = imagecreatefrompng($_SERVER["DOCUMENT_ROOT"].'/vizitka/tmp/'.$arParams["guid"].'.png');
//Формируем vcf файл визитки для телефонов
$arParams["vcarddata"] = 'BEGIN:VCARD
VERSION:4.0
N;CHARSET=UTF-8:'.$arParams["family"].';'.$arParams["name"].';;;
FN;CHARSET=UTF-8:'.$arParams["name"].' '.$arParams["family"].'
TITLE;CHARSET=UTF-8:'.$arParams["post"].'
EMAIL:'.$arParams["mail"].'
ORG;CHARSET=UTF-8:'.$arParams["company"].';'.$arParams["dept"].'
TEL;type=CELL:'.$arParams["mob"].'
URL;type=PREF:'.$arParams["www"].'
PHOTO;ENCODING=BASE64;TYPE=JPEG:'.$arParams["image"].'
LANG:ru-RU
END:VCARD';
$arParams["vcarddata"] = mb_convert_encoding($arParams["vcarddata"], "UTF-8");
$arParams["vcffile"] = './tmp/'.$arParams["guid"].'.vcf';
$fp = fopen($arParams["vcffile"], "w");
fwrite($fp, $arParams["vcarddata"]);
fclose($fp);
//Формируем vcf файл визитки для компьютера
$arParams["vcarddatawin"] = 'BEGIN:VCARD
VERSION:4.0
N;CHARSET=windows-1252:'.$arParams["family"].';'.$arParams["name"].';;;
FN;CHARSET=windows-1252:'.$arParams["name"].' '.$arParams["family"].'
TITLE;CHARSET=windows-1252:'.$arParams["post"].'
EMAIL:'.$arParams["mail"].'
ORG;CHARSET=windows-1252:'.$arParams["company"].';'.$arParams["dept"].'
TEL;type=CELL:'.$arParams["mob"].'
URL;type=PREF:'.$arParams["www"].'
PHOTO;ENCODING=BASE64;TYPE=JPEG:'.$arParams["image"] .'
LANG:ru-RU
END:VCARD';
$arParams["vcarddatawin"] = iconv("utf-8", "windows-1251", $arParams["vcarddatawin"]);
$arParams["vcffilewin"] = './tmp/'.$arParams["guid"].'-win.vcf';
$fp = fopen($arParams["vcffilewin"], "w");
fwrite($fp, $arParams["vcarddatawin"]);
fclose($fp);
}
$this->IncludeComponentTemplate();

View File

@ -0,0 +1,186 @@
var calculation = { car_price: 0, CAR_PRICE_MIN: 0, CAR_PRICE_MAX:0, initial_payment: 0, lease_period: 0, monthly_payment: 0, redemption_payment: 0, tax_savings: 0, vat_reimbursement: 0 };
function calculator(props)
{
for(let i in calculation)
{
calculation[i] = parseInt(props[i], 10);
}
$("#FORM_FIELD_PRICE").val(calculation.car_price);
$("#FORM_FIELD_PREPAID").val(calculation.initial_payment);
$("#FORM_FIELD_TERM").val(calculation.lease_period);
$("#FORM_FIELD_REDEMPTION").val(calculation.redemption_payment);
}
function calculate(param, value)
{
if(param !== undefined)
{
calculation[param] = value;
}
$("#FORM_FIELD_PRICE").val(calculation.car_price);
$("#FORM_FIELD_PREPAID").val(calculation.initial_payment);
$("#FORM_FIELD_TERM").val(calculation.lease_period);
$("#FORM_FIELD_REDEMPTION").val(calculation.redemption_payment);
$.post("/api/calculation/",
{
car_price: calculation.car_price,
initial_payment: calculation.initial_payment,
lease_period: calculation.lease_period,
redemption_payment: calculation.redemption_payment,
}, function(response)
{
for(let i in response)
{ calculation[i] = parseInt(response[i], 10); }
$("#calculator_monthly_payment_value").text(calculation['monthly_payment'].toLocaleString());
$("#calculator_tax_savings_value").text((calculation['tax_savings'] + calculation['vat_reimbursement']).toLocaleString());
$("#calculator_tax_savings_percent").text(Math.round((calculation['tax_savings']+calculation['vat_reimbursement']) / (calculation['car_price'] / 100)));
}, "json");
}
function calculator_car_price_save()
{
var v = parseInt($("#calculator_car_price_input").val(), 10);
console.log(v, calculation['CAR_PRICE_MIN'], calculation['CAR_PRICE_MAX']);
if(v >= calculation['CAR_PRICE_MIN'] && v <= calculation['CAR_PRICE_MAX'])
{
var $input_range_car_price = $(`#calculation_car_price`);
$input_range_car_price.val(v).change();
calculate('car_price', v);
$("#calculator_car_price_text").show();
$("#calculator_car_price_editor").hide();
}
else
{
$("#calculator_car_price_text").show();
$("#calculator_car_price_editor").hide();
}
}
$(function()
{
var $document = $(document);
var selector = '[data-rangeslider]';
var $element = $(selector);
// For ie8 support
var textContent = ('textContent' in document) ? 'textContent' : 'innerText';
// Example functionality to demonstrate a value feedback
function valueOutput(element)
{
var value = element.value;
var output = element.parentNode.getElementsByTagName('output')[0] || element.parentNode.parentNode.getElementsByTagName('output')[0];
if($(element).data('slider-name') === "car_price")
{
output[textContent] = parseInt(value, 10).toLocaleString();
}
else
{
output[textContent] = value;
}
}
$document.on('input', 'input[type="range"], ' + selector, function(e)
{
valueOutput(e.target);
});
// Example functionality to demonstrate disabled functionality
$document.on('click', '#js-example-disabled button[data-behaviour="toggle"]', function(e)
{
var $inputRange = $(selector, e.target.parentNode);
if ($inputRange[0].disabled) {
$inputRange.prop("disabled", false);
}
else {
$inputRange.prop("disabled", true);
}
$inputRange.rangeslider('update');
});
// Example functionality to demonstrate programmatic value changes
$document.on('click', '#js-example-change-value button', function(e) {
var $inputRange = $(selector, e.target.parentNode);
var value = $('input[type="number"]', e.target.parentNode)[0].value;
$inputRange.val(value).change();
});
// Example functionality to demonstrate programmatic attribute changes
$document.on('click', '#js-example-change-attributes button', function(e)
{
var $inputRange = $(selector, e.target.parentNode);
var attributes = {
min: $('input[name="min"]', e.target.parentNode)[0].value,
max: $('input[name="max"]', e.target.parentNode)[0].value,
step: $('input[name="step"]', e.target.parentNode)[0].value
};
$inputRange.attr(attributes);
$inputRange.rangeslider('update', true);
});
// Example functionality to demonstrate destroy functionality
$document
.on('click', '#js-example-destroy button[data-behaviour="destroy"]', function(e) {
$(selector, e.target.parentNode).rangeslider('destroy');
})
.on('click', '#js-example-destroy button[data-behaviour="initialize"]', function(e) {
$(selector, e.target.parentNode).rangeslider({ polyfill: false });
});
// Example functionality to test initialisation on hidden elements
$document.on('click', '#js-example-hidden button[data-behaviour="toggle"]', function(e) {
var $container = $(e.target.previousElementSibling);
$container.toggle();
});
// Basic rangeslider initialization
$element.rangeslider({
// Deactivate the feature detection
polyfill: false,
// Callback function
onInit: function() {
valueOutput(this.$element[0]);
},
// Callback function
onSlide: function(position, value) {
//console.log('onSlide');
//console.log('position: ' + position, 'value: ' + value);
},
// Callback function
onSlideEnd: function(position, value)
{
calculate(this.$element.attr('data-slider-name'), value);
//console.log('position: ' + position, 'value: ' + value);
}
});
$("#calculator_car_price_text").on("click", function()
{
$("#calculator_car_price_input").val(parseInt(calculation.car_price, 10));
$("#calculator_car_price_text").hide();
$("#calculator_car_price_editor").show();
});
$("#calculator_car_price_save").on("click", function()
{
calculator_car_price_save();
});
$("#calculator_car_price_input").on("keydown", function(event)
{
if(event.keyCode === 13)
{
event.preventDefault();
calculator_car_price_save();
}
});
});

View File

@ -0,0 +1,37 @@
.offer_item_boston {
width: auto !important;
padding-bottom: 30px;
position: relative;
}
.offer_item_boston img{
border-radius: 50%;
}
.offer_item {
width: auto !important;
padding-left: 0 !important;
padding-right: 20px;
}
.leasing_offers_list {
margin-top: 30px !important;
}
.offer_item .qrimage {
position: relative !important;
width: auto !important;
height: auto !important;
}
.offer_item .vcfbutton {
background-color: #1c01a9;
color: #fff;
padding: 5px 15px;
width: fit-content;
font-weight: bold;
}
.messenger {
position: relative !important;
width: 30px;
height: 30px;
vertical-align: bottom;
}
.withoutform {
margin-top: 40px;
}

View File

@ -0,0 +1,84 @@
<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
/** @var array $arParams */
/** @var array $arResult */
/** @global CMain $APPLICATION */
/** @global CUser $USER */
/** @global CDatabase $DB */
/** @var CBitrixComponentTemplate $this */
/** @var string $templateName */
/** @var string $templateFile */
/** @var string $templateFolder */
/** @var string $componentPath */
/** @var CBitrixComponent $component */
$this->setFrameMode(true);
?>
<pre><?//print_r($arResult);?></pre>
<pre><?//print_r($arParams);?></pre>
<?if ($arParams["guid"] & $arParams["name"]) {?>
<section class="gray">
<div class="container">
<h2><span style="color: #1c01a9;"><?=$arParams["name"]?> <?=$arParams["family"]?></span></h2>
<p><b><?=$arParams["post"]?></b></p>
<p><?=$arParams["dept"]?></p>
<div class="leasing_offers_list">
<div class="offer_item_boston">
<?if($arParams["image"]){?>
<img src="data:image/jpeg;base64,<?=$arParams["image"]?>" alt="" />
<?}else{?>
<img src="/vizitka/img/facelogo.png" alt="" />
<?}?>
</div>
<div class="offer_item">
<p>
<b>Свяжитесь со мной</b>
</p>
<p>
<?if($arParams["mob"]){?><a href="tel:+<?=$arParams["mobcl"];?>"><?=$arParams["mob"];?> </a><?}?>
<?if(($arParams["whatsapp"]=true) && ($arParams["mob"])){?><a href="https://wa.me/<?=$arParams["mobcl"];?>" target="_blank"><img class="messenger" src="./img/WhatsApp.svg" /></a><?}?>
<?if($arParams["telegram"]){?><a href="https://t.me/<?=$arParams["telegram"];?>" target="_blank"><img class="messenger" src="./img/Telegram.svg" /></a><?}?>
</p>
<?if($arParams["tel"]){?><p><a href="tel:+<?=$arParams["telcl"];?>"><?=$arParams["tel"];?></a> <?if($arParams["teladd"]){?>доб. <?=$arParams["teladd"];?></p><?}}?>
<?if($arParams["mail"]){?><p><a href="mailto:<?=$arParams["mail"];?>"><?=$arParams["mail"];?></a></p><?}?>
<?if($arParams["address"]){?><p><?=$arParams["address"];?></p><?}?>
<a href=<?=$arParams["vcffile"]?>>
<p class="vcfbutton">Скачать визитку на телефон .vcf</p>
</a>
<a href=<?=$arParams["vcffilewin"]?>>
<p class="vcfbutton">Скачать визитку на компьютер .vcf</p>
</a>
</div>
<div class="offer_item">
<p>
<b>Сохраните контакт на телефон</b>
</p>
<img class="qrimage" src="./tmp/<?=$arParams["guid"]?>.png" />
</div>
</div></div>
</section>
<?} else {?>
<section class="gray">
<div class="container">
<div class="leasing_offers_list">
<div class="offer_item">
<p style="font-size: 2rem; line-height: 2rem;">
<b>Упс! Такой<br />визитки<br />не существует</b>
</p>
</div>
<div class="offer_item">
<p style="font-size: 2rem; line-height: 2rem;">
<b>Просто позвоните<br />по номеру<br /><a href="tel:88003337575">8&nbsp;800&nbsp;333&nbsp;75&nbsp;75</a></b>
</p>
</div>
<div class="offer_item">
<p style="font-size: 2rem; line-height: 2rem;">
<b>или отправьте<br />заявку на лизинг<br />из формы ниже</b>
</p>
</div>
</div>
</div>
</section>
<?}?>

113
local/users_to_clients.php Normal file
View File

@ -0,0 +1,113 @@
<?
//$_SERVER["DOCUMENT_ROOT"] = __DIR__;
define('STOP_STATISTICS', true);
define('NO_KEEP_STATISTIC', 'Y');
define('NO_AGENT_STATISTIC', 'Y');
define('DisableEventsCheck', true);
define('BX_SECURITY_SHOW_MESSAGE', true);
define('NOT_CHECK_PERMISSIONS', true);
$_SERVER['DOCUMENT_ROOT'] = dirname(__DIR__, 1);
require_once($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/main/include/prolog_before.php');
CModule::IncludeModule('iblock');
$users_res = CUser::GetList([ 'sort' => 'asc' ], 'desc', [], [ "SELECT" => [ "UF_*" ] ]);
while($user = $users_res->Fetch())
{
print "user_id = ".$user['ID']."\n";
if($user['ID'] != 1)
{
$user_properties = [
'COMPANY' => $user['UF_ORG_TITLE'],
'INN' => $user['UF_INN'],
'KPP' => $user['UF_KPP'],
'OGRN' => $user['UF_UF_OGRN'],
'ADMINS' => [ $user['ID'] ],
'USERS' => [ $user['ID'] ],
];
$ar_new_client = [
'IBLOCK_ID' => IBLOCK_ID_CLIENTS,
'NAME' => $user['UF_ORG_TITLE'],
'CODE' => $user['XML_ID'],
'PROPERTY_VALUES' => $user_properties,
'ACTIVE' => 'Y', // активен
];
$new_client = new CIBlockElement;
if($new_client_id = $new_client->Add($ar_new_client))
{
print "New ID: ".$new_client_id."\n\n";
}
else
{
print "Error: ".$new_client->LAST_ERROR."\n\n";
print "EXISTED USER: \n\n";
$existed_client_res = CIBlockElement::GetList([ 'id' => 'desc' ], [ 'IBLOCK_ID' => IBLOCK_ID_CLIENTS, 'CODE' => $user['XML_ID'] ], false, []);
while ($existed_client_element = $existed_client_res->GetNextElement())
{
$existed_client_record = $existed_client_element->GetFields();
$existed_client_record['PROPERTIES'] = $existed_client_element->GetProperties();
$admins = $existed_client_record['PROPERTIES']['ADMINS']['VALUE'];
$users = $existed_client_record['PROPERTIES']['USERS']['VALUE'];
array_push($admins, $user['ID']);
array_push($users, $user['ID']);
$admins = array_unique($admins);
$users = array_unique($users);
$updated_fields = [
'PROPERTY_VALUES' => [
'ADMINS' => $admins,
'USERS' => $users,
]
];
CIBlockElement::SetPropertyValuesEx($existed_client_record['ID'], IBLOCK_ID_CLIENTS, [ 'ADMINS' => $admins, 'USERS' => $users, ]);
print $existed_client_record['CODE']." UPDATED\n\n";
/*
if($ai = array_search(20, $admins))
{
array_splice($admins, $ai, 1);
}
if($ai = array_search(20, $users))
{
array_splice($users, $ai, 1);
}
*/
/*
$updated_client = new CIBlockElement;
if($updated_client_result = $updated_client->Update($existed_client_record['ID'], $updated_fields))
{
print "UPDATED\n\n";
}
else
{
print "UPDATE ERROR: ".$updated_client->LAST_ERROR."\n\n";
}
*/
//print_r($existed_client_record);
}
}
/*
$rules_res = CIBlockElement::GetList([ 'id' => 'desc' ], [ 'PROPERTY_USER.' => '' ], false, $options);
while ($rules_ob_element = $rules_res->GetNextElement())
{
$rules_ar_res = $rules_ob_element->GetFields();
$rules_ar_res['PROPERTIES'] = $rules_ob_element->GetProperties();
}
*/
}
}
die();
?>

View File

@ -0,0 +1 @@
mailru-domain: 4Ghb7ZTpPY5uXUCS

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

File diff suppressed because one or more lines are too long

View File

@ -1,224 +1,30 @@
<? <?
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/header.php"); require($_SERVER["DOCUMENT_ROOT"]."/bitrix/header.php");
$APPLICATION->SetTitle("Эволюция автолизинга: Приятно познакомиться"); $APPLICATION->SetTitle("Эволюция автолизинга: Приятно познакомиться");
require_once($_SERVER["DOCUMENT_ROOT"].'/bitrix/php_interface/phpqrcode/qrlib.php');
?> ?>
<? <section data-page="about">
<?
$request = \Bitrix\Main\Context::getCurrent()->getRequest(); $request = \Bitrix\Main\Context::getCurrent()->getRequest();
$request->getQueryList()->toArray(); $request->getQueryList()->toArray();
$guid = $request->get("userid"); $guid = $request->get("user");
$ourData = file_get_contents("data.json"); $APPLICATION->IncludeComponent(
$object = json_decode($ourData); "evolution:vizitka",
"",
Array(
"guid" => $guid,
)
); ?>
//Очищаем временную директорию от файлоы старше 2 дней
$tmpfolders = $_SERVER["DOCUMENT_ROOT"].'/vizitka/tmp/';
$fileSystemIterator = new FilesystemIterator($tmpfolders);
$now = time();
foreach ($fileSystemIterator as $file) {
if ($now - $file->getCTime() >= 60 * 60 * 24 * 2) // 2 days
unlink($tmpfolders.$file->getFilename());
}
?>
<style>
.offer_item_boston {
#width: calc(33% - 20px);
width: auto !important;
padding-bottom: 30px;
#margin-right: 40px;
position: relative;
}
.offer_item_boston img{
border-radius: 50%;
#margin-left: 42px;
#margin-top: 15px;
}
.offer_item {
width: auto !important;
padding-left: 0 !important;
padding-right: 20px;
}
.leasing_offers_list {
margin-top: 30px;
#margin-bottom: 60px;
}
.offer_item .qrimage {
position: relative !important;
width: 260px !important;
height: 260px !important;
}
.offer_item .vcfbutton {
background-color: #1c01a9;
color: #fff;
padding: 5px 15px;
width: fit-content;
font-weight: bold;
}
.messenger {
position: relative !important;
width: 30px;
height: 30px;
vertical-align: bottom;
}
</style>
<section data-page="about">
<?
//Разбираем данные из json
if ($guid & $object->fullName) {
$name = $object->fullName;
$post = $object->post;
$dept = $object->department;
$company = "Эволюция Автолизинга";
$mob = $object->mobilePhone;
$mobcl = preg_replace('/[^0-9]/', '', $mob);
$tel = $object->workPhone;
$telcl = preg_replace('/[^0-9]/', '', $tel);
$teladd = $object->workPhoneCode;
$mail = $object->email;
$address = $object->address;
$whatsapp = $object->whatsAppOn;
$telegram = $object->telegram;
$www = "https://www.evoleasing.ru";
//VCF для QR кода
$qrtext = 'BEGIN:VCARD
VERSION:4.0
N;CHARSET=UTF-8:;'.$name.';;;
FN;CHARSET=UTF-8:'.$name.'
TITLE;CHARSET=UTF-8:'.$post.'
EMAIL:'.$mail.'
ORG;CHARSET=UTF-8:'.$company.'
TEL:'.$mob.'
URL;type=PREF:'.$www.'
LANG:ru-RU
END:VCARD';
$qrimg = QRcode::png($qrtext, $_SERVER["DOCUMENT_ROOT"].'/vizitka/tmp/'.$guid.'.png', 'L', 4, 2);
$im = imagecreatefrompng($_SERVER["DOCUMENT_ROOT"].'/vizitka/tmp/'.$guid.'.png');
//Формируем vcf файл визитки для телефонов
$vcarddata = 'BEGIN:VCARD
VERSION:4.0
N;CHARSET=UTF-8:;'.$name.';;;
FN;CHARSET=UTF-8:'.$name.'
TITLE;CHARSET=UTF-8:'.$post.'
EMAIL:'.$mail.'
ORG;CHARSET=UTF-8:'.$company.'
TEL:'.$mob.'
URL;type=PREF:'.$www.'
PHOTO;ENCODING=BASE64;TYPE=JPEG:'.$object->image.'
LANG:ru-RU
END:VCARD';
$vcarddata = mb_convert_encoding($vcarddata, "UTF-8");
$vcffile = './tmp/'.$guid.'.vcf';
$fp = fopen($vcffile, "w");
fwrite($fp, $vcarddata);
fclose($fp);
//Формируем vcf файл визитки для компьютера
$vcarddatawin = 'BEGIN:VCARD
VERSION:4.0
N;CHARSET=windows-1252:;'.$name.';;;
FN;CHARSET=windows-1252:'.$name.'
TITLE;CHARSET=windows-1252:'.$post.'
EMAIL:'.$mail.'
ORG;CHARSET=windows-1252:'.$company.'
TEL:'.$mob.'
URL;type=PREF:'.$www.'
PHOTO;ENCODING=BASE64;TYPE=JPEG:'.$object->image.'
LANG:ru-RU
END:VCARD';
$vcarddatawin = iconv("utf-8", "windows-1251", $vcarddatawin);
$vcffilewin = './tmp/'.$guid.'-win.vcf';
$fp = fopen($vcffilewin, "w");
fwrite($fp, $vcarddatawin);
fclose($fp);
//Дальше вёрстка
?>
<section class="gray">
<div class="container">
<h2><span style="color: #1c01a9;"><?=$name?></span></h2>
<p><b><?=$post?></b></p>
<p><?=$dept?></p>
<div class="leasing_offers_list">
<div class="offer_item_boston">
<?if($object->image){?>
<img src="data:image/jpeg;base64,<?=$object->image;?>" alt="" />
<?}else{?>
<img src="./img/facelogo.png" alt="" />
<?}?>
</div>
<div class="offer_item">
<p>
<b>Свяжитесь со мной</b>
</p>
<p>
<?if($mob){?><a href="tel:+<?=$mobcl;?>"><?=$mob;?> </a><?}?>
<?if($whatsapp=true){?><a href="https://wa.me/<?=$mobcl;?>" target="_blank"><img class="messenger" src="./img/WhatsApp.svg" /></a><?}?>
<?if($telegram){?><a href="https://t.me/<?=$telegram;?>" target="_blank"><img class="messenger" src="./img/Telegram.svg" /></a><?}?>
</p>
<?if($tel){?><p><a href="tel:+<?=$telcl;?>"><?=$tel;?></a> доб. <?=$teladd;?></p><?}?>
<?if($mail){?><p><a href="mailto:<?=$mail;?>"><?=$mail;?></a></p><?}?>
<?if($address){?><p><?=$address;?></p><?}?>
<a href=<?=$vcffile?>>
<p class="vcfbutton">Скачать визитку на телефон .vcf</p>
</a>
<a href=<?=$vcffilewin?>>
<p class="vcfbutton">Скачать визитку на компьютер .vcf</p>
</a>
</div>
<div class="offer_item">
<p>
<b>Сохраните контакт на телефон</b>
</p>
<img class="qrimage" src="./tmp/<?=$guid?>.png" />
</div>
</div></div>
</section>
<?} else {?>
<section class="gray">
<div class="container">
<div class="leasing_offers_list">
<div class="offer_item">
<p style="font-size: 2rem; line-height: 2rem;">
<b>Такой<br />визитки<br />не существует</b>
</p>
</div>
<div class="offer_item">
<p style="font-size: 2rem; line-height: 2rem;">
<b>Просто позвоните<br />по номеру<br /><a href="tel:88003337575">8&nbsp;800&nbsp;333&nbsp;75&nbsp;75</a></b>
</p>
</div>
<div class="offer_item">
<p style="font-size: 2rem; line-height: 2rem;">
<b>или отправьте<br />заявку на лизинг<br />из формы ниже</b>
</p>
</div>
</div>
</div>
</section>
<?}?>
<article> <article>
<!--
<?$APPLICATION->IncludeComponent( <?$APPLICATION->IncludeComponent(
"evolution:form.leasing.nomail", "evolution:form.leasing.nomail",
"", "",
Array() Array()
);?> );?>
-->
<div class="withoutform"><br /></div>
</article> </article>
</section> </section>