123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <?php
- /**
- * @var News $post
- * @var \yii\web\View $this
- */
- use app\models\base\Image;
- use app\models\News;
- use yii\helpers\ArrayHelper;
- use yii\helpers\Html;
- $preview = $post->image;
- $retina = $preview->getUrl(Image::SIZE_1040x586,"webp");
- $normal = $preview->getUrl(Image::SIZE_680x383,"webp");
- $bad = $preview->getUrl(Image::SIZE_680x383,'jpg');
- $bad = $bad?$bad:'/images/default.jpg';
- /*
- После этой даты не выводить фото до подтверждения юриста
- */
- if( isset( $post->dt_pub ) && strtotime( $post->dt_pub ) < strtotime(Yii::$app->params['delPhoto']) ){
- $bad = '/images/default.jpg';
- $normal = $bad;
- $retina = $bad;
- };
- if( $retina === false || $normal === false ){
- $normal = $bad;
- $retina = $bad;
- }
- $preview = $post->preview;
- ?>
- <div class="inject2" id="<?=$post->uid?>">
- <div class="illustration">
- <?php if($preview instanceof \app\models\base\Image):?>
- <div class="picture-cont-16x9">
- <a href="<?=$post->url?>">
- <picture class="w-100">
- <source srcset="<?=$normal?>, <?=$retina?> 2x" media="(min-width: 600px)">
- <img src="<?=$bad?>" alt="<?=$post->photo_title?>" class="w-100" loading="lazy">
- </picture>
- </a>
- </div>
- <?php else:?>
- <div class="picture-cont-16x9">
- <a href="<?=$post->url?>">
- </a>
- </div>
- <?php endif;?>
- </div>
- <div class="meta">
- <h2 class="title"><a href="<?=$post->url?>"><?=$post->title?></a></h2>
- <div class="lead"><?=$post->lid?></div>
- <div class="breadcrumbs">
- <?php
- echo Html::a("НОВОСТИ", ["/news"], ['class' => "breadcrumb"]);
- $topic = $post->getTopics()->andWhere(['show'=>"Y","active"=>1])->one();
- if($topic instanceof \app\models\base\NewsTopic) {
- echo Html::a($topic->title, ["/news/{$topic->url}"], ['class' => "breadcrumb"]);
- }
- ?>
- </div>
- </div>
- </div>
|