1
0
mirror of https://gitlab.com/JKANetwork/CheckServer.git synced 2026-02-19 03:31:34 +01:00

More info for checks activated

This commit is contained in:
2018-01-09 13:26:26 +01:00
parent 8b86e38361
commit f1b58a03f3
6 changed files with 117 additions and 4 deletions

View File

@@ -271,6 +271,32 @@ switch($page){
header('Location: panel.php?page=users');
break;
//History of checks for a ID_C
case 'viewhist':
//All page data
$ID_C = (int)$_GET['ID_C'];
$page = dbw_query_fetch_array($db_conn,"SELECT name FROM CHECKS WHERE ID_C='$ID_C'");
$cant = 100;
$results = dbw_query($db_conn,"SELECT * FROM CHKHIST WHERE ID_C='$ID_C' ORDER BY `timestamp` DESC LIMIT $cant");
//TODO TIMESTAMPS FAILS
$cgood = 0;$cbad = 0; $fails = array();
while ($us = dbw_fetch_array($db_conn,$results)){
if ($us['code'] == 0){
$cgood++;
}else{
$cbad++;
$fails[] = date('d/m/Y H:i',$us['timestamp']); //Record timestamps
}
}
$group = nameGroupFromIDG($db_conn,IDGFromIDC($db_conn,$ID_C));
$pagedata = array('cgood' => $cgood,'cbad' => $cbad,'name' => nameFromIDC($db_conn,$ID_C), 'group' => $group,'cant' => $cant,'fails' => $fails);
echo $twig->render('panel/p_viewhist.twig', array('T_' => $T_, 'mpage' => 'viewhist', 'you' => $you,'pagedata' => $pagedata));
break;
// Página principal
case 'status':
default:
@@ -283,6 +309,7 @@ switch($page){
if ($failssql != false){
while ($fail = dbw_fetch_array($db_conn,$failssql)){ //Create array
$fails[] = array (
'ID_C' => $fail['ID_C'],
'name' => nameFromIDC($db_conn,$fail['ID_C']),
'groupName' => nameGroupFromIDG($db_conn,IDGFromIDC($db_conn,$fail['ID_C'])),
'typeCheck' => textTypeChk($T_,$fail['ID_TC']),