Example #1
0
 * @category       modules
 * @author         Nazar Mokrynskyi <*****@*****.**>
 * @copyright      Copyright (c) 2014, Nazar Mokrynskyi
 * @license        MIT License, see license.txt
 */
namespace cs\modules\Precincts;

use h, cs\Core, cs\Index, cs\Language, cs\Page, cs\User;
$Index = Index::instance();
$Index->title_auto = false;
$L = Language::instance();
$Page = Page::instance();
if (isset($Index->route_path[0], $Index->route_ids[1]) && $Index->route_path[0] == 'violation') {
    $violation = Violations::instance()->get($Index->route_ids[1]);
    if ($violation['images']) {
        $Page->replace('/<meta content="[^"]*share.png" property="og:image">/Uims', '');
        $Page->replace('/<link href="[^"]*share.png" rel="image_src">/Uims', '');
        $Page->link(['rel' => 'image_src', 'href' => $violation['images'][0]]);
        foreach ($violation['images'] as $image) {
            $Page->og('image', $image);
            $Page->og('image:secure_url', $image);
        }
    }
    if ($violation['text']) {
        $Page->Description = description($violation['text']);
    }
}
$Page->Header .= h::{'button.cs-elections-add-violation'}(h::{'i.uk-icon-plus'}() . " {$L->add_violation}") . h::{'button.cs-elections-last-violations'}();
$Page->js("window.disqus_shortname = '" . Core::instance()->disqus_shortname . "';", 'code');
$Page->content(h::{'div.cs-elections-last-violations-panel'}(h::h2($L->last_violations) . h::{'section'}()) . h::{'aside.cs-elections-precinct-sidebar'}() . h::{'aside.cs-elections-add-violation-sidebar'}() . h::{'aside.cs-elections-violation-read-more-sidebar'}() . h::{'aside.cs-elections-main-sidebar'}(h::{'div.cs-elections-opirzagin a[href=become_eyes]'}($L->become_eyes) . h::{'div.cs-elections-opirzagin a[href=opirzagin]'}($L->opircrew) . h::{'div.cs-elections-opirzagin a[href=instruktsia]'}($L->instruktsia) . h::{'div.cs-elections-socials'}('<div class="yashare-auto-init" data-yashareL10n="uk" data-yashareQuickServices="facebook" data-yashareLink="https://www.facebook.com/opir.org" data-yashareTheme="counter" data-yashareImage="https://opir.org/components/modules/Common/includes/img/share.png"></div>' . '<div class="yashare-auto-init" data-yashareL10n="uk" data-yashareQuickServices="vkontakte,twitter" data-yashareLink="https://opir.org/" data-yashareTheme="counter" data-yashareImage="https://opir.org/components/modules/Common/includes/img/share.png"></div>') . h::h2($L->precincts_search) . h::{'input.cs-elections-precincts-search[type=search]'}(['placeholder' => $L->number_or_address]) . h::{'section.cs-elections-precincts-search-results[level=0]'}() . h::h2($L->mobile_apps) . h::{'div.cs-elections-mobile-apps'}(h::{'a[target=_blank'}($L->download_in('App Store'), ['href' => 'https://itunes.apple.com/ua/app/opir.org/id896488790']) . h::{'a[target=_blank]'}($L->download_in('Google Play'), ['href' => 'https://play.google.com/store/apps/details?id=example.yariksoffice']) . h::{'a[target=_blank]'}($L->download_in('Market Place'), ['onclick' => "\$.cs.simple_modal('{$L->soon}')"])) . h::h2($L->contacts) . h::{'div.cs-elections-contacts'}(h::a(h::icon('phone') . '+38 093 012 22 11') . h::a(h::icon('phone') . '+38 067 708 42 90') . h::{'a[href=mailto:info@opir.org]'}(h::icon('envelope') . '*****@*****.**')) . h::h2($L->map_legend) . h::{'div.cs-elections-map-legend'}(h::div($L->precincts_with_violations) . h::div($L->precincts_without_violations) . h::div($L->district_precincts))));
Example #2
0
}
$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'}());