view.php 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. use yii\helpers\Url;
  3. //$this->title = $model->name;
  4. $this->params['breadcrumbs'] = [
  5. ];
  6. $this->params['breadcrumbs'][] =
  7. [
  8. "text"=>"Фото репортажи",
  9. "url"=>"/photo"
  10. ];
  11. $imgFileShort = "/images/report_photo/{$model->folder}/";
  12. $info = $model->title;
  13. $txt_date = date( "[Y-m-d] ", strtotime( $model->date ) );
  14. Yii::$app->og->title = $model->title;
  15. Yii::$app->og->description = $txt_date.trim(str_replace( '"',"'",substr(strip_tags( $model->body ),0,150)))."...";
  16. Yii::$app->og->og_url = $model->getUrl(true);Yii::$app->og->canonical = $model->getUrl(true);
  17. Yii::$app->og->og_type = "website";
  18. Yii::$app->og->dtpub = date( "r", strtotime( $model->date ) );
  19. $imgFileShort = "/images/report_photo/{$model->folder}/";
  20. $amic_image = $imgFileShort."0.size2.jpg";
  21. if( file_exists(Yii::getAlias('@webroot').$amic_image) ){
  22. Yii::$app->og->og_image = $amic_image;
  23. }
  24. ?>
  25. <div class="row justify-content-md-center person">
  26. <div class="col-md-10">
  27. <?=$this->render("/layouts/breadcrumbs")?>
  28. <div id="post" class="post">
  29. <section class="text">
  30. <h1><?=$model->title?></h1>
  31. <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">
  32. <?
  33. $report = $model->getReport();
  34. foreach( $report as $item ){
  35. if( !$item->active ) continue;
  36. $imgFile = $imgFileShort."".$item->id.".320.jpg";
  37. if( file_exists(Yii::getAlias('@webroot').$imgFile ) ){
  38. $imf = $imgFileShort.$item->id.".800.jpg";
  39. $r = @getimagesize(Yii::getAlias('@webroot').$imgFileShort.$item->id.".1024.jpg" );
  40. $imgphoto = ( $r === false )?$imf:$imgFileShort.$item->id.".1024.jpg";
  41. ?>
  42. <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>
  43. <?
  44. }
  45. }
  46. ?>
  47. </div><br>
  48. <?=$model->body?>
  49. </section>
  50. </div>
  51. </div>
  52. </div>
  53. <!-- Fotorama -->
  54. <link href="/js/fotorama/fotorama.css" rel="stylesheet">
  55. <script src="/js/fotorama/fotorama.js" defer></script>
  56. <script type="text/javascript">
  57. window.addEventListener("DOMContentLoaded",function () {
  58. $('#mycarouselg').fotorama({ width:'100%',maxwidth:800,thumbheight:70,thumbwidth:94, click:false,nav: false, captions: true, caption: 'overlay', allowfullscreen:'native' });
  59. });
  60. </script>
  61. <?