<?php
use \common\modules\reviews\models\Reviews;
use yii\helpers\Html;

$reviews = Reviews::find()
            ->where(['state' => 'active'])
            ->orderBy(['priority' => SORT_ASC])
            ->limit(1)
            ->all();
?>
<?php if($reviews) : ?>
    <section class="rev_sec">
        <div class="container">
            <div class="row">
                <div class="col-md-12 col-xs-12 col-sm-12">
                    <span class="rev_title"><?=Yii::t('reviews', 'References about us')?></span>
                </div>
            </div>
            <?php foreach ($reviews as $review) : ?>
                <?php if(!$review->video) : ?>
                    <div class="row">
                        <?php if($review->photo) : ?>
                            <div class="col-md-3 col-xs-4 col-sm-12">
                                <div class="rev_img">
                                    <img src="<?=$review->photo?>">
                                </div>
                            </div>
                        <?php endif; ?>
                        <div class="col-md-8 col-xs-8 col-sm-12">
                            <div class="rev_name"><?=$review->title?></div>
                            <div class="rev_txt rev_hd"><?=$review->text?></div>
                            <div class="review_hide_btn" data-hide="Скрыть" data-show="Подробнее">Подробнее</div>
                        </div>
                    </div>
                <?php else : ?>
                    <div class="rev_video_block">
                        <div class="row">
                            <div class="col-md-6 col-xs-12 col-sm-12">
                                <div class="rev_video">
                                    <iframe width="417" height="199" src="<?=$review->video?>" frameborder="0" allowfullscreen></iframe>
                                </div>
                            </div>
                            <div class="col-md-6 col-xs-12 col-sm-12">
                                <div class="rev_video_name"><?=$review->title?></div>
                                <div class="rev_video_desc">
                                    <?=$review->text?>
                                </div>
                            </div>
                        </div>
                    </div>
                <?php endif; ?>
            <?php endforeach; ?>

            <a href="/otzyvy-art-proekt" class="all_rev__btn"><?=Yii::t('reviews', 'Look all reviews')?></a>
        </div>
    </section>
<?php endif; ?>