2026-07-27 17:00:30 +00:00

186 lines
12 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/**
* Hero-секция страницы Подготовки к школе
* .section-bg .ds-hero
*
* @package Dekart
*/
if (! defined('ABSPATH')) {
exit;
}
$data = Pksh_Data::instance();
$opt_address = $data->get_address();
$branch_city_clean = $data->get_city_clean();
$city_prep = $data->get_city_prep();
$h1_hero = $data->get_h1();
$subtitle_hero = $data->get_subtitle();
$ext_review_count = $data->get_ext_review_count();
$opt_phone = $data->get_phone();
$hero_phone_clean = $data->get_phone_clean();
$banner_img_id = $data->get_banner_image_id();
$hero_metrics = $data->get_social_counters();
$hero_definition = $data->get_hero_definition();
?>
<section class="section-bg ds-hero" data-bg="hero" id="ds-hero" aria-label="Подготовка к школе">
<div class="ds-container">
<div class="ds-hero__inner">
<div class="ds-hero__content">
<?php if (! empty($opt_address) || ! empty($branch_city_clean)) : ?>
<div class="ds-hero__address">
<svg aria-hidden="true" width="16" height="16"><use href="#icon-location-pin"/></svg>
<span><?php echo esc_html($opt_address ?: ''); ?><?php if ($opt_address && $branch_city_clean) :
?> — центр <?php
endif; ?><?php echo esc_html($branch_city_clean ?: ''); ?></span>
</div>
<?php endif; ?>
<h1 class="ds-hero__h1"><?php echo esc_html($h1_hero ?: 'Подготовка к школе'); ?></h1>
<?php if ('' !== $hero_definition) : ?>
<p class="ds-hero__definition"><?php echo esc_html($hero_definition); ?></p>
<?php endif; ?>
<?php if ('' !== $subtitle_hero) :
$footnote_url = $data->get_subtitle_footnote_link();
?>
<p class="ds-hero__subtitle"><?php echo esc_html($subtitle_hero); ?><?php if ($footnote_url) :
?><sup><a href="<?php echo esc_url($footnote_url); ?>" class="ds-hero__footnote-link" target="_blank" rel="noopener noreferrer">*</a></sup><?php
else :
?><sup class="ds-hero__footnote">*</sup><?php
endif; ?></p>
<?php endif; ?>
<?php if (! empty($hero_metrics) && is_array($hero_metrics)) : ?>
<div class="ds-hero__metrics">
<?php foreach ($hero_metrics as $metric) :
$num = $metric['counter_number'] ?? '';
$lbl = $metric['counter_label'] ?? '';
if (empty($num)) {
continue;
}
?>
<div class="ds-hero__metric reveal">
<span class="ds-hero__metric-number"><?php echo esc_html($num); ?></span>
<span class="ds-hero__metric-label"><?php echo esc_html($lbl); ?></span>
</div>
<?php endforeach; ?>
</div>
<?php endif; ?>
<div class="ds-hero__rating-badge">
<span class="ds-hero__rating-stars" aria-hidden="true">★★★★★</span>
<span class="ds-hero__rating-text">4.9 из 5 на основе <?php echo esc_html($ext_review_count ?: '190'); ?> отзывов на внешних площадках</span>
</div>
<button class="ds-hero__cta-btn open-bitrix-form">Записаться на бесплатное пробное</button>
<?php if ($opt_phone) : ?>
<p class="ds-hero__phone">Или позвоните: <a href="tel:<?php echo esc_attr($hero_phone_clean); ?>" aria-label="Позвонить в школу Декарт: <?php echo esc_attr($opt_phone); ?>"><?php echo esc_html($opt_phone); ?></a></p>
<?php endif; ?>
<?php
$branch_messengers_pksh = array();
$mw = get_option('branch_messenger_whatsapp', '');
$mt = get_option('branch_messenger_telegram', '');
$mm = get_option('branch_messenger_max', '');
$wo = (bool) get_option('branch_messenger_whatsapp_on', 1);
$to = (bool) get_option('branch_messenger_telegram_on', 1);
$mo = (bool) get_option('branch_messenger_max_on', 1);
if ($wo && $mw) {
$branch_messengers_pksh[] = array( 'name' => 'WhatsApp', 'url' => $mw );
}
if ($to && $mt) {
$branch_messengers_pksh[] = array( 'name' => 'Telegram', 'url' => $mt );
}
if ($mo) {
$branch_messengers_pksh[] = array( 'name' => 'Max', 'url' => $mm ?: '#' );
}
$ex = get_option('branch_messenger_extra', array());
if (is_array($ex)) {
foreach ($ex as $e) {
if (! empty($e['url'])) {
$branch_messengers_pksh[] = array( 'name' => $e['name'] ?? '', 'url' => $e['url'] );
}
}
}
if (! empty($branch_messengers_pksh)) : ?>
<div class="ds-hero__messengers">
<?php foreach ($branch_messengers_pksh as $m) :
$m_name = $m['name'] ?? '';
$m_url = $m['url'] ?? '';
if (! $m_url) {
continue;
}
$m_lower = mb_strtolower($m_name);
$is_wa = mb_strpos($m_url, 'wa.me') !== false || $m_lower === 'whatsapp';
$is_tg = mb_strpos($m_url, 't.me') !== false || $m_lower === 'telegram';
$msg_slug = $is_wa ? 'wa' : ( $is_tg ? 'tg' : 'other' );
?>
<a class="ds-hero__msg ds-hero__msg--<?php echo esc_attr($msg_slug); ?>"
href="<?php echo esc_url($m_url); ?>"
target="_blank" rel="noopener noreferrer"
aria-label="<?php echo esc_attr($m_name); ?>">
<svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
<?php if ($is_wa) : ?>
<path d="M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 0 1-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 0 1-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 0 1 2.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0 0 12.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 0 0 5.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 0 0-3.48-8.413"/>
<?php elseif ($is_tg) : ?>
<path d="M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 1.698 6.147L.02 24l6.469-1.796A11.882 11.882 0 0 0 12 24a12 12 0 0 0 12-12A12 12 0 0 0 12 0zm7.502 17.21a7.498 7.498 0 0 1-1.356.807 8.486 8.486 0 0 1-1.82.6 7.44 7.44 0 0 1-2.266.13c-2.09-.27-4.082-1.05-5.61-2.103a18.57 18.57 0 0 1-3.967-3.751A14.8 14.8 0 0 1 2.8 6.106a7.68 7.68 0 0 1 .93-2.905 5.26 5.26 0 0 1 1.08-1.426c.078-.08.157-.149.246-.215.113-.081.226-.161.343-.226.397-.214.838-.221 1.252-.101.21.06.415.139.607.23.285.137.568.278.84.435.09.05.173.115.252.176.326.252.52.572.656.946.08.22.132.448.155.68.053.539.05 1.078-.003 1.611a4.12 4.12 0 0 1-.246.873 5.38 5.38 0 0 1-.34.715c-.104.172-.226.333-.387.446a3.09 3.09 0 0 0-.418.377c-.137.17-.139.375-.028.549a13.482 13.482 0 0 0 1.474 2.005c.018.018.036.035.054.053a13.659 13.659 0 0 0 2.058 1.603c.214.133.398.08.55-.067a4.37 4.37 0 0 1 .902-.72c.397-.24.778-.186 1.125.12.334.294.661.596.983.903.204.195.404.394.589.607.031.036.053.078.077.112a1.81 1.81 0 0 1 .324.603c.062.184.09.375.062.565a2.63 2.63 0 0 1-.218.68 4.98 4.98 0 0 1-.346.639.977.977 0 0 1-.333.322c-.233.148-.479.266-.72.378a3.12 3.12 0 0 1-.525.208c-.214.065-.43.123-.649.163"/>
<?php else : /* MAX / other */ ?>
<img src="<?php echo esc_url(get_template_directory_uri() . '/assets/images/max-logo.svg'); ?>" alt="MAX" width="18" height="18">
<?php endif; ?>
</svg>
<?php echo esc_html($m_name); ?>
</a>
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>
<div class="ds-hero__visual">
<div class="ds-hero__visual-glow" aria-hidden="true"></div>
<div class="ds-hero__photo-wrap">
<div class="ds-hero__photo-frame">
<?php if ($banner_img_id) : ?>
<?php echo wp_get_attachment_image($banner_img_id, 'full', false, array(
'class' => 'ds-hero__photo',
'loading' => 'eager',
'decoding' => 'async',
'alt' => sprintf('Подготовка %s — занятия для детей 57 лет', $city_prep),
)); ?>
<?php else : ?>
<img class="ds-hero__photo" loading="eager" decoding="async"
src="<?php echo esc_url(get_template_directory_uri() . '/assets/images/girl_and_a_boy.webp'); ?>"
alt="<?php echo esc_attr(sprintf('Подготовка %s — занятия для детей 57 лет', $city_prep)); ?>"
width="689" height="689">
<?php endif; ?>
</div>
<div class="ds-hero__photo-ring" aria-hidden="true"></div>
</div>
<div class="ds-hero__float ds-hero__float--1">
<span class="ds-hero__float-icon"><svg aria-hidden="true" width="24" height="24"><use href="#icon-teacher"/></svg></span>
<span>Педагоги с опытом 15+ лет</span>
</div>
<div class="ds-hero__float ds-hero__float--2">
<span class="ds-hero__float-icon"><svg aria-hidden="true" width="24" height="24"><use href="#icon-game"/></svg></span>
<span>Игровая методика</span>
</div>
<div class="ds-hero__float ds-hero__float--3">
<span class="ds-hero__float-icon"><svg aria-hidden="true" width="24" height="24"><use href="#icon-book"/></svg></span>
<span>Авторская программа</span>
</div>
</div>
</div>
</div>
</section>