minor fix

Former-commit-id: 1ccd9e446645362fb9b305a699527c5aa2c20369
This commit is contained in:
fbsanchez 2019-03-22 14:43:55 +01:00
parent bc1195e78e
commit a4c048dd29
1 changed files with 36 additions and 28 deletions

View File

@ -1980,41 +1980,49 @@ class NetworkMap
$i++;
}
// Search for relations.
foreach ($this->nodes as $k => $item) {
$target = $this->calculateRelations($k);
if (!$this->relations) {
// Search for relations.
foreach ($this->nodes as $k => $item) {
$target = $this->calculateRelations($k);
// Adopt all orphan nodes but pandora one.
if (empty($target)) {
if (isset($this->noPandoraNode) === false
|| $this->noPandoraNode == false
) {
if ($item['id_node'] != 0) {
$rel = [];
$rel['id_parent'] = 0;
$rel['id_child'] = $item['id_node'];
$rel['parent_type'] = NODE_PANDORA;
$rel['child_type'] = $item['node_type'];
$rel['id_child_source_data'] = $item['id_source_data'];
// Adopt all orphan nodes but pandora one.
if (empty($target)) {
if (isset($this->noPandoraNode) === false
|| $this->noPandoraNode == false
) {
if ($item['id_node'] != 0) {
$rel = [];
$rel['id_parent'] = 0;
$rel['id_child'] = $item['id_node'];
$rel['parent_type'] = NODE_PANDORA;
$rel['child_type'] = $item['node_type'];
$rel['id_child_source_data'] = $item['id_source_data'];
$orphans[] = $rel;
$orphans[] = $rel;
}
}
} else {
// Flattern edges.
foreach ($target as $rel) {
$edges[] = $rel;
}
}
} else {
// Flattern edges.
foreach ($target as $rel) {
$edges[] = $rel;
}
}
} else {
$edges = $this->relations;
}
foreach ($edges as $rel) {
$graph .= $this->createDotEdge(
[
'to' => $rel['id_child'],
'from' => $rel['id_parent'],
]
);
if (is_array($edges)) {
foreach ($edges as $rel) {
$graph .= $this->createDotEdge(
[
'to' => $rel['id_child'],
'from' => $rel['id_parent'],
]
);
}
} else {
$edges = [];
}
if (isset($this->noPandoraNode) === false