Vinoteca: модуль, шаблон и компоненты интернет-магазина вина на 1С-Битрикс

This commit is contained in:
jimagie committed 2026-10-22 03:32:28 +05:00
commit f6ba0d2174
470 files changed
+26454

No files matched your search

@@ -0,0 +1,35 @@
<?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;
}
}
@@ -0,0 +1,3 @@
<?php
$MESS["VINO_REV_PAGE_TITLE"] = "My reviews | Vinoteca";
$MESS["VINO_REV_PAGE_DESCRIPTION"] = "Wine reviews in your Vinoteca account.";
@@ -0,0 +1,3 @@
<?php
$MESS["VINO_REV_PAGE_TITLE"] = "Moje opinie | Vinoteca";
$MESS["VINO_REV_PAGE_DESCRIPTION"] = "Opinie o winach na koncie Vinoteca.";
@@ -0,0 +1,3 @@
<?php
$MESS["VINO_REV_PAGE_TITLE"] = "Мои отзывы | Vinoteca";
$MESS["VINO_REV_PAGE_DESCRIPTION"] = "Отзывы о винах в личном кабинете Vinoteca.";
@@ -0,0 +1,8 @@
<?php
$MESS["VINO_REV_TITLE"] = "My reviews";
$MESS["VINO_REV_EMPTY"] = "No wine reviews yet";
$MESS["VINO_REV_TO_CATALOG"] = "Go to the catalog";
$MESS["VINO_REV_PUBLISHED"] = "Published";
$MESS["VINO_REV_PENDING"] = "Under review";
$MESS["VINO_REV_RATING_LABEL"] = "Rating #VALUE# out of 5";
$MESS["VINO_REV_NO_PRODUCT"] = "Product unavailable";
@@ -0,0 +1,8 @@
<?php
$MESS["VINO_REV_TITLE"] = "Moje opinie";
$MESS["VINO_REV_EMPTY"] = "Nie dodano jeszcze opinii o winach";
$MESS["VINO_REV_TO_CATALOG"] = "Do katalogu";
$MESS["VINO_REV_PUBLISHED"] = "Opublikowana";
$MESS["VINO_REV_PENDING"] = "W weryfikacji";
$MESS["VINO_REV_RATING_LABEL"] = "Ocena #VALUE# z 5";
$MESS["VINO_REV_NO_PRODUCT"] = "Produkt niedostępny";
@@ -0,0 +1,8 @@
<?php
$MESS["VINO_REV_TITLE"] = "Мои отзывы";
$MESS["VINO_REV_EMPTY"] = "Отзывов о винах пока нет";
$MESS["VINO_REV_TO_CATALOG"] = "В каталог";
$MESS["VINO_REV_PUBLISHED"] = "Опубликован";
$MESS["VINO_REV_PENDING"] = "На проверке";
$MESS["VINO_REV_RATING_LABEL"] = "Оценка #VALUE# из 5";
$MESS["VINO_REV_NO_PRODUCT"] = "Товар недоступен";
@@ -0,0 +1,16 @@
.vino-cab-card__meta-row {
display: flex;
align-items: center;
gap: var(--space-4);
margin: 0 0 var(--space-3);
}
.vino-cab-card__text {
margin: 0;
color: var(--color-text-muted);
font-size: var(--text-base);
line-height: 1.6;
overflow-wrap: anywhere;
}
.vino-cab-card__status--pending {
color: var(--color-text-muted);
}
@@ -0,0 +1,46 @@
<?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>