blob: 36fb51c0af43371dcfe5d94afcbb89f939091e7e [file] [log] [blame]
Copybara botbe50d492023-11-30 00:16:42 +01001<?php
2require_once(__DIR__."/../core.php");
3security::checkType(security::ADMIN, security::METHOD_NOTFOUND);
4
5if (!isset($_GET["id"])) {
6 security::notFound();
7}
8
9$p = people::get($_GET["id"]);
10
11if ($p === false) {
12 security::notFound();
13}
14?>
15
16<form action="doedituser.php" method="POST" autocomplete="off">
17 <h4 class="mdl-dialog__title">Edita persona</h4>
18 <div class="mdl-dialog__content">
19 <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
20 <input class="mdl-textfield__input" type="text" name="id" id="edit_id" value="<?=security::htmlsafe($p['id'])?>" readonly="readonly" autocomplete="off">
21 <label class="mdl-textfield__label" for="edit_nombre">ID</label>
22 </div>
23 <br>
24 <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
25 <input class="mdl-textfield__input" type="text" name="username" id="edit_username" value="<?=security::htmlsafe($p['username'])?>" autocomplete="off" data-required>
26 <label class="mdl-textfield__label" for="edit_username">Nombre de usuario</label>
27 </div>
28 <br>
29 <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
30 <input class="mdl-textfield__input" type="text" name="name" id="edit_name" value="<?=security::htmlsafe($p['name'])?>" autocomplete="off" data-required>
31 <label class="mdl-textfield__label" for="edit_name">Nombre</label>
32 </div>
33 <br>
34 <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
35 <input class="mdl-textfield__input" type="text" name="dni" id="edit_dni" value="<?=security::htmlsafe($p['dni'])?>" autocomplete="off">
36 <label class="mdl-textfield__label" for="edit_dni">DNI (opcional)</label>
37 </div>
38 <br>
39 <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
40 <input class="mdl-textfield__input" type="email" name="email" id="edit_email" value="<?=security::htmlsafe($p['email'])?>" autocomplete="off">
41 <label class="mdl-textfield__label" for="edit_email">Correo electrónico (opcional)</label>
42 </div>
43 <br>
44 <div class="mdlext-selectfield mdlext-js-selectfield mdlext-selectfield--floating-label">
45 <select name="category" id="edit_category" class="mdlext-selectfield__select">
46 <option value="-1"></option>
47 <?php
48 $categories = categories::getAll();
49 foreach ($categories as $id => $category) {
50 $selected = ($id == $p["categoryid"] ? " selected" : "");
51 echo '<option value="'.(int)$id.'"'.$selected.'>'.security::htmlsafe($category).'</option>';
52 }
53 ?>
54 </select>
55 <label for="edit_category" class="mdlext-selectfield__label">Categoría (opcional)</label>
56 </div>
57 <br>
58 <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
59 <input class="mdl-textfield__input" type="password" name="password" id="edit_password" autocomplete="off">
60 <label class="mdl-textfield__label" for="edit_password">Contraseña</label>
61 </div>
62 <p><?=security::htmlsafe(security::$passwordHelperText)?></p>
63 <div class="mdlext-selectfield mdlext-js-selectfield mdlext-selectfield--floating-label">
64 <select name="type" id="edit_type" class="mdlext-selectfield__select" data-required>
65 <?php
66 foreach (security::$types as $i => $type) {
67 $selected = ($i == $p["type"] ? " selected" : "");
68 echo '<option value="'.(int)$i.'"'.$selected.(security::isAllowed($i) ? "" : " disabled").'>'.security::htmlsafe($type).'</option>';
69 }
70 ?>
71 </select>
72 <label for="edit_type" class="mdlext-selectfield__label">Tipo</label>
73 </div>
74 </div>
75 <div class="mdl-dialog__actions">
76 <button type="submit" class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--accent">Confirmar</button>
77 <button data-dyndialog-close class="mdl-button mdl-js-button mdl-js-ripple-effect cancel">Cancelar</button>
78 </div>
79</form>