_form.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. /**
  3. * Author: lf
  4. * Blog: https://blog.feehi.com
  5. * Email: job@feehi.com
  6. * Created at: 2016-03-25 11:15
  7. */
  8. /**
  9. * @var $this yii\web\View
  10. * @var $model common\models\User
  11. */
  12. use backend\widgets\ActiveForm;
  13. use common\models\User;
  14. $this->title = 'User';
  15. ?>
  16. <div class="col-sm-12">
  17. <div class="ibox">
  18. <?= $this->render('/widgets/_ibox-title') ?>
  19. <div class="ibox-content">
  20. <?php $form = ActiveForm::begin([
  21. 'options' => [
  22. 'enctype' => 'multipart/form-data',
  23. 'class' => 'form-horizontal'
  24. ]
  25. ]); ?>
  26. <?php
  27. $temp = ['maxlength' => 64];
  28. if (Yii::$app->controller->action->id == 'update') {
  29. $temp['disabled'] = 'disabled';
  30. }
  31. ?>
  32. <?= $form->field($model, 'username')->textInput($temp) ?>
  33. <div class="hr-line-dashed"></div>
  34. <?= $form->field($model, 'avatar')->imgInput() ?>
  35. <div class="hr-line-dashed"></div>
  36. <?= $form->field($model, 'email')->textInput(['maxlength' => 64]) ?>
  37. <div class="hr-line-dashed"></div>
  38. <?= $form->field($model, 'status')->radioList( User::getStatuses() ) ?>
  39. <div class="hr-line-dashed"></div>
  40. <?= $form->field($model, 'password')->textInput(['maxlength' => 512]) ?>
  41. <div class="hr-line-dashed"></div>
  42. <?= $form->field($model, 'repassword')->textInput(['maxlength' => 512]) ?>
  43. <div class="hr-line-dashed"></div>
  44. <?= $form->defaultButtons() ?>
  45. <?php ActiveForm::end(); ?>
  46. </div>
  47. </div>
  48. </div>