示例#1
0
<?php

use app\models\filedb\IdentityStatus;
use yii\grid\GridView;
use yii2tech\admin\grid\ActionColumn;
use yii\helpers\ArrayHelper;
use yii2tech\admin\grid\DeleteStatusColumn;
/* @var $this yii\web\View */
/* @var $searchModel app\models\backend\AdminSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('admin', 'Administrators');
$this->params['breadcrumbs'][] = $this->title;
$this->params['contextMenuItems'] = [['create']];
?>

<?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => ['id', 'username', 'email:email', ['class' => DeleteStatusColumn::className(), 'attribute' => 'statusId', 'filter' => ArrayHelper::map(IdentityStatus::find()->all(), 'id', 'name'), 'value' => function ($data) {
    return $data->status->name;
}], ['attribute' => 'createdAt', 'format' => 'date', 'filter' => false], ['class' => ActionColumn::className()]]]);
示例#2
0
<div class="row">
    <div class="col-lg-5">

        <?php 
$form = ActiveForm::begin();
?>

        <?php 
echo $form->field($model, 'username')->textInput(['maxlength' => true]);
?>

        <?php 
echo $form->field($model, 'email')->textInput(['maxlength' => true]);
?>

        <?php 
echo $form->field($model, 'statusId')->dropDownList(ArrayHelper::map(IdentityStatus::find()->all(), 'id', 'name'));
?>

        <div class="form-group">
            <?php 
echo Html::submitButton($model->isNewRecord ? Yii::t('admin', 'Create') : Yii::t('admin', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
        </div>

        <?php 
ActiveForm::end();
?>

    </div>
</div>
示例#3
0
 /**
  * @return \yii\db\ActiveQuery relation query
  */
 public function getStatus()
 {
     return $this->hasOne(IdentityStatus::className(), ['id' => 'statusId']);
 }