Copybara bot | be50d49 | 2023-11-30 00:16:42 +0100 | [diff] [blame] | 1 | <?php |
Adrià Vilanova Martínez | 5af8651 | 2023-12-02 20:44:16 +0100 | [diff] [blame^] | 2 | /* |
| 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 bot | be50d49 | 2023-11-30 00:16:42 +0100 | [diff] [blame] | 21 | require_once(__DIR__."/../core.php"); |
| 22 | security::checkType(security::ADMIN, security::METHOD_NOTFOUND); |
| 23 | |
| 24 | if (!isset($_GET["id"])) { |
| 25 | security::notFound(); |
| 26 | } |
| 27 | |
| 28 | $p = people::get($_GET["id"], false); |
| 29 | |
| 30 | if ($p === false) { |
| 31 | security::notFound(); |
| 32 | } |
| 33 | |
| 34 | $companies = companies::getAll(); |
| 35 | $pcompanies = []; |
| 36 | |
| 37 | foreach($p["companies"] as $company) { |
| 38 | $pcompanies[] = $companies[$company]; |
| 39 | } |
| 40 | |
| 41 | $secondFactor = secondFactor::isEnabled($p["id"]); |
| 42 | |
| 43 | if ($secondFactor) { |
| 44 | ?> |
| 45 | <dynscript> |
| 46 | document.querySelector(".disable-second-factor").addEventListener("click", e => { |
| 47 | dynDialog.load("dynamic/disablesecondfactor.php?id=<?=(int)$p["id"]?>"); |
| 48 | }); |
| 49 | </dynscript> |
Adrià Vilanova Martínez | 5af8651 | 2023-12-02 20:44:16 +0100 | [diff] [blame^] | 50 | <?php //do-not-add-license-header-here |
Copybara bot | be50d49 | 2023-11-30 00:16:42 +0100 | [diff] [blame] | 51 | } |
| 52 | ?> |
| 53 | |
| 54 | <style> |
| 55 | #dynDialog { |
| 56 | max-width: 380px; |
| 57 | width: auto; |
| 58 | } |
| 59 | </style> |
| 60 | |
| 61 | <h4 class="mdl-dialog__title"><?=security::htmlsafe($p["name"])?></h4> |
| 62 | <ul> |
| 63 | <li><b>Nombre de usuario:</b> <?=security::htmlsafe($p["username"])?></li> |
| 64 | <li><b>DNI:</b> <?=(!empty($p["dni"]) ? security::htmlsafe($p["dni"]) : "-")?></li> |
| 65 | <li><b>Correo electrónico:</b> <?=(!empty($p["email"]) ? "<a href=\"mailto:".security::htmlsafe(rawurlencode($p["email"]))."\" target=\"_blank\">".security::htmlsafe($p["email"])."</a>" : "-")?> |
| 66 | <li><b>Categoría:</b> <?=($p["categoryid"] == -1 ? "-" : security::htmlsafe($p["category"]))?></li> |
| 67 | <li><b>Dada de baja:</b> <?=($p["baixa"] == 1 ? visual::YES : "No")?></li> |
| 68 | <li><b>Empresas:</b> <?=security::htmlsafe((count($p["companies"]) ? implode(", ", $pcompanies) : "-"))?></li> |
| 69 | <li><b>Tipo de usuario:</b> <?=security::htmlsafe(security::$types[$p["type"]])?></li> |
| 70 | <?php if (secondFactor::isAvailable()) { ?><li><b>Verificación en dos pasos:</b> <?=($secondFactor ? 'activada <button class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent disable-second-factor">Desactivar</button>' : 'desactivada')?></li><?php } ?> |
| 71 | </ul> |
| 72 | |
| 73 | <div class="mdl-dialog__actions"> |
| 74 | <button data-dyndialog-close class="mdl-button mdl-js-button mdl-js-ripple-effect cancel">Cerrar</button> |
| 75 | <a href="userregistry.php?id=<?=(int)$p["id"]?>" class="mdl-button mdl-js-button mdl-button--icon mdl-js-ripple-effect"><i class="material-icons">list</i><span class="mdl-ripple"></span></a> |
| 76 | <a href="userincidents.php?id=<?=(int)$p["id"]?>" class="mdl-button mdl-js-button mdl-button--icon mdl-js-ripple-effect"><i class="material-icons">assignment_late</i><span class="mdl-ripple"></span></a> |
| 77 | <a href="workerschedule.php?id=<?=(int)$p["id"]?>" class="mdl-button mdl-js-button mdl-button--icon mdl-js-ripple-effect"><i class="material-icons">timelapse</i><span class="mdl-ripple"></span></a> |
| 78 | </div> |