Fix reviews

parent 3a8d5670
......@@ -119,6 +119,8 @@ class CoContentLang extends \common\components\ActiveRecordModel
$arrWhatReplaceNext[] = '[about-reviews]';
$arrReplaceNext[] = CoBlocks::printStaticBlock('about-reviews', true);
$arrWhatReplaceNext[] = '[reviews]';
$arrReplaceNext[] = CoBlocks::printStaticBlock('reviews', true);
$arrWhatReplaceNext[] = '[content-phone]';
$arrReplaceNext[] = \common\models\Settings::getValue('content-phone');
$arrWhatReplaceNext[] = '[cases]';
......
......@@ -13,10 +13,6 @@ return [
'elements' => [
'title' => [
'type' => 'text',
],
'lang' => [
'type' => 'dropdownlist',
'items' => ArrayHelper::map(\common\modules\languages\models\Languages::find()->all(),'code','name')
],
($model->photo?Html::img(\Yii::$app->params['frontUrl'] . Reviews::PHOTO_FOLDER . $model->photo):''),
'image' => ['type' => 'file', 'class' => 'form-control',],
......
......@@ -101,7 +101,7 @@ class Reviews extends \common\components\ActiveRecordModel
[['text', 'state', 'attendant_products'], 'string'],
[['admin_id'], 'adminIdValidate'],
[['date', 'answer', 'good', 'bad', 'date_create', 'notification_date', 'rate_usability', 'rate_loyality', 'rate_profit', 'title', 'order', 'photo', 'state', 'video'], 'safe'],
[['lang'], 'string', 'max' => 2],
// [['lang'], 'string', 'max' => 2],
[['title'], 'string', 'max' => 250],
[['email', 'video'], 'string', 'max' => 255]
];
......
<?php
use \common\modules\reviews\models\Reviews;
use yii\helpers\Html;
$reviews = Reviews::find()
->where(['state' => 'active'])
->orderBy('created_at DESC')
->all();
?>
<?php if($reviews) : ?>
<section class="rev_sec">
<div class="container">
<div class="row" style="margin-top:50px;">
<div class="col-md-12 col-xs-12 col-sm-12">
<span class="rev_title">Отзывы о нас</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="<?=Reviews::PHOTO_FOLDER . $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 endforeach; ?>
</div>
</section>
<?php endif; ?>
<?php echo $this->render('@app/views/layouts/footer'); ?>
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment