';
$str_table = '
| 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
FROM "Devices" WHERE "dev_Network_Node_MAC" = "'.$node_mac.'"';
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']);
}
// Control no rows
if (empty($tableData)) {
$tableData = [];
}
$str_table_rows = "";
foreach ($tableData as $row) {
if ($row['online'] == 1) {
$port_state = 'Online
';
} else {
$port_state = 'Offline
';
}
// BUG: TODO fix icons - I'll need to fix the SQL query to add the type of the node on line 95
// prepare HTML for the port table column cell
$port_content = "N/A";
if ($row['type'] == "WLAN" || $row['type'] == "AP" ) {
$port_content = '';
} elseif ($row['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
if($str_table_rows == "")
{
$str_table = "";
$str_table_close = "";
}
$str_close_pane = '