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