use yii\helpers\Html; use yii\grid\GridView; use app\models\MActivity; /* @var $this yii\web\View */ /* @var $searchModel app\models\MActivitySearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = '活动管理'; $this->params['breadcrumbs'][] = $this->title; ?> <div class="mactivity-index"> <!--<h1><//?= Html::encode($this->title) ?></h1>--> <?php // echo $this->render('_search', ['model' => $searchModel]); ?> <p> <?php echo Html::a('创建活动', ['create'], ['class' => 'btn btn-success']); ?> </p> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'options' => ['class' => 'table-responsive'], 'tableOptions' => ['class' => 'table table-striped'], 'columns' => ['id', 'title', 'start_time', 'end_time', ['attribute' => 'status', 'value' => function ($model, $key, $index, $column) { return MActivity::getStatusOptionName($model->status); }, 'filter' => MActivity::getStatusOptionName(), 'headerOptions' => array('style' => 'width:200px;')], 'iids', ['class' => 'yii\\grid\\ActionColumn']]]); ?> </div>
use yii\helpers\Html; use yii\widgets\DetailView; use app\models\MActivity; /* @var $this yii\web\View */ /* @var $model app\models\MActivity */ $this->title = $model->title; $this->params['breadcrumbs'][] = ['label' => '活动管理', 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?> <div class="mactivity-view"> <h1><?php echo Html::encode($this->title); ?> </h1> <p> <?php echo Html::a('修改', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']); ?> <?php echo Html::a('删除', ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => 'Are you sure you want to delete this item?', 'method' => 'post']]); ?> </p> <?php echo DetailView::widget(['model' => $model, 'attributes' => ['id', 'gh_id', 'start_time', 'end_time', 'title', 'descr', ['attribute' => 'status', 'value' => MActivity::getStatusOptionName($model->status)], 'iids']]); ?> </div>