47 lines
2.7 KiB
PHP
47 lines
2.7 KiB
PHP
<?php
|
|
use Bitrix\Main\Localization\Loc;
|
|
|
|
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
|
|
die();
|
|
}
|
|
|
|
Loc::loadMessages(__FILE__);
|
|
$this->addExternalCss("/local/components/jinove/personal.profile/templates/.default/style.css");
|
|
$stars = static function (int $filled): string {
|
|
$out = "";
|
|
for ($i = 1; $i <= 5; $i++) {
|
|
$out .= '<span class="vino-stars__star' . ($i <= $filled ? " vino-stars__star--full" : "") . '"></span>';
|
|
}
|
|
|
|
return $out;
|
|
};
|
|
?>
|
|
<section class="vino-cab">
|
|
<?php $APPLICATION->IncludeComponent("jinove:personal.nav", ".default", ["ACTIVE" => "reviews"]); ?>
|
|
<div class="vino-cab__main">
|
|
<h1 class="vino-cab__title"><?= Loc::getMessage("VINO_REV_TITLE") ?></h1>
|
|
<?php if (!$arResult["REVIEWS"]): ?>
|
|
<div class="vino-cab__panel vino-cab__empty">
|
|
<p class="vino-cab__empty-text"><?= Loc::getMessage("VINO_REV_EMPTY") ?></p>
|
|
<a class="vino-btn" href="<?= htmlspecialcharsbx($arResult["CATALOG_URL"]) ?>"><?= Loc::getMessage("VINO_REV_TO_CATALOG") ?></a>
|
|
</div>
|
|
<?php else: ?>
|
|
<ul class="vino-cab-list">
|
|
<?php foreach ($arResult["REVIEWS"] as $review): ?>
|
|
<li class="vino-cab-card">
|
|
<div class="vino-cab-card__head">
|
|
<p class="vino-cab-card__title"><?php if ($review["url"] !== ""): ?><a class="vino-cab-card__name" href="<?= htmlspecialcharsbx($review["url"]) ?>"><?= htmlspecialcharsbx($review["name"]) ?></a><?php else: ?><?= $review["name"] !== "" ? htmlspecialcharsbx($review["name"]) : Loc::getMessage("VINO_REV_NO_PRODUCT") ?><?php endif; ?></p>
|
|
<p class="vino-cab-card__status<?= $review["published"] ? "" : " vino-cab-card__status--pending" ?>"><?= Loc::getMessage($review["published"] ? "VINO_REV_PUBLISHED" : "VINO_REV_PENDING") ?></p>
|
|
</div>
|
|
<div class="vino-cab-card__meta-row">
|
|
<span class="vino-stars vino-stars--sm" role="img" aria-label="<?= htmlspecialcharsbx(Loc::getMessage("VINO_REV_RATING_LABEL", ["#VALUE#" => $review["rating"]])) ?>"><?= $stars($review["rating"]) ?></span>
|
|
<?php if ($review["date"] > 0): ?><time class="vino-cab-card__meta" datetime="<?= date("Y-m-d", $review["date"]) ?>"><?= \Jinove\Vinoteca\DateFormat::long($review["date"], LANGUAGE_ID) ?></time><?php endif; ?>
|
|
</div>
|
|
<p class="vino-cab-card__text"><?= htmlspecialcharsbx($review["text"]) ?></p>
|
|
</li>
|
|
<?php endforeach; ?>
|
|
</ul>
|
|
<?php endif; ?>
|
|
</div>
|
|
</section>
|