當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。