query('SELECT id, name FROM countries ORDER BY name')->fetchAll(PDO::FETCH_ASSOC);
$countryId = filter_input(INPUT_GET, 'country_id', FILTER_VALIDATE_INT) ?: null;
$whereCountry = '';
$params = [];
if ($countryId) {
$whereCountry = 'WHERE s.country_id = ?';
$params[] = $countryId;
}
$totalSites = 0;
$totalCells = 0;
try {
$stmt = $db->prepare("SELECT COUNT(*) FROM sites s $whereCountry");
$stmt->execute($params);
$totalSites = (int)$stmt->fetchColumn();
$stmt = $db->prepare(
"SELECT COUNT(*) FROM cells c INNER JOIN sites s ON s.id = c.site_id $whereCountry"
);
$stmt->execute($params);
$totalCells = (int)$stmt->fetchColumn();
} catch (Throwable $e) {
error_log('[statistics] compteurs generaux: ' . $e->getMessage());
}
$byOperator = $db->prepare(
"SELECT o.brand AS operator_name, COUNT(DISTINCT s.id) AS site_count, COUNT(c.id) AS cell_count
FROM operators o
LEFT JOIN sites s ON s.operator_id = o.id " . ($countryId ? 'AND s.country_id = ?' : '') . "
LEFT JOIN cells c ON c.site_id = s.id
GROUP BY o.id, o.brand
ORDER BY cell_count DESC"
);
$byOperator->execute($countryId ? [$countryId] : []);
$byOperator = $byOperator->fetchAll(PDO::FETCH_ASSOC);
$byTechnology = $db->prepare(
"SELECT c.tech, COUNT(*) AS total
FROM cells c
INNER JOIN sites s ON s.id = c.site_id
$whereCountry
GROUP BY c.tech
ORDER BY total DESC"
);
$byTechnology->execute($params);
$byTechnology = $byTechnology->fetchAll(PDO::FETCH_ASSOC);
$byBand = $db->prepare(
"SELECT c.band, COUNT(*) AS total
FROM cells c
INNER JOIN sites s ON s.id = c.site_id
$whereCountry
GROUP BY c.band
ORDER BY total DESC
LIMIT 30"
);
$byBand->execute($params);
$byBand = $byBand->fetchAll(PDO::FETCH_ASSOC);
$user = current_admin_username();
?>
Statistiques
Vue de consultation agregee, sans action d'ecriture possible.
Vue d'ensemble
= number_format($totalSites, 0, ',', ' ') ?>Sites
= number_format($totalCells, 0, ',', ' ') ?>Cellules
Par operateur
| Operateur | Sites | Cellules |
| = htmlspecialchars((string)$row['operator_name'], ENT_QUOTES, 'UTF-8') ?> |
= (int)$row['site_count'] ?> |
= (int)$row['cell_count'] ?> |
| Aucune donnee. |
Par technologie
| Technologie | Cellules |
| = htmlspecialchars((string)$row['tech'], ENT_QUOTES, 'UTF-8') ?> |
= (int)$row['total'] ?> |
| Aucune donnee. |
Par bande (top 30)
| Bande | Cellules |
| = htmlspecialchars((string)$row['band'], ENT_QUOTES, 'UTF-8') ?> |
= (int)$row['total'] ?> |
| Aucune donnee. |