* @var app\models\Poll $model */ ?> <?php // Populate the attribute array for display. $attributes = ['question:ntext', 'info:ntext']; foreach ($model->getOptions()->all() as $index => $option) { $no = $index + 1; $attributes[] = ['attribute' => "Option {$no}", 'value' => $option->text]; } ?> <?php echo Html::tag('h2', Poll::label(1)); ?> <p> <?php if ($model->isLocked()) { echo AlertBlock::widget(['useSessionFlash' => false, 'type' => AlertBlock::TYPE_ALERT, 'delay' => false, 'alertSettings' => ['warning' => ['type' => Alert::TYPE_WARNING, 'body' => Yii::t('app', 'This poll cannot be edited because it has already been accessed by a voter'), 'closeButton' => false]]]); } ?> <?php echo Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary' . ($model->isLocked() ? ' disabled' : null)]); ?> <?php echo Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), 'method' => 'post']]); ?> <?php
<?php use yii\helpers\Html; use app\models\Poll; /** * @var yii\web\View $this * @var app\models\Poll $model */ $this->title = Yii::t('app', 'Update {modelClass}: ', ['modelClass' => Poll::label(1)]) . ' ' . $model->__toString(); $this->params['breadcrumbs'][] = ['label' => Poll::label(2), 'url' => ['index']]; $this->params['breadcrumbs'][] = ['label' => $model->__toString(), 'url' => ['view', 'id' => $model->id]]; $this->params['breadcrumbs'][] = Yii::t('app', 'Update'); ?> <div class="poll-update"> <div class="page-header"> <h1><?php echo Html::encode($this->title); ?> </h1> </div> <?php echo $this->render('_form', ['model' => $model, 'modelOptions' => $modelOptions]); ?> <?php echo $this->render('//system/leaving_prompt'); ?> </div>
use yii\helpers\Html; use yii\grid\GridView; use app\models\Poll; /** * @var yii\web\View $this * @var yii\data\ActiveDataProvider $dataProvider * @var app\models\search\PollSearch $searchModel */ $this->title = Yii::t('app', Poll::label(2)); $this->params['breadcrumbs'][] = $this->title; ?> <div class="poll-index"> <div class="page-header"> <h1><?php echo Html::encode($this->title); ?> </h1> </div> <?php // echo $this->render('_search', ['model' => $searchModel]); ?> <p> <?php echo Html::a(Yii::t('app', 'Create {modelClass}', ['modelClass' => Poll::label(1)]), ['create'], ['class' => 'btn btn-success']); ?> </p> <?php echo $this->render('_grid', ['dataProvider' => $dataProvider, 'searchModel' => $searchModel]); ?> </div>