コード例 #1
0
ファイル: create.php プロジェクト: vladim1/yii2-user
use comyii\user\Module;
use comyii\user\widgets\AdminMenu;
/**
 * @var yii\web\View $this
 * @var comyii\user\models\User $model
 */
$m = $this->context->module;
$actions = $m->actionSettings;
$this->title = Yii::t('user', 'Create User');
$this->params['breadcrumbs'][] = ['label' => Yii::t('user', 'Users'), 'url' => [$actions[Module::ACTION_ADMIN_INDEX]]];
$this->params['breadcrumbs'][] = $this->title;
?>

<div class="page-header">
    <div class="pull-right"><?php 
echo AdminMenu::widget(['ui' => 'create', 'user' => $model]);
?>
</div>
    <h1><?php 
echo $this->title;
?>
</h1>
</div>
<?php 
$form = ActiveForm::begin(['type' => ActiveForm::TYPE_HORIZONTAL, 'formConfig' => ['labelSpan' => 4]]);
echo $form->errorSummary($model);
?>
<!-- dummy inputs to prevent auto fill -->
<input type="text" name="prevent_autofill" id="prevent_autofill" value="" style="display:none;" />
<input type="password" name="password_fake" id="password_fake" value="" style="display:none;" />
<div class="row">
コード例 #2
0
ファイル: index.php プロジェクト: vladim1/yii2-user
/**
 * @var yii\web\View $this
 * @var yii\data\ActiveDataProvider $dataProvider
 * @var comyii\user\models\UserSearch $searchModel
 */
$m = $this->context->module;
$this->title = Yii::t('user', 'Manage Users');
$this->params['breadcrumbs'][] = $this->title;
$class = $m->modelSettings[Module::MODEL_USER];
$config = Json::encode(['confirmMsg' => Yii::t('user', 'Batch update statuses for all selected users?'), 'alert1' => Yii::t('user', 'No users have been selected for batch update of status.'), 'alert2' => Yii::t('user', 'You have not chosen a status for update.'), 'elOut' => '#batch-status-out', 'url' => Url::to(['batch-update'])]);
$this->registerJs("var kvBatchUpdateConfig = {$config};", View::POS_HEAD);
AdminAsset::register($this);
?>
<div class="page-header">
    <div class="pull-right"><?php 
echo AdminMenu::widget(['ui' => 'list', 'user' => null]);
?>
</div>
    <h1><?php 
echo $this->title;
?>
</h1>
</div>
<div id="batch-status-out"></div>
<div style="width:200px;float:right;margin:-10px auto;">
<?php 
echo Select2::widget(['name' => 'batch-status', 'value' => '', 'data' => $m->getValidStatuses(), 'addon' => ['append' => ['content' => Html::button(Html::icon('saved'), ['class' => 'btn btn-default', 'id' => 'btn-batch-update', 'title' => Yii::t('user', 'Go!')]), 'asButton' => true]], 'options' => ['id' => 'batch-status', 'placeholder' => Yii::t('user', 'Batch update...')]]);
?>
</div>
<div class="clearfix"></div>
<?php 
コード例 #3
0
ファイル: view.php プロジェクト: communityii/yii2-user
$editSettings = $m->getEditSettingsAdmin($model);
$getKey = function ($key) use($model) {
    $settings = ['attribute' => $key, 'displayOnly' => true, 'format' => 'raw', 'value' => $model->{$key} ? '<samp>' . $model->{$key} . '</samp>' : null];
    return $settings;
};
$statusHtml = $model->getStatusHtml();
$attribs1 = [['group' => true, 'label' => $m->icon('tag') . ' ' . Yii::t('user', 'Account Details'), 'rowOptions' => ['class' => 'info']], 'id', 'username', 'email:email', ['attribute' => 'status', 'format' => 'raw', 'value' => empty($model->status_sec) ? $statusHtml : $statusHtml . ' ' . $model->getStatusSecHtml()], ['attribute' => 'created_on', 'format' => ['datetime', $m->datetimeDispFormat], 'labelColOptions' => ['style' => 'width:40%;text-align:right']]];
$attribs2 = [['group' => true, 'label' => $m->icon('time') . ' ' . Yii::t('user', 'User Log Information'), 'rowOptions' => ['class' => 'info']], ['attribute' => 'updated_on', 'format' => ['datetime', $m->datetimeDispFormat]], ['attribute' => 'last_login_ip', 'format' => 'raw', 'value' => $model->last_login_ip ? '<samp>' . $model->last_login_ip . '</samp>' : null], ['attribute' => 'last_login_on', 'value' => Module::displayAttrTime($model, 'last_login_on'), 'format' => ['datetime', $m->datetimeDispFormat], 'labelColOptions' => ['style' => 'width:40%;text-align:right']], ['attribute' => 'password_reset_on', 'value' => Module::displayAttrTime($model, 'password_reset_on'), 'format' => ['datetime', $m->datetimeDispFormat]], 'password_fail_attempts'];
$attribs3 = null;
if ($m->checkSettings($editSettings, 'showHiddenInfo')) {
    $attribs3 = [['group' => true, 'label' => $m->icon('lock') . ' ' . Yii::t('user', 'Hidden Information'), 'rowOptions' => ['class' => 'info']], $getKey('password_hash'), $getKey('auth_key'), $getKey('email_change_key'), $getKey('reset_key'), $getKey('activation_key')];
}
?>
    <div class="page-header">
        <div class="pull-right"><?php 
echo AdminMenu::widget(['ui' => 'manage', 'user' => $model]);
?>
</div>
        <h1><?php 
echo $this->title;
?>
</h1>
    </div>
    <div class="row">
        <div class="col-md-6">
            <?php 
echo DetailView::widget(['model' => $model, 'striped' => false, 'hover' => true, 'enableEditMode' => false, 'attributes' => $attribs1]);
?>
        </div>
        <div class="col-md-6">
            <?php 
コード例 #4
0
ファイル: update.php プロジェクト: vladim1/yii2-user
use comyii\user\Module;
use comyii\user\widgets\AdminMenu;
/**
 * @var yii\web\View $this
 * @var comyii\user\models\User $model
 */
$m = $this->context->module;
$actions = $m->actionSettings;
$this->title = Yii::t('user', 'Update User') . ' (' . $model->username . ')';
$this->params['breadcrumbs'][] = ['label' => Yii::t('user', 'Users'), 'url' => [$actions[Module::ACTION_ADMIN_INDEX]]];
$this->params['breadcrumbs'][] = ['label' => $model->username, 'url' => [$actions[Module::ACTION_ADMIN_VIEW], 'id' => $model->id]];
$this->params['breadcrumbs'][] = Yii::t('user', 'Update');
?>
<div class="page-header">
    <div class="pull-right"><?php 
echo AdminMenu::widget(['ui' => 'edit', 'user' => $model]);
?>
</div>
    <h1><?php 
echo $this->title;
?>
</h1>
</div>
<?php 
$form = ActiveForm::begin(['type' => ActiveForm::TYPE_HORIZONTAL, 'formConfig' => ['labelSpan' => 4]]);
?>
<div class="row">
    <div class="col-md-8">
        <?php 
if ($settings === true || $settings['changeUsername']) {
    echo $form->field($model, 'username')->textInput(['maxlength' => 128]);