38 lines
1.4 KiB
PHP
38 lines
1.4 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
use Bitrix\Main\Engine\CurrentUser;
|
|
use Bitrix\Main\Localization\Loc;
|
|
use Bitrix\Main\UserTable;
|
|
|
|
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
|
|
die();
|
|
}
|
|
|
|
Loc::loadMessages(__FILE__);
|
|
|
|
class JinoveProfileComponent extends CBitrixComponent
|
|
{
|
|
public function executeComponent(): array
|
|
{
|
|
$userId = (int)CurrentUser::get()->getId();
|
|
if ($userId <= 0) {
|
|
LocalRedirect(SITE_DIR . "login/?back=" . rawurlencode(SITE_DIR . "personal/"));
|
|
}
|
|
$row = UserTable::getRow(["select" => ["NAME", "EMAIL", "PERSONAL_PHONE"], "filter" => ["=ID" => $userId]]) ?? [];
|
|
$GLOBALS["APPLICATION"]->SetTitle(Loc::getMessage("VINO_CAB_PAGE_TITLE"));
|
|
$GLOBALS["APPLICATION"]->SetPageProperty("description", Loc::getMessage("VINO_CAB_PAGE_DESCRIPTION"));
|
|
$GLOBALS["APPLICATION"]->SetPageProperty("vino_alternates", "N");
|
|
$GLOBALS["APPLICATION"]->SetPageProperty("vino_schema", "N");
|
|
$GLOBALS["APPLICATION"]->SetPageProperty("robots", "noindex, nofollow");
|
|
$this->arResult = [
|
|
"NAME" => (string)($row["NAME"] ?? ""),
|
|
"EMAIL" => (string)($row["EMAIL"] ?? ""),
|
|
"PHONE" => preg_replace('/^\+7(\d{3})(\d{3})(\d{2})(\d{2})$/', '+7 $1 $2 $3 $4', (string)($row["PERSONAL_PHONE"] ?? "")),
|
|
];
|
|
$this->includeComponentTemplate();
|
|
|
|
return $this->arResult;
|
|
}
|
|
}
|