<?php

use yii\helpers\Url;

//$this->title = $model->name;
$this->params['breadcrumbs'] = [
];
$this->params['breadcrumbs'][] =
    [
       "text"=>"Фото репортажи",
       "url"=>"/photo"
	];
	$imgFileShort = "/images/report_photo/{$model->folder}/";
    $info = $model->title;

	$txt_date = date( "[Y-m-d] ", strtotime( $model->date ) );
	Yii::$app->og->title = $model->title;
	Yii::$app->og->description = $txt_date.trim(str_replace( '"',"'",substr(strip_tags( $model->body ),0,150)))."...";
	Yii::$app->og->og_url = $model->getUrl(true);Yii::$app->og->canonical = $model->getUrl(true);
    Yii::$app->og->og_type = "website";
	Yii::$app->og->dtpub = date( "r", strtotime( $model->date ) );

	$imgFileShort = "/images/report_photo/{$model->folder}/";
	$amic_image = $imgFileShort."0.size2.jpg";
	if( file_exists(Yii::getAlias('@webroot').$amic_image) ){
		Yii::$app->og->og_image = $amic_image;
	}
?>
<div class="row justify-content-md-center person">
    <div class="col-md-10">
    <?=$this->render("/layouts/breadcrumbs")?>
        <div id="post" class="post">
			<section class="text">
            <h1><?=$model->title?></h1>
            <div id="mycarouselg" class="jcarousel-skin-tango" data-nav="thumbs" data-fit="contain" data-allowfullscreen="native" data-click="false" align="center" data-maxwidth="100%" bgcolor="#eee">
            <?
				$report = $model->getReport();
				foreach( $report as $item ){
					if( !$item->active ) continue;
					$imgFile = $imgFileShort."".$item->id.".320.jpg";

					if( file_exists(Yii::getAlias('@webroot').$imgFile ) ){
						$imf = $imgFileShort.$item->id.".800.jpg";
						$r = @getimagesize(Yii::getAlias('@webroot').$imgFileShort.$item->id.".1024.jpg" );
						$imgphoto = ( $r === false )?$imf:$imgFileShort.$item->id.".1024.jpg";
						?>
						<a href="<?=$imgphoto?>" rel='lightbox' target="photo<?=$item->id?>" data-caption="<?=($model->title !='')?htmlspecialchars($model->title):htmlspecialchars($info)?>" ><img alt="<?=($model->title !='')?htmlspecialchars($model->title):htmlspecialchars($info)?>" src="<?=$imgFile?>" border=0 hspace="0" vspace="0"></a>
						<?

					}
				}
?>
		</div><br>
            <?=$model->body?>
            </section>
        </div>
    </div>
</div>

  <!-- Fotorama -->
	<link href="/js/fotorama/fotorama.css" rel="stylesheet">
	<script src="/js/fotorama/fotorama.js" defer></script>
    <script type="text/javascript">
    window.addEventListener("DOMContentLoaded",function () {
		$('#mycarouselg').fotorama({ width:'100%',maxwidth:800,thumbheight:70,thumbwidth:94, click:false,nav: false, captions: true, caption: 'overlay', allowfullscreen:'native' });
	});
	</script>

<?

