78 lines
3.2 KiB
PHP
78 lines
3.2 KiB
PHP
<?php
|
||
|
||
// Результаты: CF-метрики + метрики из лида (500+), 7 навыков (одинаковы для всех продов)
|
||
|
||
if (! defined('ABSPATH')) {
|
||
exit;
|
||
}
|
||
|
||
$data = Pksh_Data::instance();
|
||
$post_id = get_the_ID();
|
||
$lead = (string) carbon_get_post_meta($post_id, 'pksh_results_lead');
|
||
$metrics = carbon_get_post_meta($post_id, 'pksh_results_metrics');
|
||
|
||
|
||
$lead_metrics = array();
|
||
if ('' !== trim($lead) && function_exists('dekart_extract_metrics')) {
|
||
$parsed = dekart_extract_metrics($lead);
|
||
$lead_metrics = $parsed['metrics'];
|
||
$lead = $parsed['text'];
|
||
}
|
||
if (function_exists('dekart_fill_placeholders')) {
|
||
$lead = dekart_fill_placeholders($lead);
|
||
}
|
||
|
||
$cards = array();
|
||
if (is_array($metrics)) {
|
||
foreach ($metrics as $m) {
|
||
$v = trim((string) ($m['metric_value'] ?? ''));
|
||
$l = trim((string) ($m['metric_label'] ?? ''));
|
||
if ('' !== $v || '' !== $l) {
|
||
$cards[] = array( 'v' => $v, 'l' => $l );
|
||
}
|
||
}
|
||
}
|
||
foreach ($lead_metrics as $m) {
|
||
$cards[] = array( 'v' => trim((string) $m['value']), 'l' => trim((string) $m['desc']) );
|
||
}
|
||
?>
|
||
<section class="bento pksh-section" id="results" aria-label="Результаты учеников">
|
||
<div class="bento__full bento-card bento-card--highlight-results section-header--centered">
|
||
<span class="bento-label bento-label--light">Результаты наших учеников</span>
|
||
<h2 class="bento-h2 bento-h2--light">К чему мы приводим детей</h2>
|
||
<?php if ('' !== trim($lead)) : ?><p class="bento-p pksh-results__lead"><?php echo wp_kses_post($lead); ?></p><?php endif; ?>
|
||
|
||
<?php if (! empty($cards)) : ?>
|
||
<div class="results-grid">
|
||
<?php foreach ($cards as $card) : ?>
|
||
<div class="result-item">
|
||
<?php if ('' !== $card['v']) : ?><span class="result-item__value"><?php echo esc_html($card['v']); ?></span><?php endif; ?>
|
||
<?php if ('' !== $card['l']) : ?><span class="result-item__desc"><?php echo esc_html($card['l']); ?></span><?php endif; ?>
|
||
</div>
|
||
<?php endforeach; ?>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<?php
|
||
|
||
$skills = array(
|
||
array( 'title' => 'Чтение', 'icon' => 'book' ),
|
||
array( 'title' => 'Письмо', 'icon' => 'document' ),
|
||
array( 'title' => 'Математика', 'icon' => 'target' ),
|
||
array( 'title' => 'Логика и внимание', 'icon' => 'trending-up' ),
|
||
array( 'title' => 'Развитие речи', 'icon' => 'chat' ),
|
||
array( 'title' => 'Учебные навыки', 'icon' => 'graduation' ),
|
||
array( 'title' => 'Адаптация к школе', 'icon' => 'users' ),
|
||
);
|
||
?>
|
||
<div class="pksh-skills">
|
||
<?php foreach ($skills as $skill) : ?>
|
||
<div class="pksh-skill">
|
||
<span class="pksh-skill__icon"><?php echo dekart_icon($skill['icon'], 24); ?></span>
|
||
<span class="pksh-skill__title"><?php echo esc_html($skill['title']); ?></span>
|
||
</div>
|
||
<?php endforeach; ?>
|
||
</div>
|
||
</div>
|
||
</section>
|