Exemple #1
0
    <?php 
$form = ActiveForm::begin(['id' => 'Admin', 'layout' => 'horizontal', 'enableClientValidation' => true, 'errorSummaryCssClass' => 'error-summary alert alert-error']);
?>

    <div class="">
        <?php 
$this->beginBlock('main');
?>

        <p>
            
			<?php 
echo $form->field($model, 'id')->textInput();
?>
			<?php 
echo $form->field($model, 'user_id')->dropDownList(\yii\helpers\ArrayHelper::map(common\models\user\User::find()->all(), 'id', 'id'), ['prompt' => 'Select']);
?>
			<?php 
echo $form->field($model, 'is_blocked')->textInput();
?>
			<?php 
echo $form->field($model, 'created_at')->textInput();
?>
			<?php 
echo $form->field($model, 'updated_at')->textInput();
?>
        </p>
        <?php 
$this->endBlock();
?>
        
Exemple #2
0
<?php 
echo $this->render('/_alert', ['module' => Yii::$app->getModule('user')]);
?>

<?php 
echo $this->render('_menu');
?>

<?php 
Pjax::begin();
?>

<?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'layout' => "{items}\n{pager}", 'columns' => [['attribute' => 'username', 'value' => function ($model) {
    return $model->username == null ? '<span class="not-set">' . Yii::t('user', '(not set)') . '</span>' : $model->username;
}, 'filter' => yii\helpers\ArrayHelper::map(common\models\user\User::find()->orderBy('username', 'ASC')->all(), 'username', 'username'), 'format' => 'html'], 'email:email', ['attribute' => 'registration_ip', 'value' => function ($model) {
    return $model->registration_ip == null ? '<span class="not-set">' . Yii::t('user', '(not set)') . '</span>' : $model->registration_ip;
}, 'format' => 'html'], ['attribute' => 'created_at', 'value' => function ($model) {
    return Yii::t('user', '{0, date, MMMM dd, YYYY HH:mm}', [$model->created_at]);
}, 'filter' => DatePicker::widget(['model' => $searchModel, 'attribute' => 'created_at', 'dateFormat' => 'php:Y-m-d', 'options' => ['class' => 'form-control']])], ['header' => Yii::t('user', 'Confirmation'), 'value' => function ($model) {
    if ($model->isConfirmed) {
        return '<div class="text-center"><span class="text-success">' . Yii::t('user', 'Confirmed') . '</span></div>';
    } else {
        return Html::a(Yii::t('user', 'Confirm'), ['confirm', 'id' => $model->id], ['class' => 'btn btn-xs btn-success btn-block', 'data-method' => 'post', 'data-confirm' => Yii::t('user', 'Are you sure you want to confirm this user?')]);
    }
}, 'format' => 'raw', 'visible' => Yii::$app->getModule('user')->enableConfirmation], ['header' => Yii::t('user', 'Block status'), 'value' => function ($model) {
    if ($model->isBlocked) {
        return Html::a(Yii::t('user', 'Unblock'), ['block', 'id' => $model->id], ['class' => 'btn btn-xs btn-success btn-block', 'data-method' => 'post', 'data-confirm' => Yii::t('user', 'Are you sure you want to unblock this user?')]);
    } else {
        return Html::a(Yii::t('user', 'Block'), ['block', 'id' => $model->id], ['class' => 'btn btn-xs btn-danger btn-block', 'data-method' => 'post', 'data-confirm' => Yii::t('user', 'Are you sure you want to block this user?')]);
    }
Exemple #3
0
echo $this->render('/_alert', ['module' => Yii::$app->getModule('user')]);
?>



<?php 
$actionCol = ['class' => 'kartik\\grid\\ActionColumn', 'template' => '{update} {delete}', 'header' => Yii::t('app', 'Tools'), 'vAlign' => 'middle'];
$columns = [['class' => 'kartik\\grid\\SerialColumn'], ['attribute' => 'id', 'width' => '50px'], ['attribute' => 'username', 'vAlign' => 'middle', 'width' => '180px', 'value' => function ($model) {
    return $model->username == null ? '<span class="not-set">' . Yii::t('user', '(not set)') . '</span>' : $model->username;
}, 'filterType' => GridView::FILTER_SELECT2, 'filter' => yii\helpers\ArrayHelper::map(common\models\user\User::find()->orderBy('username', 'ASC')->all(), 'username', 'username'), 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true]], 'filterInputOptions' => ['placeholder' => yii::t('app', 'Search')], 'format' => 'raw'], ['attribute' => 'email', 'vAlign' => 'middle', 'width' => '250px', 'value' => function ($model) {
    return $model->email == null ? '<span class="not-set">' . Yii::t('user', '(not set)') . '</span>' : $model->email;
}, 'filterType' => GridView::FILTER_SELECT2, 'filter' => yii\helpers\ArrayHelper::map(common\models\user\User::find()->orderBy('email', 'ASC')->all(), 'email', 'email'), 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true]], 'filterInputOptions' => ['placeholder' => yii::t('app', 'Search')], 'format' => 'raw'], ['attribute' => 'userRole', 'vAlign' => 'middle', 'width' => '250px', 'value' => function ($model) {
    return $model->userRole == null ? '<span class="not-set">' . Yii::t('user', '(not set)') . '</span>' : $model->userRole;
}, 'filterType' => GridView::FILTER_SELECT2, 'filter' => yii\helpers\ArrayHelper::map(backend\models\RoleTypes::find()->orderBy('name', 'ASC')->all(), 'id', 'name'), 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true]], 'filterInputOptions' => ['placeholder' => yii::t('app', 'Search')], 'format' => 'raw'], ['attribute' => 'registration_ip', 'vAlign' => 'middle', 'hAlign' => 'center', 'width' => '180px', 'value' => function ($model) {
    return $model->registration_ip == null ? '<span class="not-set">' . Yii::t('user', '(not set)') . '</span>' : $model->registration_ip;
}, 'filterType' => GridView::FILTER_SELECT2, 'filter' => yii\helpers\ArrayHelper::map(common\models\user\User::find()->orderBy('registration_ip', 'ASC')->all(), 'registration_ip', 'registration_ip'), 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true]], 'filterInputOptions' => ['placeholder' => yii::t('app', 'Search')], 'format' => 'raw'], ['attribute' => 'created_at', 'value' => function ($model) {
    return Yii::t('user', '{0, date, MMMM dd, YYYY HH:mm}', [$model->created_at]);
}, 'filter' => DatePicker::widget(['model' => $searchModel, 'attribute' => 'created_at', 'dateFormat' => 'php:Y-m-d', 'options' => ['class' => 'form-control']])], ['header' => Yii::t('user', 'Confirmation'), 'value' => function ($model) {
    if ($model->isConfirmed) {
        return '<div class="text-center"><span class="text-success">' . Yii::t('user', 'Confirmed') . '</span></div>';
    } else {
        return Html::a(Yii::t('user', 'Confirm'), ['confirm', 'id' => $model->id], ['class' => 'btn btn-xs btn-success btn-block', 'data-method' => 'post', 'data-confirm' => Yii::t('user', 'Are you sure you want to confirm this user?')]);
    }
}, 'format' => 'raw', 'visible' => Yii::$app->getModule('user')->enableConfirmation], ['header' => Yii::t('user', 'Block status'), 'value' => function ($model) {
    if ($model->isBlocked) {
        return Html::a(Yii::t('user', 'Unblock'), ['block', 'id' => $model->id], ['class' => 'btn btn-xs btn-success btn-block', 'data-method' => 'post', 'data-confirm' => Yii::t('user', 'Are you sure you want to unblock this user?')]);
    } else {
        return Html::a(Yii::t('user', 'Block'), ['block', 'id' => $model->id], ['class' => 'btn btn-xs btn-danger btn-block', 'data-method' => 'post', 'data-confirm' => Yii::t('user', 'Are you sure you want to block this user?')]);
    }
}, 'format' => 'raw'], $actionCol];
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => $columns, 'pjax' => true, 'pjaxSettings' => ['neverTimeout' => true, 'beforeGrid' => $this->render('_menu')]]);