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

$reviews = Reviews::find()
            ->where(['state' => 'active'])
            ->orderBy(['priority' => SORT_ASC])
            ->all();
?>
<?php if($reviews) : ?>
    <section class="rev_sec reviews-block">
        <div class="container">
            <div class="row" style="margin:50px -15px 0;">
                <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 $i => $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"><?=$review->text?></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 if($i<count($reviews)-1) : ?>
                        </div>
                    </section>
                    <div class="reviews-delimiter"></div>
                    <section class="rev_sec reviews-block">
                        <div class="container">
                <?php else : ?>
                    <div class="reviews-deend"></div>
                <?php endif; ?>
            <?php endforeach; ?>
        </div>
    </section>
<?php endif; ?>

<?php echo $this->render('@app/views/layouts/footer'); ?>