<?php
/**
 * @var $post \app\models\News
 * @var \yii\data\ActiveDataProvider $newsDataProvider
 * @var \app\models\base\NewsTopic | \app\models\base\Story $topic
 * @var \app\models\Design $design
 */
use yii\helpers\Html;
use app\models\Inquirer;
use yii\widgets\ListView;
//if( YII_ENV != 'dev' ) return;

$query = Inquirer::find()->where([ 'active'=>'Y'])->orderBy([ 'id' => SORT_DESC])->limit(3);
$newsDataProvider = new \yii\data\ActiveDataProvider(
	[
		"query"=>$query,
		"pagination" =>false,
	]
);

echo "<!-- 3 опроса в ряд -->";
if(!is_null($design->parent)){
    echo Html::tag('h2',Html::a($design->parent->title,[$design->parent->getUrl()]),['class'=>"widget-title mt-2 text-center"]);
}
echo Html::beginTag("div",["class"=>"partner-news row"]);

echo Yii::$app->cache->getOrSet("main-page-third-row-l2-".$design->id,function () use ($newsDataProvider){

    return \yii\widgets\ListView::widget([
        "dataProvider" => $newsDataProvider,
        'options' => [
            'tag' => false,
            'class' => 'list-wrapper',
            'id' => 'list-wrapper',
        ],
        "itemOptions"=>[
            "tag"=>false
        ],
        "itemView" => "_inquirer_item",
        "layout" => "{items}"
    ]);
},60);

echo \yii\helpers\Html::endTag("div");
