widget.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. use yii\web\View;
  3. use yii\helpers\Url;
  4. $imgFileShort = "/images/report_photo/{$model->folder}/";
  5. $info = $model->title;
  6. $rnd = random_int(100, 999999);
  7. ?>
  8. <div id="mycarouselg<?=$rnd?>" class="jcarousel-skin-tango" data-nav="thumbs" data-fit="contain" data-allowfullscreen="native" data-click="false" align="center" data-maxwidth="100%" bgcolor="#eee">
  9. <?
  10. $report = $model->getReport();
  11. foreach( $report as $item ){
  12. $imgFile = $imgFileShort."".$item->id.".160.jpg";
  13. if( file_exists(Yii::getAlias('@webroot').$imgFile ) || 1 ){
  14. $imf = $imgFileShort.$item->id.".800.jpg";
  15. $r = @getimagesize(Yii::getAlias('@webroot').$imgFileShort.$item->id.".1024.jpg" );
  16. $imgphoto = ( $r === false )?$imf:$imgFileShort.$item->id.".1024.jpg";
  17. ?>
  18. <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>
  19. <?
  20. }
  21. }
  22. ?>
  23. </div>
  24. <?
  25. $str =
  26. <<<JS
  27. <!-- Fotorama -->
  28. <script type="text/javascript">
  29. setTimeout( 1000, $('#mycarouselg$rnd').fotorama({ width:'100%',maxwidth:800,thumbheight:70,thumbwidth:94, click:false,nav: false, captions: true, caption: 'overlay', allowfullscreen:'native' }));
  30. </script>
  31. JS;
  32. echo $str;
  33. ?>