addCssFile('modules/WecomCenter/assets/l2topology/style.css?v=202611052255'); $base = '/modules/WecomCenter/assets/l2topology/'; $snapJson = (string) ($data['snap_json'] ?? 'null'); $cfgJson = (string) ($data['cfg_json'] ?? '{}'); $snapSafe = str_replace('', '<\/', $snapJson); $cfgSafe = str_replace('', '<\/', $cfgJson); $i18nKeys = [ 'l2.title','l2.search_ph','l2.show_term','l2.only_off','l2.auto_refresh','l2.min', 'l2.refresh_now','l2.fit','l2.alarms','l2.offline','l2.time_live','l2.time_btn', 'l2.time_label','l2.time_pick','l2.no_data','l2.offline_empty','l2.alarm_empty','l2.updated', 'l2.pause','l2.resume','l2.legend_speed','l2.legend_tier','l2.legend_lat','l2.core','l2.main','l2.dist','l2.access', 'l2.lat_norm','l2.term_on','l2.term_off','l2.term_title','l2.term_mac','l2.term_rate','l2.term_switch','l2.term_port','l2.term_ip','l2.zoom_in','l2.zoom_out','l2.snapshot','l2.showing','l2.live_tag', 'l2.unit_sw','l2.tile_hint','l2.not_in_topo','l2.click_hint','l2.floor_na', 'l2.net_surve','l2.net_office','l2.net_other', 'l2.terminals','l2.offline_short','l2.last_online','l2.history','l2.history_live', 'l2.history_live_hint','l2.history_empty','l2.time_date','l2.time_time', 'l2.time_date_title','l2.time_time_title','l2.firewall','l2.behavior','l2.total_core','l2.upstream' ]; $i18n = []; foreach ($i18nKeys as $k) { $i18n[$k] = I18n::t($k); } $i18nJson = str_replace('', '<\/', json_encode($i18n, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)); $hist = $data['history'] ?? []; $isLive = !empty($data['is_live']); $usedTs = (int) ($data['used_ts'] ?? 0); $byDay = []; foreach ($hist as $h) { $byDay[date('Y-m-d', (int) $h['ts'])][] = $h; } $usedDay = (!$isLive && $usedTs) ? date('Y-m-d', $usedTs) : ''; $dateOpts = ''; $timeOpts = ''; foreach ($byDay as $day => $items) { $dateOpts .= ''; if ($day === $usedDay) { $timeOpts = ''; foreach ($items as $h) { $sel = ($usedTs === (int) $h['ts']) ? ' selected' : ''; $timeOpts .= ''; } } } $refreshSec = (int) ($data['cfg_refresh'] ?? 300); if (!function_exists('l2e')) { function l2e($v) { return htmlspecialchars((string) $v, ENT_QUOTES, 'UTF-8'); } } ?>