|
@@ -0,0 +1,51 @@
|
|
|
|
+<?php
|
|
|
|
+/**
|
|
|
|
+ * @var $model \app\models\News
|
|
|
|
+ * @var $index integer
|
|
|
|
+ */
|
|
|
|
+use app\models\base\Image;
|
|
|
|
+
|
|
|
|
+$preview = $model->image;
|
|
|
|
+
|
|
|
|
+$retina = $preview->getUrl(Image::SIZE_680x383,"webp");
|
|
|
|
+$normal = $preview->getUrl(Image::SIZE_320x180,"webp");
|
|
|
|
+$bad = $preview->getUrl(Image::SIZE_320x180,'jpg');
|
|
|
|
+
|
|
|
|
+$bad = $bad?$bad:'/images/default.jpg';
|
|
|
|
+
|
|
|
|
+if( $retina === false || $normal == false ){
|
|
|
|
+ $normal = $bad;
|
|
|
|
+ $retina = $bad;
|
|
|
|
+}
|
|
|
|
+$normal .= "?v=".$model->rev;
|
|
|
|
+$retina .= "?v=".$model->rev;
|
|
|
|
+$bad .= "?v=".$model->rev;
|
|
|
|
+
|
|
|
|
+if( $model->photo_rcol == 'Y' ){
|
|
|
|
+?>
|
|
|
|
+ <div class="card-body mb-2">
|
|
|
|
+ <?php if($preview instanceof \app\models\base\Image):?>
|
|
|
|
+ <div class="picture-cont-16x9">
|
|
|
|
+ <a href="<?=$model->url?>">
|
|
|
|
+ <picture class="w-100">
|
|
|
|
+ <source srcset="<?=$normal?>, <?=$retina?> 2x" media="(min-width: 600px)">
|
|
|
|
+ <img src="<?=$bad?>" alt="<?=htmlentities($model->photo_title,ENT_QUOTES)?>" srcset="<?=$normal?>, <?=$retina?> 2x" class="w-100" <?=($index > 2)?'loading="lazy"':''?>>
|
|
|
|
+ </picture>
|
|
|
|
+ </a>
|
|
|
|
+ </div>
|
|
|
|
+ <?php endif;?>
|
|
|
|
+ </div>
|
|
|
|
+<?}?>
|
|
|
|
+<h3>
|
|
|
|
+ <?=\yii\helpers\Html::a($model->title,$model->url);?>
|
|
|
|
+ <div class="published_at">
|
|
|
|
+ <?=($model->dt_pub<date("Y-m-d H:i:s",strtotime("-1 day")))?date("d.m.Y H:i",strtotime($model->dt_pub)):$model->publishedAt?>
|
|
|
|
+ <?php
|
|
|
|
+ $count=$model->getCommentsAll()->count();
|
|
|
|
+ ?>
|
|
|
|
+ <?php if($count>0):?>
|
|
|
|
+ <span class="commnets"> <svg class="icon icon-comments"><use xlink:href="/svg/symbol/sprite-clear.svg#comments"></use></svg><?=$count?></span>
|
|
|
|
+ <?php endif;?>
|
|
|
|
+ </div>
|
|
|
|
+</h3>
|
|
|
|
+
|