use yii\helpers\Html; use yii\widgets\DetailView; /* @var $this yii\web\View */ /* @var $model backend\models\Table */ $this->title = $model->name; $this->params['breadcrumbs'][] = ['label' => 'Tables', 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?> <div class="table-view"> <h1><?php echo Html::encode($this->title); ?> </h1> <p> <?php echo Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']); ?> <?php echo Html::a('Delete', ['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', 'name', 'system_name', 'description', ['attribute' => 'status', 'value' => \backend\models\Table::getStatuses($model->status)], 'created_at', 'updated_at']]); ?> </div>
/* @var $searchModel backend\models\TableSearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = 'Tables'; $this->params['breadcrumbs'][] = $this->title; ?> <div class="table-index"> <h1><?php echo Html::encode($this->title); ?> </h1> <?php // echo $this->render('_search', ['model' => $searchModel]); ?> <p> <?php echo Html::a('Create Table', ['create'], ['class' => 'btn btn-success']); ?> </p> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'id', 'name', 'system_name', 'description', ['attribute' => 'status', 'value' => function ($model) { return \backend\models\Table::getStatuses($model->status); }], ['class' => 'yii\\grid\\ActionColumn', 'buttons' => ['list' => function () { return \yii\helpers\Html::a('<span class="glyphicon glyphicon-th-list"></span>', '', ['title' => 'Fields List']); }], 'template' => '{view}{update}{list}{delete}']]]); ?> </div>
<div class="table-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'name')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'description')->textArea(['maxlength' => true]); ?> <?php echo $model->isNewRecord ? '' : $form->field($model, 'status')->dropDownList(Table::getStatuses()); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?> </div>