36 lines
1.2 KiB
PHP
36 lines
1.2 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
use Bitrix\Main\Engine\CurrentUser;
|
|
use Bitrix\Main\Localization\Loc;
|
|
use Jinove\Vinoteca\Personal\Reviews;
|
|
|
|
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
|
|
die();
|
|
}
|
|
|
|
Loc::loadMessages(__FILE__);
|
|
|
|
class JinovePersonalReviewsComponent extends CBitrixComponent
|
|
{
|
|
public function executeComponent(): array
|
|
{
|
|
$userId = (int)CurrentUser::get()->getId();
|
|
if ($userId <= 0) {
|
|
LocalRedirect(SITE_DIR . "login/?back=" . rawurlencode(SITE_DIR . "personal/reviews/"));
|
|
}
|
|
$GLOBALS["APPLICATION"]->SetTitle(Loc::getMessage("VINO_REV_PAGE_TITLE"));
|
|
$GLOBALS["APPLICATION"]->SetPageProperty("description", Loc::getMessage("VINO_REV_PAGE_DESCRIPTION"));
|
|
$GLOBALS["APPLICATION"]->SetPageProperty("vino_alternates", "N");
|
|
$GLOBALS["APPLICATION"]->SetPageProperty("vino_schema", "N");
|
|
$GLOBALS["APPLICATION"]->SetPageProperty("robots", "noindex, nofollow");
|
|
$this->arResult = [
|
|
"REVIEWS" => Reviews::forUser($userId),
|
|
"CATALOG_URL" => SITE_DIR . "catalog/",
|
|
];
|
|
$this->includeComponentTemplate();
|
|
|
|
return $this->arResult;
|
|
}
|
|
}
|