Exemplo n.º 1
0
    <div class="hr-line-dashed"></div>
    <?php 
echo $form->field($model, 'role', ['wrapperOptions' => ['class' => 'col-sm-2']])->dropDownList(UserHelper::getRoles());
?>

    <h3>Доступ</h3>
    <div class="hr-line-dashed"></div>
    <?php 
$generateRandomPasswordLink = '<span class="generate-random-password"><a>Сгенерировать</a></span>';
echo $form->field($model, 'password', ['wrapperOptions' => ['class' => 'col-sm-4'], 'template' => "{label}\n{beginWrapper}\n{input}\n{hint}\n{error}\n{endWrapper}{$generateRandomPasswordLink}"])->textInput(['value' => '']);
?>

    <h3>Активность</h3>
    <div class="hr-line-dashed"></div>
    <?php 
echo $form->field($model, 'status')->radioList(UserHelper::getStatuses());
?>

    <div class="form-group">
        <div class="col-sm-4 col-sm-offset-2">
            <?php 
if ($model->getUserId()) {
    $buttonName = 'Изменить данные';
} else {
    $buttonName = 'Добавить пользователя';
}
?>
            <?php 
echo Html::submitButton($buttonName, ['class' => 'btn btn-primary']);
?>
        </div>
Exemplo n.º 2
0
</td>
                        <td>
                            <?php 
        if (User::STATUS_DISABLED == $user->getStatus()) {
            $statusLabelClass = 'default';
        } elseif (User::STATUS_DELETED == $user->getStatus()) {
            $statusLabelClass = 'danger';
        } else {
            $statusLabelClass = 'primary';
        }
        ?>
                            <span class="label label-<?php 
        echo $statusLabelClass;
        ?>
"><?php 
        echo UserHelper::getStatuses()[$user->getStatus()];
        ?>
</span>
                        </td>
                        <td>
                            <?php 
        if (Yii::$app->user->can('userAccess', ['userId' => $user->getId(), 'action' => 'delete'])) {
            ?>
                                <a href="<?php 
            echo Url::to(['/user/delete', 'id' => $user->getId()]);
            ?>
">
                                    <i class="fa fa-trash"></i>
                                </a>
                            <?php 
        }