本文整理汇总了PHP中app\modules\user\models\User::getStatusesArray方法的典型用法代码示例。如果您正苦于以下问题:PHP User::getStatusesArray方法的具体用法?PHP User::getStatusesArray怎么用?PHP User::getStatusesArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\modules\user\models\User
的用法示例。
在下文中一共展示了User::getStatusesArray方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionCreate
public function actionCreate()
{
$model = new User();
$this->readValue($model, 'username');
$this->readValue($model, 'email');
$model->setPassword($this->prompt('Password:', ['required' => true, 'pattern' => '#^.{6,255}$#i', 'error' => 'More than 6 symbols']));
$model->generateAuthKey();
$model->role = $this->select('Role:', User::getRolesArray());
$model->status = $this->select('Status:', User::getStatusesArray());
$this->log($model->save());
}
示例2: function
use app\common\components\grid\SetColumn;
use kartik\date\DatePicker;
use app\common\components\grid\LinkColumn;
/* @var $this yii\web\View */
/* @var $searchModel \app\modules\user\models\SearchUser */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Пользователи';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="user-default-index">
<h1><?php
echo Html::encode($this->title);
?>
</h1>
<?php
// echo $this->render('_search', ['model' => $searchModel]);
?>
<p>
<?php
echo Html::a('Create User', ['create'], ['class' => 'btn btn-success']);
?>
</p>
<?php
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'id', ['class' => LinkColumn::className(), 'attribute' => 'username'], 'email:email', ['filter' => DatePicker::widget(['model' => $searchModel, 'attribute' => 'created_at', 'type' => DatePicker::TYPE_INPUT, 'separator' => '-', 'pluginOptions' => ['format' => 'yyyy-mm-dd']]), 'attribute' => 'created_at', 'format' => 'datetime'], ['class' => SetColumn::className(), 'filter' => User::getStatusesArray(), 'attribute' => 'status', 'name' => 'statusName', 'cssCLasses' => [User::STATUS_ACTIVE => 'success', User::STATUS_BLOCKED => 'default']], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{update} {permit} {delete}', 'buttons' => ['permit' => function ($url, $model) {
return Html::a('<span class="glyphicon glyphicon-wrench"></span>', Url::to(['/permit/user/view', 'id' => $model->id]), ['title' => Yii::t('yii', 'Change user role')]);
}]]]]);
?>
</div>
示例3:
$form = ActiveForm::begin();
?>
<?php
echo $form->field($model, 'username')->textInput(['maxlength' => true]);
?>
<?php
echo $form->field($model, 'password_hash')->textInput(['maxlength' => true])->passwordInput();
?>
<?php
echo $form->field($model, 'email')->textInput(['maxlength' => true]);
?>
<?php
echo $form->field($model, 'status')->dropDownList(\app\modules\user\models\User::getStatusesArray());
?>
<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>