12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <?php
- use yii\helpers\Html;
- use yii\helpers\Url;
- $this->title = $model->text;
- $this->params['breadcrumbs'][] = ['text' => 'Опросы', 'url' =>'/inquirer'];
- $url = '/inquirer/'.$model->id;
- Yii::$app->og->title = $model->text;
- Yii::$app->og->description = 'Опрос: '.$model->text;
- Yii::$app->og->canonical = $url;
- \Yii::$app->og->og_url = $url;
- \Yii::$app->og->og_type = "article";
- \Yii::$app->og->og_title = htmlspecialchars(Yii::$app->og->title);
- \Yii::$app->og->og_description = Yii::$app->og->description;
- \Yii::$app->og->dtpub = date( "r", strtotime( $model->dt_pub ) );
- \Yii::$app->og->og_image = "/img/amic-logo.svg";
- $do = $model->getPart();
- ?>
- <div class="row justify-content-md-center">
- <div class="col-md-10">
- <div id="post" class="post">
- <section class="text">
- <?=$this->render("/layouts/breadcrumbs")?>
- <h1>Опрос: <?=$model->text?></h1>
- <?
- if( $model->show == 'N' || $do ){
- $answers = $model->getAnswers();
- $sum = 0;
- foreach($answers as $item){
- $sum += $item->count;
- }
- foreach($answers as $item){
- $percent = ($sum)?round($item->count/$sum*100):0;
- ?>
- <div class="shadow-sm p-2 mt-3 bg-light rounded">
- <h4><?=$item->text?></h4>
- <div class="progress" style="height: 20px;">
- <div class="progress-bar bg-info" role="progressbar" style="width: <?=$percent?>%;" aria-valuenow="<?=$percent?>" aria-valuemin="0" aria-valuemax="100"><?=$percent?>%</div>
- </div>
- </div>
- <?
- }
- ?>
- </section>
- </div>
- </div>
- </div>
- <?
- }else{
- echo yii\base\View::render("poll",['id'=>$model->id, 'model'=>$model]);
- }
|