123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <?php
- /**
- * @var $model \app\models\News
- * @var $key
- * @var $index
- * @var $widget
- */
- use app\helpers\Transliterator;
- 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;
- }
- /*
- После этой даты не выводить фото до подтверждения юриста
- */
- if( isset( $model->dt_pub ) && !$model->isPhotosOnNews( $model->dt_pub ) ){
- $bad = '/images/default.jpg';
- $normal = $bad;
- $retina = $bad;
- };
- $normal .= "?v=".$model->rev;
- $retina .= "?v=".$model->rev;
- $bad .= "?v=".$model->rev;
- ?>
- <div class="">
- <div class="archive-news-item" data-key="<?=$key?>">
- <div class="illustration">
- <?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 else:?>
- <div class="picture-cont-16x9">
- <a href="<?=$model->url?>">
- </a>
- </div>
- <?php endif;?>
- </div>
- <div class="meta">
- <h2 class="title"><a href="<?=$model->url?>"><?=$model->title?></a></h2>
- <div class="published_at">
- <?=date("d",strtotime($model->dt_pub))." ".mb_strtolower(Transliterator::month(date("n",strtotime($model->dt_pub)))).date(" Y, H:i", strtotime($model->dt_pub))?>
- </div>
- </div>
- </div>
- </div>
|