<?php
/**
 * @var $model \app\models\News
 * @var $key
 * @var $index
 * @var $widget
 */

use app\models\base\Image;

switch ($index){
    case 90:
        $className = "main";
        break;
    case 0:
        $className = "high";
        break;
    default:
        $className = "low";
}
if($index == 1) echo \yii\helpers\Html::beginTag("div",["class"=>'group']);
?>
<div class="news-item <?=$className?>" data-key="<?=$key?>">
        <div class="meta">
            <h2 class="title"><a href="<?=$model->url?>"><?=$model->title?></a></h2>
            <?php if($className!="low"): ?><div class="lead"><?=$model->lid?></div><?php endif;?>
            <div class="published_at">
                <?=$model->publishedAt?> <?=date("H:i",strtotime($model->dt_pub))?>
                <?php if($model->comments=="Y"):?>
                    <?php
                    $count=$model->getCommentsAll()->count();
                    ?>
                    <?php if($count>0):?>
                        <span class="commnets">&nbsp;<svg class="icon icon-comments"><use xlink:href="/svg/symbol/sprite-clear.svg#comments"></use></svg><?=$count?></span>
                    <?php endif;?>
                <?php endif;?>
            </div>
        </div>


</div>

