<?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>";
print ' <td class="hidden-sm hidden-xs">' . ${$device}['model'] . '</td>' . "\n"; print ' <td class="hidden-sm hidden-xs">' . $device['version'] . '</td>' . "\n"; //custom if (sizeof($custom) > 0) { foreach ($custom as $field) { if (!in_array($field['name'], $ffields)) { print "<td class='hidden-sm hidden-xs hidden-md'>" . $device[$field['name']] . "</td>"; } } } print ' <td class="actions"><a href="' . create_link("tools", "devices", "hosts", $device['id']) . '" class="btn btn-sm btn-default"><i class="fa fa-angle-right"></i> ' . _('Show all hosts') . '</a></td>'; print '</tr>' . "\n"; } # print for unspecified print '<tr class="unspecified">' . "\n"; $cnt = countIPaddressesBySwitchId(NULL); print ' <td>' . _('Device not specified') . '</td>' . "\n"; print ' <td></td>' . "\n"; print ' <td></td>' . "\n"; print ' <td><strong>' . $cnt . '</strong> ' . _('Hosts') . '</td>' . "\n"; print ' <td class="hidden-sm"></td>' . "\n"; print ' <td class="hidden-sm hidden-xs"></td>' . "\n"; print ' <td class="hidden-sm hidden-xs"></td>' . "\n"; print ' <td class="hidden-sm hidden-xs"></td>' . "\n"; //custom if (sizeof($custom) > 0) { foreach ($custom as $field) { if (!in_array($field['name'], $ffields)) { print "<td class='hidden-sm hidden-xs hidden-md'></td>"; } }