本文整理汇总了PHP中common\models\User::getStatusList方法的典型用法代码示例。如果您正苦于以下问题:PHP User::getStatusList方法的具体用法?PHP User::getStatusList怎么用?PHP User::getStatusList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common\models\User
的用法示例。
在下文中一共展示了User::getStatusList方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: function
use yii\helpers\Html;
use yii\widgets\Pjax;
use kartik\date\DatePicker;
use common\models\User;
$this->title = '用户列表';
?>
<div class="row">
<div class="col-lg-12">
<?php
Pjax::begin();
?>
<?php
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'tableOptions' => ['class' => 'table table-striped table-bordered table-center'], 'summaryOptions' => ['tag' => 'p', 'class' => 'text-right text-info'], 'columns' => [['class' => 'yii\\grid\\SerialColumn', 'headerOptions' => ['class' => 'col-md-1']], ['attribute' => 'mobile', 'headerOptions' => ['class' => 'col-md-2'], 'filterInputOptions' => ['class' => 'form-control input-sm']], ['attribute' => 'nickname', 'headerOptions' => ['class' => 'col-md-2'], 'filterInputOptions' => ['class' => 'form-control input-sm']], ['attribute' => 'gender', 'filter' => User::getGenderList(), 'filterInputOptions' => ['class' => 'form-control input-sm'], 'headerOptions' => ['class' => 'col-md-1'], 'value' => function ($model, $key, $index, $column) {
return $model->genderMsg;
}], ['attribute' => 'email', 'headerOptions' => ['class' => 'col-md-2'], 'filterInputOptions' => ['class' => 'form-control input-sm']], ['attribute' => 'status', 'format' => 'raw', 'filter' => User::getStatusList(), 'filterInputOptions' => ['class' => 'form-control input-sm'], 'headerOptions' => ['class' => 'col-md-1'], 'value' => function ($model, $key, $index, $column) {
return Html::dropDownList('status', $model->status, User::getStatusList(), ['data-id' => $model->id]);
}], ['attribute' => 'created_at', 'format' => ['date', 'php:Y-m-d H:i'], 'filter' => DatePicker::widget(['model' => $searchModel, 'type' => DatePicker::TYPE_COMPONENT_APPEND, 'attribute' => 'date', 'options' => ['class' => 'input-sm'], 'pluginOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd']]), 'headerOptions' => ['class' => 'col-md-2']], ['class' => 'yii\\grid\\ActionColumn', 'header' => '操作', 'headerOptions' => ['class' => 'col-md-1'], 'template' => '{view}']]]);
?>
<?php
Pjax::end();
?>
</div>
</div>
<?php
$url = Url::to(['/user/status']);
$js = <<<JS
var handle = function () {
var id = \$(this).attr('data-id');
var status = \$(this).val();
\$.ajax({
url: '{$url}?id=' + id ,
示例2:
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model common\models\User */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="user-form">
<?php
$form = ActiveForm::begin();
?>
<?php
echo $form->field($model, 'role')->widget(Select2::classname(), ['data' => User::getRoleList(), 'options' => ['placeholder' => '选择一个权限', 'hideSearch' => true]]);
?>
<?php
echo $form->field($model, 'status')->widget(Select2::classname(), ['data' => User::getStatusList(), 'options' => ['placeholder' => '选择一个状态', 'hideSearch' => true]]);
?>
<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>
示例3:
</div>
<div class="box-body">
<?php
echo $form->field($model, 'username')->textInput(['maxlength' => true]);
?>
<?php
echo $form->field($model, 'email')->textInput(['maxlength' => true]);
?>
<?php
echo $form->field($model, 'group_id')->dropDownList(Group::getList());
?>
<?php
echo $form->field($model, 'status')->dropDownList(User::getStatusList());
?>
<?php
echo $form->field($model, 'password')->passwordInput();
?>
</div>
</div>
</div>
<div class="col-md-8">
</div>
</div>
<?php
echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
示例4:
<?php
use common\models\Group;
use yii\helpers\Html;
use yii\grid\GridView;
use common\models\User;
use backend\components\SetColumn;
/* @var $this yii\web\View */
/* @var $searchModel backend\models\UserSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('app', 'Users');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="box">
<div class="box-body table-responsive">
<?php
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['attribute' => 'id', 'headerOptions' => ['width' => '50']], 'username', 'email:email', ['class' => SetColumn::className(), 'attribute' => 'group_id', 'filter' => Group::getList(), 'name' => 'group.name'], ['class' => SetColumn::className(), 'attribute' => 'status', 'filter' => User::getStatusList(), 'name' => 'statusName', 'cssClasses' => [User::STATUS_DELETED => 'default', User::STATUS_ACTIVE => 'success']], ['attribute' => 'created_at', 'format' => ['date', 'dd.MM.Y']], ['class' => 'yii\\grid\\ActionColumn', 'headerOptions' => ['width' => '50'], 'template' => '{update} {delete}']]]);
?>
</div>
<div class="box-footer">
<?php
echo Html::a(Yii::t('app', 'Create'), ['create'], ['class' => 'btn btn-success']);
?>
</div>
</div>
示例5:
?>
<!---->
<!-- --><?php
//= $form->field($model, 'password_hash')
?>
<!---->
<!-- --><?php
//= $form->field($model, 'password_reset_token')
?>
<?php
echo $form->field($model, 'email');
?>
<?php
echo $form->field($model, 'status_id')->dropDownList(User::getStatusList(), ['prompt' => 'Please choose one']);
?>
<?php
// echo $form->field($model, 'created_at')
?>
<?php
// echo $form->field($model, 'updated_at')
?>
<?php
echo $form->field($model, 'role_id')->dropDownList(User::getRoleList(), ['prompt' => 'Please choose one']);
?>
<?php