edit.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <?php use App\Utils\Url, App\Utils\Html, Respect\Validation\Validator as v ?>
  2. <?php $app->render('layouts/header', ['title' => 'Edit user']) ?>
  3. <?php $app->render('layouts/navbar', ['app' => $app]) ?>
  4. <h1>Edit user</h1>
  5. <?php $app->render('layouts/alerts/error', ['error' => $error]) ?>
  6. <?php $app->render('layouts/alerts/success', ['success' => $success]) ?>
  7. <a href="<?= Url::build('users') ?>">
  8. < Back
  9. </a>
  10. <form method="post" action="<?= Url::build(['users', 'update', $user['id']]) ?>">
  11. <fieldset>
  12. <legend>User editing</legend>
  13. <div class="form-group">
  14. <label for="email">
  15. Email:
  16. </label>
  17. <input
  18. type="email"
  19. id="email"
  20. name="email"
  21. placeholder="Enter email"
  22. minlength="4"
  23. maxlength="255"
  24. required
  25. value="<?= Html::escape($user['email']) ?>">
  26. <small class="text-error"><?= Html::escape($validations['email']) ?></small>
  27. </div>
  28. <div class="form-group">
  29. <label for="username">
  30. Username:
  31. </label>
  32. <input
  33. type="text"
  34. id="username"
  35. name="username"
  36. placeholder="Enter username"
  37. minlength="4"
  38. maxlength="32"
  39. required
  40. value="<?= Html::escape($user['username']) ?>">
  41. <small class="text-error"><?= Html::escape($validations['username']) ?></small>
  42. </div>
  43. <div class="form-group">
  44. <label for="active">
  45. Active:
  46. </label>
  47. <input
  48. type="checkbox"
  49. id="active"
  50. name="active"
  51. value="true"
  52. <?= v::notOptional()->trueVal()->validate($user['active']) ? 'checked' : '' ?>>
  53. <small class="text-error"><?= Html::escape($validations['active']) ?></small>
  54. </div>
  55. <div class="form-group">
  56. <label for="is_admin">
  57. Is admin?:
  58. </label>
  59. <input
  60. type="checkbox"
  61. id="is_admin"
  62. name="is_admin"
  63. value="true"
  64. <?= v::notOptional()->trueVal()->validate($user['is_admin']) ? 'checked' : '' ?>>
  65. <small class="text-error"><?= Html::escape($validations['is_admin']) ?></small>
  66. </div>
  67. <div class="form-group">
  68. <label for="password">
  69. Password:
  70. </label>
  71. <input
  72. type="password"
  73. id="password"
  74. name="password"
  75. placeholder="Enter password"
  76. minlength="8"
  77. maxlength="64"
  78. value="">
  79. <small class="text-error"><?= Html::escape($validations['password']) ?></small>
  80. </div>
  81. <div class="form-group">
  82. <label for="pass_confirm">
  83. Confirm password:
  84. </label>
  85. <input
  86. type="password"
  87. id="pass_confirm"
  88. name="pass_confirm"
  89. placeholder="Confirm password"
  90. minlength="8"
  91. maxlength="64"
  92. value="">
  93. <small class="text-error"><?= Html::escape($validations['pass_confirm']) ?></small>
  94. </div>
  95. <input type="submit" name="submit" value="Save" class="btn btn-default">
  96. </fieldset>
  97. </form>
  98. <?php $app->render('layouts/footer') ?>