예제 #1
0
<?php

use yii\helpers\Html;
use common\themes\admin\widgets\ActiveForm;
use yii\bootstrap\Tabs;
use common\modules\users\models\User;
use common\modules\filemanager\widgets\Image;
use andreosoft\summernote\Summernote;
?>

<?php 
$form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data', 'boxTitle' => $options['title'], 'buttonUndo' => $options['buttonUndo']]]);
echo Tabs::widget(['options' => ['class' => 'nav-tabs-custom'], 'items' => [['label' => \Yii::t('users/main', 'Main'), 'content' => $form->field($model, 'username')->textInput(['maxlength' => 255]) . $form->field($model, 'email')->textInput(['maxlength' => 255]) . $form->field($model, 'status')->dropDownList(User::getStatusArray()) . $form->field($model, 'role')->dropDownList(User::getRoleArray()) . Html::a('Изменить пароль', ['new-password', 'id' => $model->id], ['class' => 'btn btn-primary'])], ['label' => \Yii::t('users/main', 'Profile'), 'content' => $form->field($modelProfile, 'fullname')->textInput(['maxlength' => 255]) . $form->field($modelProfile, 'phone')->textInput(['maxlength' => 255]) . $form->field($modelProfile, 'website')->textInput(['maxlength' => 255]) . $form->field($modelProfile, 'skype')->textInput(['maxlength' => 255]) . $form->field($modelProfile, 'image')->widget(Image::className())], ['label' => \Yii::t('users/main', 'Adress'), 'content' => $form->field($modelProfile, 'country')->textInput(['maxlength' => 255]) . $form->field($modelProfile, 'state')->textInput(['maxlength' => 255]) . $form->field($modelProfile, 'zip')->textInput(['maxlength' => 255]) . $form->field($modelProfile, 'city')->textInput(['maxlength' => 255]) . $form->field($modelProfile, 'address')->textInput(['maxlength' => 255]) . $form->field($modelProfile, 'geopoint_latitude')->textInput(['maxlength' => 255]) . $form->field($modelProfile, 'geopoint_longitude')->textInput(['maxlength' => 255])], ['label' => \Yii::t('users/main', 'About'), 'content' => $form->field($modelProfile, 'about')->widget(Summernote::className(), ['editorOptions' => ['height' => 200]])]]]);
?>

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

예제 #2
0
    <?php 
echo GridView::widget(['options' => ['boxTitle' => $this->title, 'buttonCreate' => Url::to(['create', 'class' => $class]), 'buttonUndo' => Url::home(), 'buttonDelete' => Url::to(['batch-delete'])], 'id' => 'main-grid', 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => CheckboxColumn::classname()], 'username', 'email', ['attribute' => 'status', 'format' => 'html', 'value' => function ($model) {
    if ($model->status === User::STATUS_ACTIVE) {
        $class = 'label-success';
        $lable = User::getStatusArray()[$model->status];
    } elseif ($model->status === User::STATUS_INACTIVE) {
        $class = 'label-default';
        $lable = User::getStatusArray()[$model->status];
    } elseif ($model->status === User::STATUS_BANNED) {
        $class = 'label-danger';
        $lable = User::getStatusArray()[$model->status];
    } elseif ($model->status === User::STATUS_DELETED) {
        $class = 'label-warning';
        $lable = User::getStatusArray()[$model->status];
    }
    return '<span class="label ' . $class . '">' . $lable . '</span>';
}, 'filter' => Html::activeDropDownList($searchModel, 'status', User::getStatusArray(), ['class' => 'form-control', 'prompt' => 'Выберите статус'])], ['attribute' => 'role', 'format' => 'html', 'value' => function ($model) {
    if ($model->role === User::ROLE_ADMIN) {
        $class = 'label-danger';
        $lable = User::getRoleArray()[$model->role];
    } elseif ($model->role === User::ROLE_MANAGER) {
        $class = 'label-primary';
        $lable = User::getRoleArray()[$model->role];
    } elseif ($model->role === User::ROLE_USER) {
        $class = 'label-default';
        $lable = User::getRoleArray()[$model->role];
    }
    return '<span class="label ' . $class . '">' . $lable . '</span>';
}, 'filter' => Html::activeDropDownList($searchModel, 'role', User::getRoleArray(), ['class' => 'form-control', 'prompt' => 'Выберите роль'])], ['class' => 'common\\themes\\admin\\widgets\\ActionColumn']]]);