Пример #1
0
    $groups[$c['group']]['categories'][] = $c['id'];
}
$categories = $categories_;
unset($categories_, $c);
$Page->js('cs.home = ' . _json_encode(['categories' => $categories, 'reporter' => in_array(STREAMER_GROUP, $User->get_groups() ?: []) ? _json_encode($User->get_data('stream_url') ?: 1) : 0, 'automaidan' => (int) in_array(AUTOMAIDAN_GROUP, $User->get_groups() ?: []), 'automaidan_coord' => (int) in_array(AUTOMAIDAN_COORD_GROUP, $User->get_groups() ?: [])]) . ';', 'code');
$Index = Index::instance();
if (isset($Index->route_ids[0])) {
    $event = Events::instance()->get($Index->route_ids[0]);
    if ($event) {
        $Page->Description = 'Додано: ' . date('H:i d.m.Y', $event['added']);
        if ($event['timeout'] > 0) {
            $Page->Description .= ' Актуально до: ' . date('H:i d.m.Y', $event['timeout']);
        }
        if ($event['img']) {
            $Page->replace('https://opir.org/components/modules/Home/includes/img/share.png', $event['img']);
        }
        if (strpos($event['text'], 'stream:') === false) {
            $Page->Description .= ' ' . $event['text'];
        }
        $Page->og('title', array_column(Events_categories::instance()->get_all(), 'name', 'id')[$event['category']]);
    }
    unset($event);
}
$Page->content(h::{'aside.cs-home-add-panel'}() . h::{'aside.cs-home-events-stream-panel'}() . (!in_array(AUTOMAIDAN_COORD_GROUP, $User->get_groups() ?: []) ? h::{'aside.cs-home-settings-panel'}(h::{'a.cs-app-store[target=_blank]'}('App Store', ['href' => 'https://itunes.apple.com/in/app/opir/id828565038']) . h::{'div.cs-hot-line'}(h::h3('Гаряча лінія:') . '+38 050 258 17 05<br><small>(медичні питання)</small><br>+38 050 258 17 43<br><small>(координація самооборони)</small><br>+38 093 01 222 11<br><small>(інше)</small>') . h::{'input.cs-home-address-search'}(['placeholder' => 'Пошук адреси на карті']) . h::h2('Фільтр') . h::{'div.cs-home-added-tags[level=0]'}() . h::{'input.cs-home-filter-tags'}(['placeholder' => 'Фільтр по адресі']) . h::{'div.cs-home-found-tags[level=0]'}() . h::{'ul.cs-home-filter-category li'}(array_map(function ($g) use($categories) {
    $return = [[h::h2($g['name']), ['data-group' => $g['id']]]];
    foreach ($g['categories'] as $c) {
        $c = $categories[$c];
        $return[] = [h::img(['src' => "components/modules/Home/includes/img/{$c['id']}.png"]) . h::span($c['name']), ['data-id' => $c['id'], 'data-group' => $g['id']]];
    }
    return $return;
}, array_values($groups)))) : h::{'aside.cs-home-settings-coordinator'}(h::h2('Фільтр') . h::{'div.all'}())) . h::{'div.cs-home-events-stream.uk-icon-chevron-left'}() . h::{'div.cs-home-settings.uk-icon-chevron-right'}());