blob: d029d0eed4b60870a1e0cf5750c13c99d85fbc5e [file] [log] [blame]
Copybara botbe50d492023-11-30 00:16:42 +01001<?php
Adrià Vilanova Martínez5af86512023-12-02 20:44:16 +01002/*
3 * hores
4 * Copyright (c) 2023 Adrià Vilanova Martínez
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Affero General Public License as
8 * published by the Free Software Foundation, either version 3 of the
9 * License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Affero General Public License for more details.
15 *
16 * You should have received a copy of the GNU Affero General Public
17 * License along with this program.
18 * If not, see http://www.gnu.org/licenses/.
19 */
20
Copybara botbe50d492023-11-30 00:16:42 +010021require_once(__DIR__."/../core.php");
22security::checkType(security::ADMIN, security::METHOD_NOTFOUND);
23
24if (!isset($_GET["id"])) {
25 security::notFound();
26}
27
28$p = people::get($_GET["id"]);
29
30if ($p === false) {
31 security::notFound();
32}
33?>
34
35<form action="doedituser.php" method="POST" autocomplete="off">
36 <h4 class="mdl-dialog__title">Edita persona</h4>
37 <div class="mdl-dialog__content">
38 <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
39 <input class="mdl-textfield__input" type="text" name="id" id="edit_id" value="<?=security::htmlsafe($p['id'])?>" readonly="readonly" autocomplete="off">
40 <label class="mdl-textfield__label" for="edit_nombre">ID</label>
41 </div>
42 <br>
43 <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
44 <input class="mdl-textfield__input" type="text" name="username" id="edit_username" value="<?=security::htmlsafe($p['username'])?>" autocomplete="off" data-required>
45 <label class="mdl-textfield__label" for="edit_username">Nombre de usuario</label>
46 </div>
47 <br>
48 <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
49 <input class="mdl-textfield__input" type="text" name="name" id="edit_name" value="<?=security::htmlsafe($p['name'])?>" autocomplete="off" data-required>
50 <label class="mdl-textfield__label" for="edit_name">Nombre</label>
51 </div>
52 <br>
53 <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
54 <input class="mdl-textfield__input" type="text" name="dni" id="edit_dni" value="<?=security::htmlsafe($p['dni'])?>" autocomplete="off">
55 <label class="mdl-textfield__label" for="edit_dni">DNI (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="email" name="email" id="edit_email" value="<?=security::htmlsafe($p['email'])?>" autocomplete="off">
60 <label class="mdl-textfield__label" for="edit_email">Correo electrónico (opcional)</label>
61 </div>
62 <br>
63 <div class="mdlext-selectfield mdlext-js-selectfield mdlext-selectfield--floating-label">
64 <select name="category" id="edit_category" class="mdlext-selectfield__select">
65 <option value="-1"></option>
66 <?php
67 $categories = categories::getAll();
68 foreach ($categories as $id => $category) {
69 $selected = ($id == $p["categoryid"] ? " selected" : "");
70 echo '<option value="'.(int)$id.'"'.$selected.'>'.security::htmlsafe($category).'</option>';
71 }
72 ?>
73 </select>
74 <label for="edit_category" class="mdlext-selectfield__label">Categoría (opcional)</label>
75 </div>
76 <br>
77 <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
78 <input class="mdl-textfield__input" type="password" name="password" id="edit_password" autocomplete="off">
79 <label class="mdl-textfield__label" for="edit_password">Contraseña</label>
80 </div>
81 <p><?=security::htmlsafe(security::$passwordHelperText)?></p>
82 <div class="mdlext-selectfield mdlext-js-selectfield mdlext-selectfield--floating-label">
83 <select name="type" id="edit_type" class="mdlext-selectfield__select" data-required>
84 <?php
85 foreach (security::$types as $i => $type) {
86 $selected = ($i == $p["type"] ? " selected" : "");
87 echo '<option value="'.(int)$i.'"'.$selected.(security::isAllowed($i) ? "" : " disabled").'>'.security::htmlsafe($type).'</option>';
88 }
89 ?>
90 </select>
91 <label for="edit_type" class="mdlext-selectfield__label">Tipo</label>
92 </div>
93 </div>
94 <div class="mdl-dialog__actions">
95 <button type="submit" class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--accent">Confirmar</button>
96 <button data-dyndialog-close class="mdl-button mdl-js-button mdl-js-ripple-effect cancel">Cancelar</button>
97 </div>
98</form>