function TopoFloors($r, $c, $b, $siz = 0) { global $link, $dev, $img, $modgroup, $self, $v, $place, $netlbl, $acslbl, $porlbl, $frelbl, $refresh; $query = GenQuery('locations', 's', 'id,x,y,ns,ew,locdesc', '', '', array('region', 'city', 'building'), array('=', '=', '='), array($r, $c, $b), array('AND', 'AND')); $res = DbQuery($query, $link); if (DbNumRows($res)) { list($id, $x, $y, $ns, $ew, $des) = DbFetchRow($res); echo "<h2>{$b} - {$des}</h2>\n"; } else { echo "<h2>{$b} {$place['b']}</h2>\n"; } echo "<table class=\"content fixed\">\n"; uksort($dev, "floorsort"); foreach (array_keys($dev) as $fl) { echo "<tr>\n\t<td class=\"{$modgroup[$self]}2\" width=\"80\"><h3>\n"; if (!$siz) { echo "<img src=\"img/stair.png\"><br>\n"; } echo "{$fl}</h3>\n"; if (!$siz) { $bas = "topo/" . preg_replace('/\\W/', '', $r) . '/' . preg_replace('/\\W/', '', $c) . '/' . preg_replace('/\\W/', '', $b) . '-' . preg_replace('/\\W/', '', $fl); foreach (glob("{$bas}*") as $f) { list($ico, $ed) = FileImg($f); echo "{$ico} "; } } echo "</td>\n"; $col = 0; $prm = ""; ksort($dev[$fl]); foreach (array_keys($dev[$fl]) as $rm) { if ($prm != $rm) { $bi = $bi == "imga" ? "imgb" : "imga"; } $prm = $rm; foreach (array_keys($dev[$fl][$rm]) as $d) { $ip = $dev[$fl][$rm][$d]['ip']; $po = $dev[$fl][$rm][$d]['po']; $ty = $dev[$fl][$rm][$d]['ty']; $di = $dev[$fl][$rm][$d]['ic']; $co = $dev[$fl][$rm][$d]['co']; $rk = $dev[$fl][$rm][$d]['rk']; $mn = $dev[$fl][$rm][$d]['mn']; $al = $dev[$fl][$rm][$d]['al']; $sz = $dev[$fl][$rm][$d]['sz']; $sk = $dev[$fl][$rm][$d]['sk'] > 1 ? "<img src=\"img/" . $dev[$fl][$rm][$d]['sk'] . ".png\" title=\"Stack\">" : ""; list($statbg, $stat) = StatusBg(1, $mn, $al, $bi); $tit = $stat ? $stat : $ty; $ud = urlencode($d); $ur = urlencode($r); $uc = urlencode($c); $ub = urlencode($b); $uf = urlencode($fl); $um = urlencode($rm); if ($col == $_SESSION['col']) { $col = 0; echo "</tr><tr><td> </td>\n"; } if ($siz) { echo "<td class=\"{$statbg}\" valign=\"top\"><center><img src=\"img/dev/{$di}.png\" title=\"{$ip}\"><br>{$d}</center></td>\n"; } else { $ii = $refresh ? 0 : IfFree($d); $inif = $ii ? "<div style=\"float:right\"><a href=\"Devices-Interfaces.php?in[]=device&op[]==&st[]={$ud}&co[]=AND&in[]=ifstat&op[]=<&st[]=3&co[]=AND&in[]=iftype&op[]=~&st[]=^(6|7|117)\$&col[]=imBL&col[]=ifname&col[]=device&col[]=linktype&col[]=ifdesc&col[]=alias&col[]=lastchg&col[]=inoct&col[]=outoct&ord=lastchg\"><img src=\"img/p45.png\" title=\"{$acslbl} {$porlbl} {$frelbl}\">{$ii}</a></div>" : ''; $rkv = $dev[$fl][$rm][$d]['ru'] ? "<a href=\"Topology-Table.php?reg={$ur}&cty={$uc}&bld={$ub}&fl={$uf}&rm={$um}\">{$rm}</a>" : $rm; echo "<td class=\"{$statbg}\" valign=\"top\"><b>{$rkv}</b> {$rk} {$inif}<p><div style=\"text-align:center;\">\n"; echo "<a href=\"Devices-Status.php?dev={$ud}\">"; echo "<img src=\"" . ($img ? DevPanel($ty, $di, $sz) . "\" width=\"" . (preg_match('/^ph|^wa|^ca/', $di) ? 40 : 100) . "\"" : "img/dev/{$di}.png\"") . " title=\"{$tit}\"></a>{$sk}<br><b>{$d}</b><br>\n"; echo Devcli($ip, $po); echo "<p>{$co}</div></td>\n"; } $col++; } } } echo "</tr></table>\n"; }
if( substr($dev[27],1,1) == "C" ){ echo " <img src=\"img/16/cpu.png\" title=\"CPU $lodlbl\">".Bar($dev[20],$cpua/2,'si')." $dev[20]% "; } if( $dev[30] > 1 and preg_match('/^..[MPS]/',$dev[27]) ){ $putil = round($dev[31] / $dev[30] * 100,1); echo " <img src=\"img/16/batt.png\" title=\"PoE $lodlbl\">".Bar($putil,$poew/2,'si')." $putil% "; } if($tmp){ echo " <img src=\"img/16/temp.png\" title=\"$tmplbl\">".Bar($dev[22],$tmpa/2,'si')." $tmp "; } $pcnt = NodPop( array('device'),array('='),array($dev[0]),array() ); echo " <a href=\"Nodes-List.php?in[]=device&op[]==&st[]=$ud&ord=ifname\"><img src=\"img/16/nods.png\" title=\"$poplbl\">".Bar($pcnt,100,'si')." $pcnt</a>"; if ($rver){ $ii = IfFree($dev[0]); echo " <a href=\"Devices-Interfaces.php?in[]=device&op[]==&st[]=$ud&co[]=AND&in[]=ifstat&op[]=<&st[]=3&co[]=AND&in[]=iftype&op[]=~&st[]=^(6|7|117)$&col[]=imBL&col[]=ifname&col[]=device&col[]=linktype&col[]=ifdesc&col[]=alias&col[]=lastchg&col[]=inoct&col[]=outoct&ord=lastchg\"><img src=\"img/p45.png\" title=\"$acslbl $porlbl $frelbl\">".Bar($ii,-5,'si')." $ii</a> "; if( $wasup ){ $uptime = Get($ip, $rver, $dev[15], "1.3.6.1.2.1.1.3.0"); if($uptime){ $upsec = Tic2Sec($uptime); $sttit = date($_SESSION['date'],time() - $upsec); $uptit = sprintf("%d %s %d:%02d",floor($upsec/86400),$tim['d'],floor(($upsec%86400)/3600),floor(($upsec%3600)/60)); if ($upsec < 86400){ echo " <img src=\"img/16/warn.png\" title=\"$uptlbl < 24 $tim[h], $sttlbl $sttit\"> $uptit"; }else{ echo " <img src=\"img/16/bchk.png\" title=\"$uptlbl > 24 $tim[h], $sttlbl $sttit\"> $uptit"; } if( array_key_exists($ip,$mapip) ){