123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <?php
- /**
- * @var $model \app\models\News
- * @var $key
- * @var $index
- * @var $widget
- */
- use app\models\base\Image;
- use app\models\PhotoFilter;
- if( $index == 0 ){
- $mfilter = new PhotoFilter();
- $filter = $mfilter->findOne($model->id);
- if( !$filter ){
- $filter = new stdClass();
- $filter->brightness = 100;
- $filter->saturate = 100;
- $filter->contrast = 100;
- $filter->opacity = 0.5;
- }
- $sstr = 'style="filter: saturate('.$filter->saturate.'%) brightness('.$filter->brightness.'%) contrast('.$filter->contrast.'%);"';
- ?>
- <style>
- #fimgb::after{
- background:linear-gradient(rgba(0,0,0,.1),rgba(0,0,0,<?=$filter->opacity?>)) !important;
- }
- #fimgb{
- filter:brightness(100%);
- }
- </style>
- <?
- }
- $preview = $model->preview;
- switch ($index){
- case 0:
- $className = "main";
- break;
- case 1:
- $className = "high";
- break;
- default:
- $className = "low";
- }
- if($index==2) echo \yii\helpers\Html::beginTag("div",["class"=>'group']);
- ?>
- <div class="news-item <?=$className?>" data-key="<?=$key?>">
- <?php if($preview instanceof Image && $index==0):?>
- <div class="picture-cont-16x9">
- <a href="<?=$model->url?>" title="<?=htmlentities($model->title,ENT_QUOTES)?>">
- <picture class="w-100" id="fimgb" >
- <source srcset="<?=$preview->getUrl(Image::SIZE_680x383)?>?v=<?=$model->rev?>" media="(min-width: 600px)">
- <img src="<?=$preview->getUrl(Image::SIZE_680x383)?>?v=<?=$model->rev?>" srcset="<?=$preview->getUrl(Image::SIZE_320x180)?>?v=<?=$model->rev?> 320w,<?=$preview->getUrl(Image::SIZE_500x282)?>?v=<?=$model->rev?> 500w,<?=$preview->getUrl(Image::SIZE_680x383)?>?v=<?=$model->rev?> 680w" alt="<?=htmlentities($model->photo_title,ENT_QUOTES)?>" class="w-100" loading="lazy" id='mainphoto' <?=$sstr?>>
- </picture>
- </a>
- </div>
- <?php endif;?>
- <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"> <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>
- <?php
- if($index==3) echo \yii\helpers\Html::endTag("div");
- ?>
|