2007-04-03 14:10:23 +00:00
< ? php
2015-07-13 20:10:26 +02:00
if ( $device [ 'status' ] == '0' ) {
$class = 'alert-danger' ;
2011-04-21 12:59:44 +00:00
}
2015-07-13 20:10:26 +02:00
else {
$class = '' ;
}
if ( $device [ 'ignore' ] == '1' ) {
$class = 'div-ignore-alert' ;
if ( $device [ 'status' ] == '1' ) {
$class = 'alert-warning' ;
}
}
if ( $device [ 'disabled' ] == '1' ) {
$class = 'alert-info' ;
2011-04-21 12:59:44 +00:00
}
2011-04-21 13:21:07 +00:00
$type = strtolower ( $device [ 'os' ]);
2007-04-03 14:10:23 +00:00
2012-04-24 22:50:15 +00:00
$image = getImage ( $device );
2016-01-25 22:04:12 +00:00
$host_id = dbFetchCell ( " SELECT `device_id` FROM `vminfo` WHERE `vmwVmDisplayName` = ? OR `vmwVmDisplayName` = ? " , array ( $device [ 'hostname' ], $device [ 'hostname' ] . '.' . $config [ 'mydomain' ]));
2007-04-03 14:10:23 +00:00
2015-07-13 20:10:26 +02:00
echo '
2014-01-13 10:05:19 +00:00
<tr bgcolor="' . $device_colour . '" class="alert ' . $class . '">
2016-01-25 22:04:12 +00:00
<td><span class="device_icon">' . $image . '</span></td>
<td>' ;
if ( $host_id > 0 ) {
echo '
<a href="' . generate_url ( array ( 'page' => 'device' , 'device' => $host_id )) . '"><i class="fa fa-server fa-fw fa-lg"></i></a>
' ;
}
echo '
<span style="font-size: 20px;">' . generate_device_link ( $device ) . '</span>
2015-11-27 07:27:54 -08:00
<br />' . generate_link ( $device [ 'location' ], array ( 'page' => 'devices' , 'location' => $device [ 'location' ])) . '</td>
2015-07-13 20:10:26 +02:00
<td>' ;
2011-09-19 02:20:16 +00:00
2015-07-13 20:10:26 +02:00
if ( isset ( $config [ 'os' ][ $device [ 'os' ]][ 'over' ])) {
$graphs = $config [ 'os' ][ $device [ 'os' ]][ 'over' ];
2012-05-20 19:57:11 +00:00
}
2015-07-13 20:10:26 +02:00
else if ( isset ( $device [ 'os_group' ]) && isset ( $config [ 'os' ][ $device [ 'os_group' ]][ 'over' ])) {
$graphs = $config [ 'os' ][ $device [ 'os_group' ]][ 'over' ];
2012-05-20 19:57:11 +00:00
}
2015-07-13 20:10:26 +02:00
else {
$graphs = $config [ 'os' ][ 'default' ][ 'over' ];
2012-05-20 19:57:11 +00:00
}
2011-09-19 02:20:16 +00:00
2015-07-13 20:10:26 +02:00
$graph_array = array ();
$graph_array [ 'height' ] = '100' ;
$graph_array [ 'width' ] = '310' ;
$graph_array [ 'to' ] = $config [ 'time' ][ 'now' ];
$graph_array [ 'device' ] = $device [ 'device_id' ];
$graph_array [ 'type' ] = 'device_bits' ;
$graph_array [ 'from' ] = $config [ 'time' ][ 'day' ];
$graph_array [ 'legend' ] = 'no' ;
2012-05-20 19:57:11 +00:00
$graph_array [ 'popup_title' ] = $descr ;
2011-09-19 02:20:16 +00:00
2015-07-13 20:10:26 +02:00
$graph_array [ 'height' ] = '45' ;
$graph_array [ 'width' ] = '150' ;
$graph_array [ 'bg' ] = 'FFFFFF00' ;
2011-09-19 02:20:16 +00:00
2015-07-13 20:10:26 +02:00
foreach ( $graphs as $entry ) {
if ( $entry [ 'graph' ]) {
$graph_array [ 'type' ] = $entry [ 'graph' ];
2011-09-19 02:20:16 +00:00
2015-07-13 20:10:26 +02:00
echo " <div style='float: right; text-align: center; padding: 1px 5px; margin: 0 1px; ' class='rounded-5px'> " ;
print_graph_popup ( $graph_array );
echo " <div style='font-weight: bold; font-size: 7pt; margin: -3px;'> " . $entry [ 'text' ] . '</div>' ;
echo '</div>' ;
}
2012-05-20 19:57:11 +00:00
}
2011-09-19 02:20:16 +00:00
2012-05-20 19:57:11 +00:00
unset ( $graph_array );
2011-09-19 02:20:16 +00:00
2015-07-13 20:10:26 +02:00
echo '</td>
</tr>' ;