isUserAuthenticated(); /* get all unique switches */ $switches = getAllUniqueSwitches(); /* add unspecified */ $switches[] = array("id" => "", "hostname" => ""); /* switch count for collapse / extend */ $m = 0; # title print "<h4>" . _('List of network devices') . "</h4>"; print "<hr>"; # main table frame print "<table id='switchMainTable' class='switches table table-striped table-top table-condensed'>"; /* print */ foreach ($switches as $switch) { /* Get all IP addresses belonging to switch */ $ipaddresses = getIPaddressesBySwitchName($switch['id']); /* Get switch details */ $switchDetails = getSwitchDetailsByHostname($switch['hostname']); if (empty($switchDetails['hostname'])) { $switchDetails['hostname'] = _('Device not specified'); $switchDetails['ip_addr'] = ""; } else { $switchDetails['ip_addr'] = "({$switchDetails['ip_addr']})"; } /* reformat if empty */ if (empty($switch['hostname'])) { $switch['hostname'] = "Unspecified"; } # count size $size = sizeof($ipaddresses); # print name
<?php /** * Script to display devices * */ /* verify that user is authenticated! */ isUserAuthenticated(); /* get hosts under device */ $device = getDeviceById($_GET['sPage']); /* get custom fields */ $custom = getCustomFields('devices'); /* Get all IP addresses belonging to switch */ $ipaddresses = getIPaddressesBySwitchName($device['id']); //count items $cnt = countIPaddressesBySwitchId($device['id']); if ($_GET['sPage'] != 0 && $device) { //type $type = TransformDeviceType($device['type']); # title print "<h4>" . _('Device details') . "</h4>"; print "<hr>"; # device details print "<table class='ipaddress_subnet table-condensed table-full'>"; print '<tr>'; print "\t<th>" . _('Hostname') . '</a></th>'; print "\t<td>{$device['hostname']}</td>"; print "</tr>"; print "\t<th>" . _('IP address') . '</th>'; print "\t<td>{$device['ip_addr']}</td>"; print "</tr>";