mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-30 09:15:15 +02:00
Error fixes
This commit is contained in:
parent
feb5e10bf4
commit
30774c54d8
@ -742,8 +742,6 @@ class Tree {
|
|||||||
|
|
||||||
foreach ($items as $key => $child) {
|
foreach ($items as $key => $child) {
|
||||||
|
|
||||||
$childrenAux = array();
|
|
||||||
|
|
||||||
// Store the item in a temporary element
|
// Store the item in a temporary element
|
||||||
$resultItem = $child;
|
$resultItem = $child;
|
||||||
// Remove the item
|
// Remove the item
|
||||||
@ -751,7 +749,7 @@ class Tree {
|
|||||||
|
|
||||||
// The 'id' parameter will be stored as 'server_id' => 'id'
|
// The 'id' parameter will be stored as 'server_id' => 'id'
|
||||||
$resultItem['id'] = array();
|
$resultItem['id'] = array();
|
||||||
$resultItem['id'][$child['server_id']] = $child['id'];
|
$resultItem['id'][$resultItem['server_id']] = $resultItem['id'];
|
||||||
|
|
||||||
// Initialize counters if any of it don't exist
|
// Initialize counters if any of it don't exist
|
||||||
if (!isset($resultItem['counters']))
|
if (!isset($resultItem['counters']))
|
||||||
@ -771,6 +769,10 @@ class Tree {
|
|||||||
if (!isset($resultItem['counters']['alerts']))
|
if (!isset($resultItem['counters']['alerts']))
|
||||||
$resultItem['counters']['alerts'] = 0;
|
$resultItem['counters']['alerts'] = 0;
|
||||||
|
|
||||||
|
// Add the children
|
||||||
|
if (!isset($resultItem['children']))
|
||||||
|
$resultItem['children'] = array();
|
||||||
|
|
||||||
// Iterate over the list to search items that match the actual item
|
// Iterate over the list to search items that match the actual item
|
||||||
foreach ($items as $key2 => $child2) {
|
foreach ($items as $key2 => $child2) {
|
||||||
// Skip the actual or empty items
|
// Skip the actual or empty items
|
||||||
@ -792,14 +794,14 @@ class Tree {
|
|||||||
|
|
||||||
// Add the matched children
|
// Add the matched children
|
||||||
if (isset($child2['children']))
|
if (isset($child2['children']))
|
||||||
$childrenAux += $child2['children'];
|
$resultItem['children'] += $child2['children'];
|
||||||
|
|
||||||
// Remove the item
|
// Remove the item
|
||||||
unset($items[$key2]);
|
unset($items[$key2]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Get the merged children (recursion)
|
// Get the merged children (recursion)
|
||||||
if (!empty($childrenAux))
|
if (!empty($resultItem['children']))
|
||||||
$resultItem['children'] = __getMergedItems($childrenAux);
|
$resultItem['children'] = __getMergedItems($childrenAux);
|
||||||
|
|
||||||
// Add the resulting item
|
// Add the resulting item
|
||||||
|
Loading…
x
Reference in New Issue
Block a user