Delete comment
This commit is contained in:
@@ -1,18 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* Единый header для страниц AETERNA (версия для public/)
|
||||
* Подключение: include 'header_common.php';
|
||||
*/
|
||||
|
||||
// Запускаем сессию если еще не запущена
|
||||
if (session_status() === PHP_SESSION_NONE) {
|
||||
session_start();
|
||||
}
|
||||
|
||||
// Определяем текущую страницу
|
||||
$currentPage = basename($_SERVER['PHP_SELF'], '.php');
|
||||
|
||||
// Проверяем авторизацию
|
||||
$isLoggedIn = isset($_SESSION['isLoggedIn']) && $_SESSION['isLoggedIn'] === true;
|
||||
$isAdmin = isset($_SESSION['isAdmin']) && $_SESSION['isAdmin'] === true;
|
||||
$userEmail = $_SESSION['user_email'] ?? '';
|
||||
@@ -49,13 +42,12 @@ $fullName = $_SESSION['full_name'] ?? $userEmail;
|
||||
|
||||
<div class="header__icons--top">
|
||||
<?php if ($isLoggedIn): ?>
|
||||
<!-- Иконка корзины -->
|
||||
|
||||
<a href="checkout.php" class="icon cart-icon">
|
||||
<i class="fas fa-shopping-cart"></i>
|
||||
<span class="cart-count" id="cartCount">0</span>
|
||||
</a>
|
||||
|
||||
<!-- Блок профиля -->
|
||||
<div class="user-profile-dropdown">
|
||||
<div class="user-profile-toggle" id="profileToggle">
|
||||
<div class="user-avatar"><?= !empty($userEmail) ? strtoupper(substr($userEmail, 0, 1)) : 'U' ?></div>
|
||||
@@ -111,7 +103,7 @@ $fullName = $_SESSION['full_name'] ?? $userEmail;
|
||||
</header>
|
||||
|
||||
<style>
|
||||
/* Стили для профиля пользователя */
|
||||
|
||||
.user-profile-dropdown { position: relative; display: inline-block; }
|
||||
.user-profile-toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 8px 12px; border-radius: 4px; transition: all 0.3s ease; }
|
||||
.user-profile-toggle:hover { background-color: rgba(0, 0, 0, 0.05); }
|
||||
@@ -137,19 +129,18 @@ $fullName = $_SESSION['full_name'] ?? $userEmail;
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
// Профиль пользователя - открытие/закрытие
|
||||
|
||||
$('#profileToggle').click(function(e) {
|
||||
e.stopPropagation();
|
||||
$('#profileMenu').toggle();
|
||||
});
|
||||
|
||||
|
||||
$(document).click(function(e) {
|
||||
if (!$(e.target).closest('.user-profile-dropdown').length) {
|
||||
$('#profileMenu').hide();
|
||||
}
|
||||
});
|
||||
|
||||
// Обновление счетчика корзины
|
||||
<?php if ($isLoggedIn): ?>
|
||||
$.ajax({
|
||||
url: 'api/cart.php?action=count',
|
||||
@@ -166,4 +157,3 @@ $(document).ready(function() {
|
||||
<?php endif; ?>
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user