Non puoi selezionare più di 25 argomenti
Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
68 righe
2.5 KiB
68 righe
2.5 KiB
<?php |
|
if (isset($npa)) { |
|
$status = $npa->getServiceStatus(); |
|
$lastUpdate = date("H:i:s", strtotime($status["updated_at"])); |
|
$timeDiff = time() - strtotime($status["created_at"]); |
|
$showBadge = false; |
|
$showAlert = false; |
|
if ($status["title"] === "OK") { |
|
if ($timeDiff < 600) { // Disservizio negli ultimi 10min |
|
$showAlert = true; |
|
$color = "warning"; |
|
$icon = "exclamation-triangle"; |
|
$message = __("Server ANAC tornati attivi da un disservizio negli ultimi 10 minuti."); |
|
} else { // Operativi |
|
$color = "success"; |
|
$icon = "check"; |
|
$message = __("Server ANAC operativi."); |
|
if ($timeDiff < 3600) { // Disservizio nell'ultima ora |
|
$showAlert = true; |
|
$showBadge = true; |
|
} |
|
} |
|
} else { |
|
$showAlert = true; |
|
$icon = "exclamation-circle"; |
|
$color = "danger"; |
|
$message = __("Disservizio server ANAC. Non sarà possibile trasmettere, confermare o verificare schede."); |
|
} |
|
$alerts = AlertAnac::get(null,true); |
|
if (!empty($alerts)) : |
|
foreach($alerts AS $alert) : |
|
$gravita = AlertAnac::gravita()[$alert["gravita"]]; |
|
?> |
|
<div class="alert alert-<?= $alert["gravita"] ?> py-2" role="alert"> |
|
<div class="row"> |
|
<div class="col-8"> |
|
<i class="<?=$gravita["icon"] ?> mr-2"></i><?= $alert["testo"] ?> |
|
</div> |
|
<div class="col-4 text-right"> |
|
<small><?= __("Ultimo aggiornamento:") . " " . $alert["timestamp_creazione"] ?></small> |
|
</div> |
|
</div> |
|
</div> |
|
<? |
|
endforeach; |
|
endif; |
|
?> |
|
<!-- Status ANAC --> |
|
<?php if($showAlert) : ?> |
|
<div class="alert alert-<?= $color ?> py-2" role="alert"> |
|
<div class="row"> |
|
<div class="col-8"> |
|
<i class="fas fa-<?=$icon?> mr-2"></i><?= $message ?> |
|
|
|
<?php if ($showBadge) : // 1 ora ?> |
|
<span class="badge badge-warning ml-3"> |
|
<i class="mr-1 fa fa-exclamation-triangle "></i> <?= __("Disservizio terminato nell'ultima ora."); ?> |
|
</span> |
|
<?php endif; ?> |
|
</div> |
|
<div class="col-4 text-right"> |
|
<small><?= __("Ultimo aggiornamento:") . " " . $lastUpdate ?></small> |
|
</div> |
|
</div> |
|
</div> |
|
<?php endif; ?> |
|
<?php |
|
}
|
|
|