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("core.php"); |
| 22 | security::checkType(security::ADMIN); |
| 23 | |
| 24 | $mdHeaderRowBefore = visual::backBtn("settings.php"); |
| 25 | ?> |
| 26 | <!DOCTYPE html> |
| 27 | <html> |
| 28 | <head> |
| 29 | <title><?php echo $conf["appName"]; ?></title> |
| 30 | <?php visual::includeHead(); ?> |
| 31 | <link rel="stylesheet" href="css/dashboard.css"> |
| 32 | |
| 33 | <style> |
| 34 | td .material-icons { |
| 35 | vertical-align: middle; |
| 36 | } |
| 37 | </style> |
| 38 | </head> |
| 39 | <?php visual::printBodyTag(); ?> |
| 40 | <div class="mdl-layout mdl-js-layout mdl-layout--fixed-header mdl-layout--fixed-drawer"> |
| 41 | <?php visual::includeNav(); ?> |
| 42 | <main class="mdl-layout__content"> |
| 43 | <div class="page-content"> |
| 44 | <div class="main mdl-shadow--4dp"> |
| 45 | <h2>Logs</h2> |
| 46 | <?php |
| 47 | $page = (isset($_GET["page"]) ? (int)$_GET["page"] - 1 : null); |
| 48 | |
| 49 | $logs = registry::getLogs($page); |
| 50 | if (count($logs)) { |
| 51 | ?> |
| 52 | <div class="overflow-wrapper overflow-wrapper--for-table"> |
| 53 | <table class="mdl-data-table mdl-js-data-table mdl-shadow--2dp"> |
| 54 | <thead> |
| 55 | <tr> |
| 56 | <th class="extra">ID</th> |
| 57 | <th class="mdl-data-table__cell--non-numeric">Hora de ejecución</th> |
| 58 | <th class="mdl-data-table__cell--non-numeric">Día registrado</th> |
| 59 | <th class="mdl-data-table__cell--non-numeric">Ejecutado por</th> |
| 60 | <th class="mdl-data-table__cell--non-numeric"></th> |
| 61 | <th class="mdl-data-table__cell--non-numeric"></th> |
| 62 | </tr> |
| 63 | </thead> |
| 64 | <tbody> |
| 65 | <?php |
| 66 | $tooltips = ""; |
| 67 | foreach ($logs as $l) { |
| 68 | ?> |
| 69 | <tr> |
| 70 | <td class="extra"><?=(int)$l["id"]?></td> |
| 71 | <td class="mdl-data-table__cell--non-numeric"><?=security::htmlsafe(date("d/m/Y H:i", $l["realtime"]))?></td> |
| 72 | <td class="mdl-data-table__cell--non-numeric"><?=security::htmlsafe(date("d/m/Y", $l["day"]))?></td> |
| 73 | <td class="mdl-data-table__cell--non-numeric"><?=($l["executedby"] == -1 ? "<span style='font-family: monospace;'>cron</span>" : security::htmlsafe(people::userData("name", $l["executedby"])))?></td> |
| 74 | <td class="mdl-data-table__cell--non-numeric"> |
| 75 | <?php |
| 76 | if ($l["warningpos"] > 0) { |
| 77 | $tooltips .= '<div class="mdl-tooltip" for="warning_'.(int)$l["id"].'">El log contiene mensajes de advertencia</div>'; |
| 78 | ?> |
| 79 | <i class="material-icons mdl-color-text--orange help" id="warning_<?=(int)$l["id"]?>">warning</i> |
| 80 | <?php |
| 81 | } |
| 82 | |
| 83 | if ($l["errorpos"] > 0) { |
| 84 | $tooltips .= '<div class="mdl-tooltip" for="error_'.(int)$l["id"].'">El log contiene mensajes de error</div>'; |
| 85 | ?> |
| 86 | <i class="material-icons mdl-color-text--red help" id="error_<?=(int)$l["id"]?>">error</i> |
| 87 | <?php |
| 88 | } |
| 89 | |
| 90 | if ($l["fatalerrorpos"] > 0) { |
| 91 | $tooltips .= '<div class="mdl-tooltip" for="fatalerror_'.(int)$l["id"].'">El log contiene errores fatales</div>'; |
| 92 | ?> |
| 93 | <i class="material-icons mdl-color-text--red help-900" id="fatalerror_<?=(int)$l["id"]?>">error</i> |
| 94 | <?php |
| 95 | } |
| 96 | ?> |
| 97 | </td> |
| 98 | <td class="mdl-data-table__cell--non-numeric"> |
| 99 | <a href="dynamic/log.php?id=<?=(int)$l["id"]?>" data-dyndialog-href="dynamic/log.php?id=<?=(int)$l["id"]?>" title="Ver el log"><i class='material-icons icon'>notes</i></a> |
| 100 | </td> |
| 101 | </tr> |
| 102 | <?php |
| 103 | } |
| 104 | ?> |
| 105 | </tbody> |
| 106 | </table> |
| 107 | </div> |
| 108 | <?php |
| 109 | echo $tooltips; |
| 110 | } else { |
| 111 | ?> |
| 112 | <p>No existe ningún log todavía.</p> |
| 113 | <?php |
| 114 | } |
| 115 | ?> |
| 116 | |
| 117 | <?php |
| 118 | $numLogs = db::numRows("logs"); |
| 119 | visual::renderPagination($numLogs, "logs.php", registry::LOGS_PAGINATION_LIMIT); |
| 120 | visual::printDebug("registry::getLogs(".(int)$page.")", $logs); |
| 121 | ?> |
| 122 | </div> |
| 123 | </div> |
| 124 | </main> |
| 125 | </div> |
| 126 | </body> |
| 127 | </html> |