12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- <?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;
- use yii\web\View;
- //if( YII_ENV != 'dev' ) return;
- $id = $design->parent_id;
- $query = Inquirer::find()->where([ 'active'=>'Y', 'id'=>$id])->limit(1)->One();
- $model = $query;
- echo "<!-- 1 опроса широкий -->\n";
- 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"]);
- $do = $model->getPart(); //уже голосовал если сделать обход кэша можно попробовать использовать
- ?>
- <div class="col-md-12">
- <div class="inquirer-item">
- <div class="meta">
- <div class="rubric">
- <a href="/inquirer">Опрос</a>
- </div>
- <div class="title">
- <a href="/inquirer/<?=$model->id?>">
- <?=$model->text?>
- </a>
- </div>
- </div>
- <div class="answer p-3 textcols" key="<?=$model->id?>">
- <?
- $answers = $model->getAnswers();
- if( $model->show == 'N' ){
- echo $this->render('_ask_item', ['answers'=>$answers]);
- }else{
- foreach($answers as $item){
- ?>
- <div class="form-check-main">
- <input class="form-check-input-col" type="radio" id="Radio<?=$item->id?>" name="ask_<?=$model->id?>" value="<?=$item->id?>">
- <label class="form-check-label-col" for="Radio<?=$item->id?>">
- <?=$item->text?>
- </label>
- </div>
- <?
- }
- $bghtml = str_replace(["\r", "\n", "'"], "", $this->render('_ask_item', ['answers'=>$answers]));
- ?>
- <script>
- window.bghtml || (window.bghtml = []);
- window.bghtml[<?=$model->id?>] = '<?=$bghtml?>';
- </script>
- <?
- }
- ?>
- </div>
- <button class="btn btn-primary mt-3 mx-4" onclick="sendask(<?=$model->id?>)">Голосовать</button>
- </div>
- </div>
- <?
- echo \yii\helpers\Html::endTag("div");
|