Merge branch '1743-Nodos-ficticios-establecen-relaciones-solos-en-los-mapas-de-red-dev' into 'develop'

Changes in networkmap_links_to_js_links

See merge request artica/pandorafms!1365
This commit is contained in:
vgilc 2018-03-13 17:05:51 +01:00
commit 04ae61e9e2
1 changed files with 53 additions and 28 deletions

View File

@ -731,6 +731,15 @@ function networkmap_links_to_js_links($relations, $nodes_graph) {
$agent = agents_get_agent_id_by_module_id($relation['id_parent_source_data']);
$agent2 = agents_get_agent_id_by_module_id($relation['id_child_source_data']);
foreach ($nodes_graph as $key2 => $node) {
if(isset($node['id_agent'])) {
if($node['id_agent'] == $agent) {
$agent = $node['id_db'];
} else if ($node['id_agent'] == $agent2) {
$agent2 = $node['id_db'];
}
}
}
}
else if ($relation['child_type'] == 1) {
$mod1_status = db_get_value_filter('estado', 'tagente_estado', array('id_agente_modulo' => $relation['id_child_source_data']));
@ -742,8 +751,16 @@ function networkmap_links_to_js_links($relations, $nodes_graph) {
$item['link_color'] = "#FAD403";
}
$agent = $relation['id_parent_source_data'];
$agent2 = agents_get_agent_id_by_module_id($relation['id_child_source_data']);
foreach ($nodes_graph as $key2 => $node) {
if(isset($node['id_agent'])) {
if($node['id_agent'] == $relation['id_parent_source_data']) {
$agent = $node['id_db'];
} else if ($node['id_agent'] == $agent2) {
$agent2 = $node['id_db'];
}
}
}
}
else if ($relation['parent_type'] == 1) {
$mod1_status = db_get_value_filter('estado', 'tagente_estado', array('id_agente_modulo' => $relation['id_parent_source_data']));
@ -756,59 +773,67 @@ function networkmap_links_to_js_links($relations, $nodes_graph) {
}
$agent = agents_get_agent_id_by_module_id($relation['id_parent_source_data']);
$agent2 = $relation['id_child_source_data'];
foreach ($nodes_graph as $key2 => $node) {
if(isset($node['id_agent'])) {
if($node['id_agent'] == $agent) {
$agent = $node['id_db'];
} else if ($node['id_agent'] == $relation['id_child_source_data']) {
$agent2 = $node['id_db'];
}
}
}
}
else if (($relation['parent_type'] == 3) && ($relation['child_type'] == 3)) {
foreach ($nodes_graph as $key => $node) {
foreach ($nodes_graph as $key2 => $node) {
if ($relation['id_parent'] == $node['id_db']) {
$agent = $key;
$agent = $node['id_db'];
}
}
foreach ($nodes_graph as $key => $node) {
foreach ($nodes_graph as $key2 => $node) {
if ($relation['id_child'] == $node['id_db']) {
$agent2 = $key;
$agent2 = $node['id_db'];
}
}
}
else if (($relation['parent_type'] == 3) || ($relation['child_type'] == 3)) {
if ($relation['parent_type'] == 3) {
foreach ($nodes_graph as $key => $node) {
foreach ($nodes_graph as $key2 => $node) {
if ($relation['id_parent'] == $node['id_db']) {
$agent = $key;
$agent = $node['id_db'];
} else if ($node['id_agent'] == $relation['id_child_source_data']) {
$agent2 = $node['id_db'];
}
}
$agent2 = $relation['id_child_source_data'];
}
else if ($relation['child_type'] == 3) {
foreach ($nodes_graph as $key => $node) {
foreach ($nodes_graph as $key2 => $node) {
if ($relation['id_child'] == $node['id_db']) {
$agent2 = $key;
$agent2 = $node['id_db'];
} else if ($node['id_agent'] == $relation['id_parent_source_data']) {
$agent = $node['id_db'];
}
}
$agent = $relation['id_parent_source_data'];
}
}
else {
$agent = $relation['id_parent_source_data'];
$agent2 = $relation['id_child_source_data'];
foreach ($nodes_graph as $key2 => $node) {
if(isset($node['id_agent'])) {
if($node['id_agent'] == $relation['id_parent_source_data']) {
$agent = $node['id_db'];
} else if ($node['id_agent'] == $relation['id_child_source_data']) {
$agent2 = $node['id_db'];
}
}
}
}
foreach ($nodes_graph as $node) {
if (!isset($node['id_agent'])) {
if ($node['id'] == $agent) {
$item['target'] = $node['id'];
}
else if($node['id'] == $agent2) {
$item['source'] = $node['id'];
}
if ($node['id_db'] == $agent) {
$item['target'] = $node['id'];
}
else {
if ($node['id_agent'] == $agent) {
$item['target'] = $node['id'];
}
else if ($node['id_agent'] == $agent2) {
$item['source'] = $node['id'];
}
else if($node['id_db'] == $agent2) {
$item['source'] = $node['id'];
}
}
$return[] = $item;