123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- <?php
- use yii\helpers\Html;
- use yii\widgets\DetailView;
- use yii\web\View;
- /** @var yii\web\View $this */
- /** @var app\models\ReportTopic $model */
- $this->title = '';
- $this->params['breadcrumbs'][] = ['label' => 'Старые фоторепортажи', 'url' => ['index']];
- $this->params['breadcrumbs'][] = $this->title;
- $imgFileShort = "/images/report_photo/{$model->folder}/";
- $amic_image = $imgFileShort."0.size2.jpg";
- if( !file_exists(Yii::getAlias('@webroot').$amic_image) ){
- $amic_image = $imgFileShort."0.160.jpg";
- }
- \yii\web\YiiAsset::register($this);
- ?>
- <div class="report-topic-view">
- <h2><?= Html::encode( $model->title ) ?></h2>
- <p>
- <?= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
- <?= Html::a('Delete', ['delete', 'id' => $model->id], [
- 'class' => 'btn btn-danger',
- 'data' => [
- 'confirm' => 'Are you sure you want to delete this item?',
- 'method' => 'post',
- ],
- ]) ?>
- </p>
- <div class="row">
- <div class ="col-md-4">
- <div class="card mb-2 bg-gradient-dark">
- <img class="card-img-top" src="<?=$amic_image?>" style="filter: brightness(0.5);">
- <div class="card-img-overlay d-flex flex-column justify-content-end">
- <h5 class="card-title text-primary text-white"><?= Html::decode( $model->title ) ?></h5>
- <p class="card-text text-white pb-2 pt-1"><?= Html::decode( substr( $model->body, 0, 250) ) ?></p>
- <a href="/photo/<?=$model->id?>" class="text-white">Переход >></a>
- </div>
- </div>
- </div>
- </div>
- <?
- //var_dump($model->getReport());
- ?>
- <div class="row">
- <div class ="col-md-6">
- <div id="carousel" class="carousel slide" data-ride="carousel">
- <div class="carousel-inner">
- <?
- $f = true;
- foreach( $model->getReport() as $item ){
- ?>
- <div class="carousel-item<?=$f?' active':''?>">
- <img src="<?=$imgFileShort.$item->id?>.800.jpg" class="d-block w-100" alt="">
- <? if( trim($item->title) != ''){?>
- <div class="carousel-caption d-none d-md-block">
- <h5><?=Html::encode($item->title)?></h5>
- </div>
- <?}?>
- </div>
- <?
- $f = false;
- }
- ?>
- </div>
- <a class="carousel-control-prev" href="#carousel" role="button" data-slide="prev">
- <span class="carousel-control-prev-icon" aria-hidden="true"></span>
- <span class="sr-only">Предыдущий</span>
- </a>
- <a class="carousel-control-next" href="#carousel" role="button" data-slide="next">
- <span class="carousel-control-next-icon" aria-hidden="true"></span>
- <span class="sr-only">Следующий</span>
- </a>
- </div>
- </div>
- </div>
- <?= DetailView::widget([
- 'model' => $model,
- 'attributes' => [
- 'id',
- 'parent_id',
- 'date',
- 'title:ntext',
- 'body:ntext',
- 'folder',
- 'sort',
- 'active',
- ],
- ]) ?>
- </div>
- <?
- $this->registerJs(
- <<<JS
- // $('#carousel').carousel()
- JS
- ,
- View::POS_END,
- 'carousel'
- );
|