<?php

use yii\helpers\Url;

use yii\web\View;
use frontend\assets\FlipclockAsset;
FlipclockAsset::register($this);
?>
<div class="news_item">


            <a href="<?=Url::to(['event/show','alias'=>$model->alias])?>" class="name"><?=$model->name?></a>


        <div style="position: relative">
            <a href="<?=Url::to(['event/show','alias'=>$model->alias])?>">
                <?= \common\components\artboximage\ArtboxImageHelper::getImage($model->imageUrl, 'event_left', ['align' => 'left'])?>
            </a>


        <?php if(!empty($model->end_at) && strtotime($model->end_at) > strtotime(date("Y-m-d"))){?>
            <div class="clock_style_abs top70 clock_<?= $model->primaryKey ?>"></div>

                    <?php $js = "var clock;
                        clock = new FlipClock(jQuery('.clock_". $model->primaryKey ."'),{
                        clockFace: 'DailyCounter',
                        language: 'ru',
                        classes: {
                            active: 'flip-clock-active',
                            before: 'flip-clock-before',
                            divider: 'flip-clock-divider',
                            dot: 'flip-clock-dot',
                            label: 'flip-clock-label',
                            flip: 'flip',
                            play: 'play',
                            wrapper: 'flip-clock-wrapper'
                        },
                    });

                    clock.setTime(".(strtotime($model->end_at) - strtotime(date('Y-m-d H:i:s'))).");
                    clock.setCountdown(true);
                    clock.start();";
                    $this->registerJs($js,View::POS_LOAD) ?>

            <?php } ?>
        </div>
    <div class="both"></div>




</div>