2026-09-08 18:38:27 +00:00

111 lines
5.2 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 (по образцу главной ds-hero, но краткий)
* Фото: первый преподаватель по дате добавления (без CF).
* Гео-данные: get_option('branch_*') с fallback на site_*.
*
* @package Dekart
*/
if (! defined('ABSPATH')) {
exit;
}
// ─── Гео из филиала ───
$branch_addr = get_option('branch_address') ?: crb_get_theme_option('site_address');
$branch_city = get_option('branch_city') ?: crb_get_theme_option('site_city', 'Щёлково');
$branch_city_prep = get_option('branch_city_prep', 'в Щёлково') ?: 'в Щёлково';
$branch_hours = get_option('branch_work_hours') ?: get_option('branch_hours');
$branch_phone = get_option('branch_phone') ?: crb_get_theme_option('site_phone');
$branch_name = get_option('branch_name') ?: crb_get_theme_option('site_name', 'Декарт');
$phone_clean = $branch_phone ? preg_replace('/[\s\-\\(\)]/', '', $branch_phone) : '';
// ─── Учебный год (автообновление) ───
$current_year = (int) current_time('Y');
$next_year = $current_year + 1;
$school_year = $current_year . '/' . $next_year;
// ─── Фото: первый преподаватель по добавлению ───
$first_teacher = get_posts(array(
'post_type' => 'teacher',
'post_status' => 'publish',
'posts_per_page' => 1,
'orderby' => 'date',
'order' => 'ASC',
'no_found_rows' => true,
));
$hero_photo = '';
$hero_alt = 'Преподаватели школы «' . esc_html($branch_name) . '» ' . esc_html($branch_city);
if (! empty($first_teacher)) {
$first_tid = (int) $first_teacher[0]->ID;
$av_id = carbon_get_post_meta($first_tid, 'teacher_avatar');
if ($av_id) {
$hero_photo = wp_get_attachment_url($av_id);
$alt_meta = get_post_meta($av_id, '_wp_attachment_image_alt', true);
if ($alt_meta) {
$hero_alt = $alt_meta;
}
}
}
// ─── Статистика (кратко) ───
$hero_stats = array(
array( 'num' => '12', 'label' => 'педагогов' ),
array( 'num' => '10+', 'label' => 'лет средний стаж' ),
);
?>
<section class="section-bg ds-hero teachers-hero" data-bg="hero" aria-labelledby="teachers-hero-title">
<div class="ds-container">
<div class="ds-hero__inner">
<div class="ds-hero__content">
<?php if ($branch_addr || $branch_city) : ?>
<div class="ds-hero__address">
<svg aria-hidden="true" width="16" height="16"><use href="#icon-location-pin"/></svg>
<span><?php echo esc_html(trim($branch_addr . ( $branch_addr && $branch_city ? ' — ' : '' ) . $branch_city)); ?></span>
<?php if ($branch_hours) : ?>
<span class="ds-hero__hours-badge"><svg aria-hidden="true" width="16" height="16"><use href="#icon-clock"/></svg> <?php echo esc_html($branch_hours); ?></span>
<?php endif; ?>
</div>
<?php endif; ?>
<h1 id="teachers-hero-title" class="ds-hero__h1">Наши преподаватели</h1>
<p class="ds-hero__subtitle">Команда педагогов школы «<?php echo esc_html($branch_name); ?>» <?php echo esc_html($branch_city_prep); ?>: начальная школа, средняя школа, подготовка к школе, продлёнка и летний лагерь. Средний стаж — от 10 лет. Открыт набор на <span class="ds-hero__year"><?php echo esc_html($school_year); ?></span> учебный год.</p>
<button class="ds-hero__cta-btn btn-write open-bitrix-form">
Записаться на экскурсию
</button>
<noscript>
<div class="ds-hero__cta-fallback">
Позвоните: <a href="tel:<?php echo esc_attr($phone_clean ?: '+74951206699'); ?>"><?php echo esc_html($branch_phone ?: '+7 (495) 120-66-99'); ?></a>
</div>
</noscript>
<div class="ds-hero__assurance">
<span class="ds-hero__assurance-item">Познакомитесь с учителями лично</span>
<span class="ds-hero__assurance-item">Зададите вопросы напрямую</span>
</div>
</div>
<div class="ds-hero__visual">
<?php if ($hero_photo) : ?>
<div class="ds-hero__photo-wrap">
<div class="ds-hero__photo-frame">
<img class="ds-hero__photo"
src="<?php echo esc_url($hero_photo); ?>"
alt="<?php echo esc_attr($hero_alt); ?>"
loading="eager" decoding="async"
width="600" height="600">
</div>
<div class="ds-hero__photo-ring" aria-hidden="true"></div>
</div>
<?php endif; ?>
</div>
</div>
</div>
</section>