';
$str_table = '
'.$pia_lang['Device_Title'].'
| Port |
'.$pia_lang['Network_Table_State'].' |
'.$pia_lang['Network_Table_Hostname'].' |
'.$pia_lang['Network_Table_IP'].' |
';
// Prepare Array for Devices with Port value
// If no Port is set, the Port number is set to 0
if ($node_ports_count == "") {
$node_ports_count = 0;
}
// Get all leafs connected to a node based on the node_mac
$func_sql = 'SELECT dev_Network_Node_port as port,
dev_MAC as mac,
dev_PresentLastScan as online,
dev_Name as name,
dev_DeviceType as type,
dev_LastIP as last_ip,
(select dev_DeviceType from Devices a where dev_MAC = "'.$node_mac.'") as node_type
FROM Devices WHERE dev_Network_Node_MAC_ADDR = "'.$node_mac.'" order by port asc';
global $db;
$func_result = $db->query($func_sql);
// array
$tableData = array();
while ($row = $func_result -> fetchArray (SQLITE3_ASSOC)) {
// Push row data
$tableData[] = array( 'port' => $row['port'],
'mac' => $row['mac'],
'online' => $row['online'],
'name' => $row['name'],
'type' => $row['type'],
'last_ip' => $row['last_ip'],
'node_type' => $row['node_type']);
}
// Control no rows
if (empty($tableData)) {
$tableData = [];
}
$str_table_rows = "";
foreach ($tableData as $row) {
if ($row['online'] == 1) {
$port_state = badge_online;
} else {
$port_state = badge_offline;
}
// prepare HTML for the port table column cell
$port_content = "N/A";
if ($row['node_type'] == "WLAN" || $row['node_type'] == "AP" ) {
$port_content = '';
} elseif ($row['node_type'] == "Powerline")
{
$port_content = '';
} elseif ($row['port'] != NULL && $row['port'] != "")
{
$port_content = $row['port'];
}
$str_table_rows = $str_table_rows.
'
|
'.$port_content.'
|
'
.$port_state.
' |
'.$row['name'].'
|
'
.$row['last_ip'].
' |
';
}
$str_table_close = '
';
// no connected device - don't render table, just dispaly some info
if($str_table_rows == "")
{
$str_table = "
".$pia_lang['Device_Title']."
This network device (node) doesn't have any assigned devices (leaf nodes).
Go to
".$pia_lang['Device_Title'].", select a device you want to attach to this node and assign it in the
Details tab by selecting it in the
".$pia_lang['DevDetail_MainInfo_Network'] ." dropdown.
";
$str_table_close = "";
}
$str_close_pane = '