blob: bc4e908d646c58ae1e638ab78c8d77ef2c50f8c5 [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 .add-calendar, .category {
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>Calendarios</h2>
27 <?php
28 $calendars_response = calendars::getAll();
29
30 foreach ($calendars_response as $ccs) {
31 ?>
32 <h4><span class="category"><?=security::htmlsafe($ccs["category"])?></span> <a href="addcalendar.php?id=<?=(int)$ccs["categoryid"]?>" class="mdl-button mdl-js-button mdl-button--icon mdl-button--accent add-calendar" id="cat<?=(int)$ccs["categoryid"]?>"><i class="material-icons">add</i></a></h4>
33 <?php visual::addTooltip("cat".(int)$ccs["categoryid"], "Añadir un calendario a esta categoría"); ?>
34 <?php
35 if (count($ccs["calendars"])) {
36 ?>
37 <div class="overflow-wrapper overflow-wrapper--for-table">
38 <table class="mdl-data-table mdl-js-data-table mdl-shadow--2dp datatable">
39 <thead>
40 <tr>
41 <?php
42 if ($conf["debug"]) {
43 ?>
44 <th class="extra">ID</th>
45 <?php
46 }
47 ?>
48 <th class="mdl-data-table__cell--non-numeric">Fecha inicio</th>
49 <th class="mdl-data-table__cell--non-numeric">Fecha fin</th>
50 <th class="mdl-data-table__cell--non-numeric"></th>
51 </tr>
52 </thead>
53 <tbody>
54 <?php
55 foreach ($ccs["calendars"] as $c) {
56 ?>
57 <tr>
58 <?php
59 if ($conf["debug"]) {
60 ?>
61 <td class="extra"><?=(int)$c["id"]?></td>
62 <?php
63 }
64 ?>
65 <td class="mdl-data-table__cell--non-numeric"><?=security::htmlsafe(date("d/m/Y", $c["begins"]))?></td>
66 <td class="mdl-data-table__cell--non-numeric"><?=security::htmlsafe(date("d/m/Y", $c["ends"]))?></td>
67 <td class='mdl-data-table__cell--non-numeric'>
68 <a href='editcalendar.php?id=<?=(int)$c['id']?>&view=1' title='Ver calendario'><i class='material-icons icon'>open_in_new</i></a>
69 <a href='editcalendar.php?id=<?=(int)$c['id']?>' title='Editar calendario'><i class='material-icons icon'>edit</i></a>
70 <a href='dynamic/deletecalendar.php?id=<?=(int)$c['id']?>' data-dyndialog-href='dynamic/deletecalendar.php?id=<?=(int)$c['id']?>' title='Eliminar calendario'><i class='material-icons icon'>delete</i></a>
71 <a href='dynamic/exportcalendar.php?id=<?=(int)$c['id']?>' data-dyndialog-href='dynamic/exportcalendar.php?id=<?=(int)$c['id']?>' title='Exportar calendario'><i class='material-icons icon'>code</i></a>
72 </td>
73 </tr>
74 <?php
75 }
76 ?>
77 </tbody>
78 </table>
79 </div>
80 <?php
81 } else {
82 echo "<p>No se ha configurado ningún calendario todavía.</p>";
83 }
84 }
85 ?>
86
87 <?php visual::printDebug("calendars::getAll()", $calendars_response); ?>
88 </div>
89 </div>
90 </main>
91 </div>
92
93 <div class="mdl-snackbar mdl-js-snackbar">
94 <div class="mdl-snackbar__text"></div>
95 <button type="button" class="mdl-snackbar__action"></button>
96 </div>
97
98 <?php
99 visual::renderTooltips();
100
101 visual::smartSnackbar([
102 ["added", "Se ha añadido el calendario correctamente."],
103 ["modified", "Se ha modificado el calendario correctamente."],
104 ["deleted", "Se ha eliminado el calendario correctamente."],
105 ["empty", "Faltan datos por introducir en el formulario o el correo electrónico es incorrecto."],
106 ["unexpected", "Ha ocurrido un error inesperado. Inténtelo de nuevo en unos segundos."],
107 ["overlap", "El calendario que intentabas añadir se solapa con uno ya existente, así que no se ha añadido."]
108 ], 10000, false);
109 ?>
110</body>
111</html>