Files
librenms-librenms/html/pages/locations.inc.php
T

44 lines
2.6 KiB
PHP
Raw Normal View History

2009-09-07 11:07:59 +00:00
<?php
2010-01-10 20:20:18 +00:00
echo('<table cellpadding="7" cellspacing="0" class="devicetable" width="100%">');
2007-04-03 14:10:23 +00:00
foreach (getlocations() as $location)
{
if (!isset($bg) || $bg == "#ffffff") { $bg = "#eeeeee"; } else { $bg="#ffffff"; }
if ($_SESSION['userlevel'] == '10')
{
2011-05-14 21:51:58 +00:00
$num = dbFetchCell("SELECT COUNT(device_id) FROM devices WHERE location = ?", array($location));
$net = dbFetchCell("SELECT COUNT(device_id) FROM devices WHERE location = ? AND type = 'network'", array($location));
$srv = dbFetchCell("SELECT COUNT(device_id) FROM devices WHERE location = ? AND type = 'server'", array($location));
$fwl = dbFetchCell("SELECT COUNT(device_id) FROM devices WHERE location = ? AND type = 'firewall'", array($location));
$hostalerts = dbFetchCell("SELECT COUNT(device_id) FROM devices WHERE location = ? AND status = '0'", array($location));
2010-04-24 14:23:16 +00:00
} else {
2011-05-14 21:51:58 +00:00
$num = dbFetchCell("SELECT COUNT(D.device_id) FROM devices AS D, devices_perms AS P WHERE D.device_id = P.device_id AND P.user_id = ? AND location = ?", array($_SESSION['user_id'], $location));
$net = dbFetchCell("SELECT COUNT(D.device_id) FROM devices AS D, devices_perms AS P WHERE D.device_id = P.device_id AND P.user_id = ? AND location = ? AND D.type = 'network'", array($_SESSION['user_id'], $location));
$srv = dbFetchCell("SELECT COUNT(D.device_id) FROM devices AS D, devices_perms AS P WHERE D.device_id = P.device_id AND P.user_id = ? AND location = ? AND type = 'server'", array($_SESSION['user_id'], $location));
$fwl = dbFetchCell("SELECT COUNT(D.device_id) FROM devices AS D, devices_perms AS P WHERE D.device_id = P.device_id AND P.user_id = ? AND location = ? AND type = 'firewall'", array($_SESSION['user_id'], $location));
$hostalerts = dbFetchCell("SELECT COUNT(device_id) FROM devices AS D, devices_perms AS P WHERE D.device_id = P.device_id AND P.user_id = ? AND location = ? AND status = '0'", array($_SESSION['user_id'], $location));
2010-04-24 14:23:16 +00:00
}
2007-04-03 14:10:23 +00:00
if ($hostalerts) { $alert = '<img src="images/16/flag_red.png" alt="alert" />'; } else { $alert = ""; }
2007-04-03 14:10:23 +00:00
if ($location != "")
{
echo(' <tr bgcolor="' . $bg . '">
<td class="interface" width="300"><a class="list-bold" href="?page=devices&amp;location=' . urlencode($location) . '">' . $location . '</a></td>
2010-01-10 20:20:18 +00:00
<td width="100">' . $alert . '</td>
<td width="100">' . $num . ' devices</td>
<td width="100">' . $net . ' network</td>
<td width="100">' . $srv . ' servers</td>
<td width="100">' . $fwl . ' firewalls</td>
2007-04-03 14:10:23 +00:00
</tr>
2010-01-10 20:20:18 +00:00
');
2007-04-03 14:10:23 +00:00
$done = "yes";
}
}
echo("</table>");
2011-05-13 15:05:29 +00:00
?>