Copybara bot | be50d49 | 2023-11-30 00:16:42 +0100 | [diff] [blame^] | 1 | <?php |
| 2 | require_once(__DIR__."/../core.php"); |
| 3 | security::checkType(security::ADMIN, security::METHOD_NOTFOUND); |
| 4 | |
| 5 | if (!isset($_GET["id"])) { |
| 6 | security::notFound(); |
| 7 | } |
| 8 | |
| 9 | $c = categories::get($_GET["id"]); |
| 10 | |
| 11 | if ($c === false) { |
| 12 | security::notFound(); |
| 13 | } |
| 14 | ?> |
| 15 | |
| 16 | <form action="doeditcategory.php" method="POST" autocomplete="off"> |
| 17 | <h4 class="mdl-dialog__title">Editar categoría</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($c['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="name" id="edit_name" value="<?=security::htmlsafe($c['name'])?>" autocomplete="off" data-required> |
| 26 | <label class="mdl-textfield__label" for="edit_name">Nombre de la categoría</label> |
| 27 | </div> |
| 28 | <br> |
| 29 | <div class="mdlext-selectfield mdlext-js-selectfield mdlext-selectfield--floating-label"> |
| 30 | <select name="parent" id="parent" class="mdlext-selectfield__select"> |
| 31 | <option value="0"></option> |
| 32 | <?php |
| 33 | foreach (categories::getAll(false) as $category) { |
| 34 | if ($category["parent"] == 0 && $category["id"] != $c["id"]) { |
| 35 | echo '<option value="'.$category["id"].'"'.($c["parent"] == $category["id"] ? "selected" : "").'>'.$category["name"].'</option>'; |
| 36 | } |
| 37 | } |
| 38 | ?> |
| 39 | </select> |
| 40 | <label for="parent" class="mdlext-selectfield__label">Categoría padre</label> |
| 41 | </div> |
| 42 | <br> |
| 43 | <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label"> |
| 44 | <textarea class="mdl-textfield__input" name="emails" id="emails"><?=security::htmlsafe(categories::readableEmails($c["emails"]))?></textarea> |
| 45 | <label class="mdl-textfield__label" for="emails">Correos electrónicos de los responsables</label> |
| 46 | </div> |
| 47 | <span style="font-size: 12px;">Introduce los correos separados por comas.</span> |
| 48 | </div> |
| 49 | <div class="mdl-dialog__actions"> |
| 50 | <button type="submit" class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--accent">Confirmar</button> |
| 51 | <button data-dyndialog-close class="mdl-button mdl-js-button mdl-js-ripple-effect cancel">Cancelar</button> |
| 52 | </div> |
| 53 | </form> |