72 lines
3.0 KiB
PHP
72 lines
3.0 KiB
PHP
<?php
|
||
/**
|
||
* dashboards-registry.php · Single Source of Truth for all WEVAL dashboards
|
||
* wave-246 · point entrée unique consolidé · zero hardcode · auto-scan
|
||
*/
|
||
header("Content-Type: application/json; charset=utf-8");
|
||
|
||
$html_dir = "/var/www/html";
|
||
$dashboards = [];
|
||
|
||
// Scan all *dashboard*.html + *dashboard*.php
|
||
foreach (array_merge(glob("$html_dir/*dashboard*.html"), glob("$html_dir/*dashboard*.php")) as $f) {
|
||
$bn = basename($f);
|
||
$content = @file_get_contents($f);
|
||
$title = $bn;
|
||
if (preg_match("/<title>([^<]+)<\/title>/i", $content, $m)) $title = trim($m[1]);
|
||
elseif (preg_match("/<h1[^>]*>([^<]+)<\/h1>/i", $content, $m)) $title = trim(strip_tags($m[1]));
|
||
|
||
// Category inference
|
||
$cat = "Autres";
|
||
if (stripos($bn, "kpi") !== false) $cat = "KPI & Analytics";
|
||
elseif (stripos($bn, "6sigma") !== false || stripos($bn, "lean") !== false) $cat = "Lean 6σ";
|
||
elseif (stripos($bn, "crm") !== false || stripos($bn, "lead") !== false) $cat = "CRM";
|
||
elseif (stripos($bn, "ethica") !== false || stripos($bn, "medreach") !== false) $cat = "Ethica";
|
||
elseif (stripos($bn, "infra") !== false || stripos($bn, "security") !== false || stripos($bn, "office") !== false) $cat = "Infrastructure";
|
||
elseif (stripos($bn, "wevia") !== false) $cat = "WEVIA";
|
||
elseif (stripos($bn, "contact") !== false || stripos($bn, "segment") !== false || stripos($bn, "database") !== false) $cat = "Données";
|
||
elseif (stripos($bn, "acquired") !== false || stripos($bn, "dormant") !== false) $cat = "Lifecycle";
|
||
elseif (stripos($bn, "orphan") !== false) $cat = "Audit";
|
||
elseif (stripos($bn, "paperclip") !== false || stripos($bn, "em-") !== false) $cat = "Pilotage";
|
||
elseif (stripos($bn, "hub") !== false || stripos($bn, "index") !== false) $cat = "Hub central";
|
||
elseif (stripos($bn, "e2e") !== false) $cat = "Tests";
|
||
|
||
$dashboards[] = [
|
||
"file" => $bn,
|
||
"url" => "/$bn",
|
||
"title" => substr($title, 0, 80),
|
||
"category" => $cat,
|
||
"size_kb" => round(filesize($f)/1024, 1),
|
||
"mtime" => date("c", filemtime($f)),
|
||
"days_ago" => round((time() - filemtime($f))/86400),
|
||
"recent" => (time() - filemtime($f)) < 172800,
|
||
];
|
||
}
|
||
|
||
// Group
|
||
$by_cat = [];
|
||
foreach ($dashboards as $d) {
|
||
$by_cat[$d["category"]] = ($by_cat[$d["category"]] ?? 0) + 1;
|
||
}
|
||
ksort($by_cat);
|
||
|
||
echo json_encode([
|
||
"ok" => true,
|
||
"version" => "wave-246",
|
||
"ts" => date("c"),
|
||
"total" => count($dashboards),
|
||
"categories" => $by_cat,
|
||
"categories_count" => count($by_cat),
|
||
"hub_url" => "/dashboards-hub-unified.html",
|
||
"entry_points" => [
|
||
"wtp" => "/weval-technology-platform.html",
|
||
"hub" => "/dashboards-hub-unified.html",
|
||
"ia_hub" => "/all-ia-hub.html",
|
||
"master" => "/wevia-master.html",
|
||
"orchestrator" => "/wevia-orchestrator.html",
|
||
],
|
||
"source" => "auto-scan filesystem",
|
||
"zero_orphan" => true,
|
||
"dashboards" => $dashboards,
|
||
], JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE);
|