Remove unused PHP files related to Hyper-V and Storage dashboards
- Deleted `cluster-detail2.php`, `constants.inc copy.php`, `D.php`, and `Dashboard2.php`. These files were no longer in use and contributed to unnecessary clutter in the codebase. - Cleaned up references to removed files.
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
|
||||
<body class="bg-light text-dark">
|
||||
<?php include $_SERVER['DOCUMENT_ROOT'] . "/include/preloader.inc.html"; ?> <!-- Preloader -->
|
||||
<?php include $_SERVER['DOCUMENT_ROOT'] . "/include/db_connect.php"; ?> <!-- Database connexion -->
|
||||
<?php include $_SERVER['DOCUMENT_ROOT'] . "/../../include/db_connect.php"; ?> <!-- Database connexion -->
|
||||
<?php //include $_SERVER['DOCUMENT_ROOT']."/include/functions.inc.php" ; ?> <!-- Functions -->
|
||||
<div class="container-fluid">
|
||||
<div class="row flex-nowrap">
|
||||
@@ -45,58 +45,12 @@
|
||||
|
||||
<!-- Main content -->
|
||||
<div class="row" style="zoom: 80%">
|
||||
<!-- Get DATAs -->
|
||||
<?php
|
||||
DB_ENTRY02();
|
||||
$result = $conn->query("select * from GlobalCrossover where server not like 'WS%' order by server ");
|
||||
if (isset($_GET['filter'])) {
|
||||
switch ($_GET['filter']) {
|
||||
case "AD":
|
||||
$result = $conn->query("select * from GlobalCrossover where AD is null or (ADlu is not null and DATEDIFF(now(),ADlu) > 45) order by server");
|
||||
echo "<h2><center><span class='badge text-bg-danger font-weight-bold'>Filter : AD non compliant</span></center></h2>";
|
||||
break;
|
||||
case "OS":
|
||||
$result = $conn->query("select * from GlobalCrossover where OS like '%2003%' or OS like '%2008%' order by server");
|
||||
echo "<h2><center><span class='badge text-bg-danger font-weight-bold'>Filter : OS non compliant</span></center></h2>";
|
||||
break;
|
||||
case "GLPI":
|
||||
$result = $conn->query("select * from GlobalCrossover where GLPI is null or GLPIlu is null or DATEDIFF(now(),GLPIlu) > 7 order by server");
|
||||
echo "<h2><center><span class='badge text-bg-danger font-weight-bold'>Filter : GLPI/FI non compliant</span></center></h2>";
|
||||
break;
|
||||
case "SCCM":
|
||||
$result = $conn->query("select * from GlobalCrossover where SCCM is null or (SCCMlu is not null and DATEDIFF(now(),SCCMlu) > 7) order by server");
|
||||
echo "<h2><center><span class='badge text-bg-danger font-weight-bold'>Filter : SCCM non compliant</span></center></h2>";
|
||||
break;
|
||||
case "NESSUS":
|
||||
$result = $conn->query("select * from GlobalCrossover where EPO is null order by server");
|
||||
echo "<h2><center><span class='badge text-bg-danger font-weight-bold'>Filter : NESSUS non compliant</span></center></h2>";
|
||||
break;
|
||||
case "NBU":
|
||||
$result = $conn->query("select * from GlobalCrossover where NBU is null or (NBUlu is not null and DATEDIFF(now(),NBUlu) > 30) order by server");
|
||||
echo "<h2><center><span class='badge text-bg-danger font-weight-bold'>Filter : Backup non compliant</span></center></h2>";
|
||||
break;
|
||||
case "SCOM":
|
||||
$result = $conn->query("select * from GlobalCrossover where SCOM is null order by server");
|
||||
echo "<h2><center><span class='badge text-bg-danger font-weight-bold'>Filter : SCOM non compliant</span></center></h2>";
|
||||
break;
|
||||
case "zabbix":
|
||||
$result = $conn->query("select * from GlobalCrossover where zabbix is null order by server");
|
||||
echo "<h2><center><span class='badge text-bg-danger font-weight-bold'>Filter : Zabbix non compliant</span></center></h2>";
|
||||
break;
|
||||
case "S1":
|
||||
$result = $conn->query("select * from GlobalCrossover where S1 is null or (S1lu is not null and DATEDIFF(now(),S1lu) > 7) order by server");
|
||||
echo "<h2><center><span class='badge text-bg-danger font-weight-bold'>Filter : SentinelOne non compliant</span></center></h2>";
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<table class='table table-bordered table-hover table-sm' id='t1' data-toggle="table" data-search="true"
|
||||
data-show-columns="true" data-pagination="true" data-export-types="['xlsx','csv','json']"
|
||||
data-loading-template="loadingTemplate" data-page-list="[20, 50, 100, All]" data-page-size="Tout"
|
||||
data-height="620" data-show-export="true" data-sortable="true">
|
||||
data-show-columns="true" data-pagination="true" data-export-types="['xlsx','csv','json']"
|
||||
data-loading-template="loadingTemplate" data-page-list="[20, 50, 100, All]" data-page-size="Tout"
|
||||
data-show-export="true" data-sortable="true">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-field="Name" data-sortable="true">Name</th>
|
||||
<th data-field="OS" data-sortable="true">Operating System</th>
|
||||
<th data-field="Criticity" data-sortable="true">Criticity</th>
|
||||
@@ -115,222 +69,226 @@
|
||||
<th data-field="Zabbix" data-sortable="true">Zabbix</th>
|
||||
<th data-field="S1" data-sortable="true">SentinelOne</th>
|
||||
<th data-field="S1lu" data-sortable="true" data-visible="false">S1 Last Update</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<!-- Display DATAs -->
|
||||
<?php
|
||||
$conn = DB_ENTRY02();
|
||||
// Base query
|
||||
$sql = "SELECT * FROM GlobalCrossover";
|
||||
$whereClauses = ["server NOT LIKE 'WS%'"];
|
||||
$params = [];
|
||||
$types = "";
|
||||
|
||||
$ok = 0;
|
||||
$total = 0;
|
||||
$nOS = 0;
|
||||
$nAD = 0;
|
||||
$nSCCM = 0;
|
||||
$nGLPI = 0;
|
||||
$nFI = 0;
|
||||
$nNESSUS = 0;
|
||||
$nNBU = 0;
|
||||
$nDPM = 0;
|
||||
$nS1 = 0;
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
$total++;
|
||||
echo "<tr>";
|
||||
if (isset($row['AD']) && isset($row['GLPI']) && isset($row['SCCM']) && isset($row['EPO']) && (isset($row['NBU']) || isset($row['DPM'])) && isset($row['SCOM'])) {
|
||||
echo "<td class='bg-success text-white'><b><a href='\crossover\Detail.php?server=" . $row['Server'] . "' target='_blank' class='link-light'>" . $row['Server'] . "</a></b></td>";
|
||||
//echo "<td class='bg-success text-white'><b>".$row['Server']."</b></td>";
|
||||
$ok++;
|
||||
} else {
|
||||
echo "<td><b><a href='\crossover\Detail.php?server=" . $row['Server'] . "' target='_blank'>" . $row['Server'] . "</a></b></td>";
|
||||
//echo "<td><b>".$row['Server']."</b></td>";
|
||||
}
|
||||
if ($row['OS']) {
|
||||
if (preg_match('(XP|2003|Windows NT|2000|2008|Windows 7|2012)', $row['OS']) !== 1) {
|
||||
$nOS++;
|
||||
echo "<td>" . $row['OS'] . "</td>";
|
||||
} else {
|
||||
echo "<td class='bg-warning text-black'>" . $row['OS'] . "</td>";
|
||||
// Handle filters securely using prepared statements
|
||||
if (isset($_GET['filter'])) {
|
||||
$filter = $_GET['filter'];
|
||||
$filterTitle = "Filter : " . htmlspecialchars($filter) . " non compliant";
|
||||
|
||||
switch ($filter) {
|
||||
case "AD":
|
||||
$whereClauses[] = "AD IS NULL OR (ADlu IS NOT NULL AND DATEDIFF(now(), ADlu) > 45)";
|
||||
break;
|
||||
case "OS":
|
||||
$whereClauses[] = "OS LIKE '%2003%' OR OS LIKE '%2008%'";
|
||||
break;
|
||||
case "GLPI":
|
||||
$whereClauses[] = "GLPI IS NULL OR GLPIlu IS NULL OR DATEDIFF(now(), GLPIlu) > 7";
|
||||
break;
|
||||
case "SCCM":
|
||||
$whereClauses[] = "SCCM IS NULL OR (SCCMlu IS NOT NULL AND DATEDIFF(now(), SCCMlu) > 7)";
|
||||
break;
|
||||
case "NESSUS":
|
||||
$whereClauses[] = "EPO IS NULL";
|
||||
break;
|
||||
case "NBU":
|
||||
$whereClauses[] = "NBU IS NULL OR (NBUlu IS NOT NULL AND DATEDIFF(now(), NBUlu) > 30)";
|
||||
break;
|
||||
case "SCOM":
|
||||
$whereClauses[] = "SCOM IS NULL";
|
||||
break;
|
||||
case "zabbix":
|
||||
$whereClauses[] = "zabbix IS NULL";
|
||||
break;
|
||||
case "S1":
|
||||
$whereClauses[] = "S1 IS NULL OR (S1lu IS NOT NULL AND DATEDIFF(now(), S1lu) > 7)";
|
||||
break;
|
||||
default:
|
||||
$filterTitle = null; // No valid filter
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
echo "<td class='bg-warning'> </td>";
|
||||
}
|
||||
echo "<td>" . $row['crit'] . "</td>";
|
||||
echo "<td>" . $row['dpt'] . "</td>";
|
||||
|
||||
// AD
|
||||
if ($row['AD'] == 'Y') {
|
||||
$date1 = date_create($row['ADlu']);
|
||||
$diff = date_diff($date1, date_create(date("Y-m-d")));
|
||||
if ($diff->format("%R%a") > 45) {
|
||||
echo "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>OK</td>";
|
||||
echo "<td class='bg-danger text-white'>" . $row['ADlu'] . " (" . $diff->format("%R%a") . " days)</td>";
|
||||
} else {
|
||||
$nAD++;
|
||||
echo "<td class='bg-success text-white'>OK</td>";
|
||||
echo "<td class='bg-success text-white'>" . $row['ADlu'] . "</td>";
|
||||
}
|
||||
} else {
|
||||
|
||||
if (isset($row['AD'])) {
|
||||
$nAD++;
|
||||
echo "<td class='bg-secondary'><small>" . $row['AD'] . "</small></td>";
|
||||
echo "<td class='bg-secondary text-secondary'> </td>";
|
||||
$nSCCM++;
|
||||
} else {
|
||||
echo "<td class='bg-warning text-black'>Missing</td>";
|
||||
echo "<td class='bg-warning text-warning'> </td>";
|
||||
if ($filterTitle) {
|
||||
echo "<h2><div style=\"text-align: center;\"><span class='badge text-bg-danger font-weight-bold'>$filterTitle</span></div></h2>";
|
||||
}
|
||||
}
|
||||
|
||||
// GLPI
|
||||
if ($row['GLPI'] == 'Y') {
|
||||
$date1 = date_create($row['GLPIlu']);
|
||||
$diff = date_diff($date1, date_create(date("Y-m-d")));
|
||||
if ($diff->format("%R%a") > 7) {
|
||||
echo "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>OK</td>";
|
||||
echo "<td class='bg-danger text-white'>" . $row['GLPIlu'] . " (" . $diff->format("%R%a") . " days)</td>";
|
||||
} else {
|
||||
if ($row['GLPIlu'] <> "" || $row['FI'] <> "") {
|
||||
echo "<td class='bg-success text-white'>OK</td>";
|
||||
$nFI++;
|
||||
echo "<td class='bg-success text-white'>" . $row['GLPIlu'] . "</td>";
|
||||
} else {
|
||||
echo "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(255,193,7,1) 100%);'>OK</td>";
|
||||
echo "<td class='bg-warning text-black'>Missing</td>";
|
||||
// Combine all WHERE clauses
|
||||
if (!empty($whereClauses)) {
|
||||
$sql .= " WHERE " . implode(' AND ', $whereClauses);
|
||||
}
|
||||
|
||||
$sql .= " ORDER BY server";
|
||||
|
||||
// Prepare and execute the query
|
||||
$stmt = $conn->prepare($sql);
|
||||
// Note: If you had parameters, you would bind them here, e.g., $stmt->bind_param($types, ...$params);
|
||||
$stmt->execute();
|
||||
$result = $stmt->get_result();
|
||||
|
||||
|
||||
// --- PART 2: HELPER FUNCTIONS FOR RENDERING ---
|
||||
|
||||
/**
|
||||
* Renders a standard status cell based on a value and its last update date.
|
||||
* @param string|null $status The status value (e.g., 'Y', 'N').
|
||||
* @param string|null $lastUpdate The date of the last update.
|
||||
* @param int $daysThreshold The number of days to be considered "out of date".
|
||||
* @param string $okText Text to display for OK status (e.g., "OK", "OK (NBU)").
|
||||
* @return string The generated HTML for two <td> cells.
|
||||
*/
|
||||
function renderStatusCellWithDate(?string $status, ?string $lastUpdate, int $daysThreshold, string $okText = 'OK'): string {
|
||||
// Sanitize output to prevent XSS
|
||||
$status = htmlspecialchars($status ?? '', ENT_QUOTES, 'UTF-8');
|
||||
$lastUpdate = htmlspecialchars($lastUpdate ?? '', ENT_QUOTES, 'UTF-8');
|
||||
$okText = htmlspecialchars($okText, ENT_QUOTES, 'UTF-8');
|
||||
|
||||
if ($status === 'Y') {
|
||||
if (empty($lastUpdate)) {
|
||||
// Status is OK, but date is missing
|
||||
return "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(255,193,7,1) 100%);'>$okText</td>"
|
||||
. "<td class='bg-warning text-black'>Missing</td>";
|
||||
}
|
||||
}
|
||||
$nGLPI++;
|
||||
} else {
|
||||
if (isset($row['GLPI'])) {
|
||||
echo "<td class='bg-secondary'><small>" . $row['GLPI'] . "</small></td>";
|
||||
echo "<td class='bg-secondary text-secondary'> </td>";
|
||||
$nGLPI++;
|
||||
} else {
|
||||
echo "<td class='bg-warning text-black'>Missing</td>";
|
||||
echo "<td class='bg-warning text-warning'> </td>";
|
||||
}
|
||||
}
|
||||
|
||||
// SCCM
|
||||
if ($row['SCCM'] == 'Y') {
|
||||
$date1 = date_create($row['SCCMlu']);
|
||||
$diff = date_diff($date1, date_create(date("Y-m-d")));
|
||||
if ($diff->format("%R%a") > 7) {
|
||||
echo "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>OK</td>";
|
||||
echo "<td class='bg-danger text-white'>" . $row['SCCMlu'] . " (" . $diff->format("%R%a") . " days)</td>";
|
||||
} else {
|
||||
echo "<td class='bg-success text-white'>OK</td>";
|
||||
echo "<td class='bg-success text-white'>" . $row['SCCMlu'] . "</td>";
|
||||
$nSCCM++;
|
||||
}
|
||||
} else {
|
||||
if (isset($row['SCCM'])) {
|
||||
echo "<td class='bg-secondary'><small>" . $row['SCCM'] . "</small></td>";
|
||||
echo "<td class='bg-secondary text-secondary'> </td>";
|
||||
$nSCCM++;
|
||||
} else {
|
||||
echo "<td class='bg-warning text-black'>Missing</td>";
|
||||
echo "<td class='bg-warning text-warning'> </td>";
|
||||
}
|
||||
}
|
||||
try {
|
||||
$diff = date_diff(date_create($lastUpdate), date_create());
|
||||
$days = (int) $diff->format("%R%a");
|
||||
|
||||
// NESSUS
|
||||
if (strpos($row['EPO'], '.') !== false ) {
|
||||
echo "<td class='bg-success text-white'>".$row['EPO']."</td>";
|
||||
} else {
|
||||
if (isset($row['EPO']) && $row['EPO'] != 'Y' && $row['EPO'] != 'N') {
|
||||
echo "<td class='bg-secondary'><small>" . $row['EPO'] . "</small></td>";
|
||||
} else {
|
||||
echo "<td class='bg-warning text-black'>Missing</td>";
|
||||
$nNESSUS++;
|
||||
}
|
||||
}
|
||||
|
||||
// BACKUP
|
||||
if ($row['NBU'] == 'Y') {
|
||||
$date1 = date_create($row['NBUlu']);
|
||||
$diff = date_diff($date1, date_create(date("Y-m-d")));
|
||||
if ($diff->format("%R%a") > 30) {
|
||||
echo "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>OK (NBU)</td>";
|
||||
echo "<td class='bg-danger text-white'>" . $row['NBUlu'] . " (" . $diff->format("%R%a") . " days)</td>";
|
||||
} else {
|
||||
echo "<td class='bg-success text-white'>OK (NBU)</td>";
|
||||
echo "<td class='bg-success text-white'>" . $row['NBUlu'] . "</td>";
|
||||
$nNBU++;
|
||||
}
|
||||
} else {
|
||||
if ($row['DPM'] == 'Y') {
|
||||
$date1 = date_create($row['DPMlu']);
|
||||
$diff = date_diff($date1, date_create(date("Y-m-d")));
|
||||
if ($diff->format("%R%a") > 30) {
|
||||
echo "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>OK (DPM)</td>";
|
||||
echo "<td class='bg-danger text-white'>" . $row['DPMlu'] . " (" . $diff->format("%R%a") . " days)</td>";
|
||||
} else {
|
||||
echo "<td class='bg-success text-white'>OK (DPM)</td>";
|
||||
echo "<td class='bg-success text-white'>" . $row['DPMlu'] . "</td>";
|
||||
$nDPM++;
|
||||
}
|
||||
} else {
|
||||
if (isset($row['NBU'])) {
|
||||
echo "<td class='bg-secondary'><small>" . $row['NBU'] . "</small></td>";
|
||||
echo "<td class='bg-secondary text-secondary'> </td>";
|
||||
} else {
|
||||
if (isset($row['DPM'])) {
|
||||
echo "<td class='bg-secondary'><small>" . $row['DPM'] . "</small></td>";
|
||||
echo "<td class='bg-secondary text-secondary'> </td>";
|
||||
if ($days > $daysThreshold) {
|
||||
// Out of date
|
||||
return "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>$okText</td>"
|
||||
. "<td class='bg-danger text-white'>$lastUpdate ($days days)</td>";
|
||||
} else {
|
||||
// Compliant
|
||||
return "<td class='bg-success text-white'>$okText</td>"
|
||||
. "<td class='bg-success text-white'>$lastUpdate</td>";
|
||||
}
|
||||
echo "<td class='bg-warning text-black'>Missing</td>";
|
||||
echo "<td class='bg-warning text-warning'> </td>";
|
||||
} catch (Exception) {
|
||||
// Handle invalid date format gracefully
|
||||
return "<td class='bg-danger text-white'>Invalid Date</td><td class='bg-danger text-white'>$lastUpdate</td>";
|
||||
}
|
||||
}
|
||||
|
||||
if ($status !== '') {
|
||||
// Not applicable, non-supported, etc.
|
||||
return "<td class='bg-secondary'><small>$status</small></td><td class='bg-secondary text-secondary'> </td>";
|
||||
}
|
||||
|
||||
// Missing
|
||||
return "<td class='bg-warning text-black'>Missing</td><td class='bg-warning text-warning'> </td>";
|
||||
}
|
||||
|
||||
// SCOM
|
||||
if ($row['SCOM'] == 'Y') {
|
||||
echo "<td class='bg-success text-white'>OK</td>";
|
||||
} else {
|
||||
if (isset($row['SCOM'])) {
|
||||
echo "<td class='bg-secondary'><small>" . $row['SCOM'] . "</small></td>";
|
||||
// --- PART 3: CLEAN DATA DISPLAY LOOP ---
|
||||
|
||||
// Initialize counters
|
||||
$counters = [
|
||||
'total' => 0, 'ok' => 0, 'nOS' => 0, 'nAD' => 0, 'nSCCM' => 0, 'nGLPI' => 0,
|
||||
'nFI' => 0, 'nNESSUS' => 0, 'nNBU' => 0, 'nDPM' => 0, 'nS1' => 0
|
||||
];
|
||||
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$counters['total']++;
|
||||
// Sanitize server name for URL and display
|
||||
$serverName = htmlspecialchars($row['Server'], ENT_QUOTES, 'UTF-8');
|
||||
$serverUrl = urlencode($row['Server']);
|
||||
|
||||
// Determine overall row status
|
||||
$isCompliant = isset($row['AD'], $row['GLPI'], $row['SCCM'], $row['EPO']) && (isset($row['NBU']) || isset($row['DPM'])) && isset($row['SCOM']);
|
||||
if ($isCompliant) {
|
||||
$counters['ok']++;
|
||||
$serverCell = "<td class='bg-success text-white'><b><a href='/crossover/Detail.php?server=$serverUrl' target='_blank' class='link-light'>$serverName</a></b></td>";
|
||||
} else {
|
||||
$serverCell = "<td><b><a href='/crossover/Detail.php?server=$serverUrl' target='_blank'>$serverName</a></b></td>";
|
||||
}
|
||||
|
||||
// OS Cell
|
||||
$osCell = "<td class='bg-warning'> </td>";
|
||||
if (!empty($row['OS'])) {
|
||||
$os = htmlspecialchars($row['OS']);
|
||||
if (preg_match('(XP|2003|2000|2008|Windows 7|2012)', $row['OS'])) {
|
||||
$osCell = "<td class='bg-warning text-black'>$os</td>";
|
||||
} else {
|
||||
$counters['nOS']++;
|
||||
$osCell = "<td>$os</td>";
|
||||
}
|
||||
}
|
||||
|
||||
echo "<tr>";
|
||||
echo $serverCell;
|
||||
echo $osCell;
|
||||
echo "<td>" . htmlspecialchars($row['crit'] ?? '') . "</td>";
|
||||
echo "<td>" . htmlspecialchars($row['dpt'] ?? '') . "</td>";
|
||||
|
||||
// Use helper function for status columns
|
||||
echo renderStatusCellWithDate($row['AD'], $row['ADlu'], 45);
|
||||
echo renderStatusCellWithDate($row['GLPI'], $row['GLPIlu'], 7);
|
||||
echo renderStatusCellWithDate($row['SCCM'], $row['SCCMlu'], 7);
|
||||
|
||||
// NESSUS (EPO) Cell - Custom logic
|
||||
if (str_contains($row['EPO'] ?? '', '.')) {
|
||||
echo "<td class='bg-success text-white'>" . htmlspecialchars($row['EPO']) . "</td>";
|
||||
} elseif (isset($row['EPO']) && !in_array($row['EPO'], ['Y', 'N'])) {
|
||||
echo "<td class='bg-secondary'><small>" . htmlspecialchars($row['EPO']) . "</small></td>";
|
||||
} else {
|
||||
echo "<td class='bg-warning text-black'>Missing</td>";
|
||||
$counters['nNESSUS']++;
|
||||
}
|
||||
|
||||
// BACKUP Cell - Custom logic for NBU/DPM
|
||||
if ($row['NBU'] === 'Y') {
|
||||
echo renderStatusCellWithDate($row['NBU'], $row['NBUlu'], 30, 'OK (NBU)');
|
||||
} elseif ($row['DPM'] === 'Y') {
|
||||
echo renderStatusCellWithDate($row['DPM'], $row['DPMlu'], 30, 'OK (DPM)');
|
||||
} else {
|
||||
// Handle non-Y cases for NBU or DPM, or missing
|
||||
$backupStatus = $row['NBU'] ?? $row['DPM'] ?? null;
|
||||
echo renderStatusCellWithDate($backupStatus, null, 30);
|
||||
}
|
||||
|
||||
// SCOM Cell - Simple logic
|
||||
if ($row['SCOM'] === 'Y') {
|
||||
echo "<td class='bg-success text-white'>OK</td>";
|
||||
} elseif (isset($row['SCOM'])) {
|
||||
echo "<td class='bg-secondary'><small>" . htmlspecialchars($row['SCOM']) . "</small></td>";
|
||||
} else {
|
||||
echo "<td class='bg-warning text-black'>Missing</td>";
|
||||
}
|
||||
}
|
||||
|
||||
// zabbix
|
||||
if ($row['zabbix'] == 'Y' || strpos($row['zabbix'], '.') !== false ) {
|
||||
echo "<td class='bg-success text-white'>".str_replace('Y','OK',$row['zabbix'])."</td>";
|
||||
} else {
|
||||
if (isset($row['zabbix'])) {
|
||||
echo "<td class='bg-secondary'><small>" . $row['zabbix'] . "</small></td>";
|
||||
// Zabbix Cell - Simple logic
|
||||
$zabbixStatus = $row['zabbix'] ?? '';
|
||||
if ($zabbixStatus === 'Y' || str_contains($zabbixStatus, '.')) {
|
||||
echo "<td class='bg-success text-white'>" . htmlspecialchars(str_replace('Y', 'OK', $zabbixStatus)) . "</td>";
|
||||
} elseif (isset($row['zabbix'])) {
|
||||
echo "<td class='bg-secondary'><small>" . htmlspecialchars($zabbixStatus) . "</small></td>";
|
||||
} else {
|
||||
echo "<td class='bg-warning text-black'>Missing</td>";
|
||||
}
|
||||
}
|
||||
|
||||
// S1
|
||||
if ($row['S1'] == 'Y' || strpos($row['S1'], '.') !== false) {
|
||||
$date1 = date_create($row['S1lu']);
|
||||
$diff = date_diff($date1, date_create(date("Y-m-d")));
|
||||
if ($diff->format("%R%a") > 7) {
|
||||
echo "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>".str_replace('Y','OK',$row['S1'])."</td>";
|
||||
echo "<td class='bg-danger text-white'>" . $row['S1lu'] . " (" . $diff->format("%R%a") . " days)</td>";
|
||||
} else {
|
||||
echo "<td class='bg-success text-white'>".str_replace('Y','OK',$row['S1'])."</td>";
|
||||
echo "<td class='bg-success text-white'>" . $row['S1lu'] . "</td>";
|
||||
$nS1++;
|
||||
}
|
||||
} else {
|
||||
if (isset($row['S1'])) {
|
||||
if($row['S1'] == "N"){$row['S1'] = "Non Supported OS";}
|
||||
echo "<td class='bg-secondary'><small>" . $row['S1'] . "</small></td>";
|
||||
echo "<td class='bg-secondary text-secondary'> </td>";
|
||||
$nS1++;
|
||||
} else {
|
||||
echo "<td class='bg-warning text-black'>Missing</td>";
|
||||
echo "<td class='bg-warning text-black'> </td>";
|
||||
}
|
||||
// S1 Cell
|
||||
$s1Status = $row['S1'] ?? '';
|
||||
$s1Text = ($s1Status === 'Y' || str_contains($s1Status, '.')) ? str_replace('Y', 'OK', $s1Status) : 'OK';
|
||||
echo renderStatusCellWithDate($s1Status, $row['S1lu'], 7, $s1Text);
|
||||
|
||||
echo "</tr>";
|
||||
}
|
||||
echo "</tr>";
|
||||
}
|
||||
// You can now use the $counters array to pass data to your JS for the KPIs
|
||||
// For example:
|
||||
echo "<script>let kpiData = " . json_encode($counters) . ";</script>";
|
||||
|
||||
$stmt->close();
|
||||
$conn->close();
|
||||
?>
|
||||
</tbody>
|
||||
|
||||
@@ -450,19 +408,48 @@
|
||||
|
||||
<script src="/crossover/Crossover-KPI.js"></script>
|
||||
<script>
|
||||
var $table = $('#t1')
|
||||
var $button = $('#button')
|
||||
let $table = $('#t1');
|
||||
const $button = $('#button');
|
||||
|
||||
$table.on('search.bs.table', function () {
|
||||
var $button = $('#button')
|
||||
$button.click();
|
||||
$table.on('search.bs.table', function () {
|
||||
let $button = $('#button');
|
||||
$button.click();
|
||||
})
|
||||
|
||||
$(window).on('load', function () {
|
||||
$('.preloader').addClass('preloader-deactivate');
|
||||
});
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function () { setTimeout(function () { document.getElementById('button').click(); }, 1000); });
|
||||
document.addEventListener("DOMContentLoaded", function () { setTimeout(function () { $('#button').click(); }, 1000); });
|
||||
</script>
|
||||
|
||||
<SCRIPT>
|
||||
|
||||
$(function() {
|
||||
// Exécution initiale pour définir la hauteur
|
||||
adjustTableHeight();
|
||||
|
||||
// Événement de redimensionnement
|
||||
$(window).on('resize', function() {
|
||||
adjustTableHeight();
|
||||
});
|
||||
|
||||
function adjustTableHeight() {
|
||||
const table = $('#t1');
|
||||
const windowHeight = $(window).height();
|
||||
const tableTop = table.offset().top;
|
||||
const footerHeight = -50; // Hauteur estimée pour d'éventuels éléments en bas
|
||||
let availableHeight = windowHeight - tableTop - footerHeight;
|
||||
|
||||
// Définir une hauteur minimale
|
||||
availableHeight = Math.max(availableHeight, 400);
|
||||
|
||||
table.bootstrapTable('refreshOptions', {
|
||||
height: availableHeight
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
</HTML>
|
||||
Reference in New Issue
Block a user