本文整理汇总了PHP中app\models\User::getStatuses方法的典型用法代码示例。如果您正苦于以下问题:PHP User::getStatuses方法的具体用法?PHP User::getStatuses怎么用?PHP User::getStatuses使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\User
的用法示例。
在下文中一共展示了User::getStatuses方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionIndex
public function actionIndex()
{
$userSearch = new UserSearch();
$dataProvider = $userSearch->search(Yii::$app->request->get());
$statuses = User::getStatuses();
return $this->render('index', ['userSearch' => $userSearch, 'dataProvider' => $dataProvider, 'statuses' => $statuses, 'roles' => Yii::$app->authManager->getRoles()]);
}
示例2: testGetStatuses
public function testGetStatuses()
{
$user = new User();
$statuses = $user->getStatuses();
expect_that(is_array($statuses));
expect(count($statuses))->equals(3);
}
示例3: edit
public function edit(User $user)
{
$roles = Role::lists('name', 'id');
return view('backend.users.edit')->with('user', $user)->with('statuses', User::getStatuses())->with('roles', $roles);
}
示例4:
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model app\models\User */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="user-form">
<?php
$form = ActiveForm::begin();
?>
<?php
echo $form->field($model, 'status')->dropDownList(\app\models\User::getStatuses());
?>
<div class="form-group">
<?php
echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
</div>
<?php
ActiveForm::end();
?>
</div>
示例5: array
<?php
$actions = array('index' => 'View All', 'create' => 'New User');
$menu = array();
foreach ($actions as $action => $label) {
$menu[] = array('url' => array('users', $action), 'label' => $label, 'htmlOptions' => $action == $this->getActiveAction() ? array('class' => 'selected') : array());
}
echo \app\components\htmltools\Page::title('Users - ' . $actions[$this->getActiveAction()], $menu);
\mpf\widgets\datatable\Table::get(array('dataProvider' => $model->getDataProvider(), 'multiSelect' => true, 'multiSelectActions' => array('delete' => ['label' => 'Delete', 'icon' => \mpf\web\AssetsPublisher::get()->mpfAssetFile('images/oxygen/16x16/actions/edit-delete.png'), 'shortcut' => 'Shift+Delete', 'url' => \mpf\WebApp::get()->request()->createURL("users", "delete"), 'confirmation' => 'Are you sure?'], 'enable' => ['label' => 'Enable', 'icon' => \mpf\web\AssetsPublisher::get()->mpfAssetFile('images/oxygen/16x16/actions/dialog-ok-apply.png'), 'url' => \mpf\WebApp::get()->request()->createURL("users", "index")], 'disable' => ['label' => 'Disable', 'icon' => \mpf\web\AssetsPublisher::get()->mpfAssetFile('images/oxygen/16x16/actions/dialog-cancel.png'), 'url' => \mpf\WebApp::get()->request()->createURL("users", "index")], 'join' => ['label' => 'Join Accounts', 'icon' => \mpf\web\AssetsPublisher::get()->mpfAssetFile('images/oxygen/16x16/actions/im-msn.png'), 'url' => \mpf\WebApp::get()->request()->createURL("users", "merge"), 'confirmation' => 'Are you sure? After this user can log in on any of those accounts and see data from all of them.[where this is supported]']), 'columns' => array('name', 'email', 'register_date' => array('class' => 'Date'), 'last_login' => array('class' => 'Date'), 'last_login_source' => array('filter' => array('post' => 'POST', 'cookie' => 'Cookie', 'facebook' => 'Facebook', 'google' => 'Google')), 'status' => array('class' => 'Select', 'filter' => \app\models\User::getStatuses()), array('class' => 'Actions', 'buttons' => array('delete' => array('class' => 'Delete'), 'edit' => array('class' => 'Edit'), 'view' => array('class' => 'View')), 'headerHtmlOptions' => array('style' => 'width:60px;'), 'topButtons' => array('add' => array('class' => 'Add'))))))->display();
示例6: rules
/**
* @inheritdoc
*/
public function rules()
{
return [[['username', 'email', 'ip', 'role'], 'string'], ['date_create', 'date', 'format' => 'yyyy-mm-dd'], ['status', 'integer'], ['status', 'in', 'range' => array_keys(User::getStatuses())]];
}