当前位置: 首页>>代码示例>>PHP>>正文


PHP User::getStatusesArray方法代码示例

本文整理汇总了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());
 }
开发者ID:Dominus77,项目名称:yii2-basic-start,代码行数:11,代码来源:UsersController.php

示例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}&nbsp;&nbsp;{permit}&nbsp;&nbsp;{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>
开发者ID:head26,项目名称:parsek,代码行数:30,代码来源:index.php

示例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>
开发者ID:head26,项目名称:parsek,代码行数:30,代码来源:_form.php


注:本文中的app\modules\user\models\User::getStatusesArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。