';
if ($_SESSION['userlevel'] >= '7') {
$actions .= '
';
}
if ($subformat == 'detail') {
$actions .= '
';
$hostname = generate_device_link($device);
if (extension_loaded('mbstring')) {
$location = mb_substr($device['location'], 0, 32, 'utf8');
} else {
$location = substr($device['location'], 0, 32);
}
if ($subformat == 'detail') {
$platform = $device['hardware'] . '
' . $device['features'];
$os = $device['os_text'] . '
' . $device['version'];
$device['ip'] = inet6_ntop($device['ip']);
$uptime = formatUptime($device['uptime'], 'short');
if (format_hostname($device) !== $device['sysName']) {
$hostname .= '
' . $device['sysName'];
} elseif ($device['hostname'] !== $device['ip']) {
$hostname .= '
' . $device['hostname'];
}
$metrics = array();
if ($port_count) {
$port_widget = '';
$port_widget .= ' ' . $port_count;
$port_widget .= ' ';
$metrics[] = $port_widget;
}
if ($sensor_count) {
$sensor_widget = '';
$sensor_widget .= ' ' . $sensor_count;
$sensor_widget .= ' ';
$metrics[] = $sensor_widget;
}
if ($wireless_count) {
$wireless_widget = '';
$wireless_widget .= ' ' . $wireless_count;
$wireless_widget .= ' ';
$metrics[] = $wireless_widget;
}
$col_port = '';
$col_port .= implode(count($metrics) == 2 ? '
' : '', $metrics);
$col_port .= '
';
} else {
$platform = $device['hardware'];
$os = $device['os_text'] . ' ' . $device['version'];
$uptime = formatUptime($device['uptime'], 'short');
$col_port = '';
}
$response[] = array(
'extra' => $extra,
'msg' => $msg,
'list_type' => $subformat,
'icon' => $image,
'hostname' => $hostname,
'ports' => $col_port,
'hardware' => $platform,
'os' => $os,
'uptime' => $uptime,
'location' => $location,
'actions' => $actions,
);
}//end foreach
$output = array(
'current' => $current,
'rowCount' => $rowCount,
'rows' => $response,
'total' => $total,
);
echo _json_encode($output);