New networkmaps in progress... (Migrate open maps)
This commit is contained in:
parent
bca411b005
commit
9aaf4967a3
|
@ -1069,6 +1069,51 @@ function is_in_rel_array ($relations, $relation) {
|
|||
return $is_in_array;
|
||||
}
|
||||
|
||||
function migrate_older_open_maps() {
|
||||
global $config;
|
||||
|
||||
$older_networkmaps = db_get_all_rows_sql("SELECT * FROM tnetwork_map");
|
||||
|
||||
foreach ($older_networkmaps as $old_networkmap) {
|
||||
$map_values = array();
|
||||
$map_values['id_group'] = $old_networkmap['id_group'];
|
||||
$map_values['id_user'] = $old_networkmap['id_user'];
|
||||
$map_values['type'] = 0;
|
||||
$map_values['subtype'] = 0;
|
||||
$map_values['name'] = $old_networkmap['name'];
|
||||
|
||||
$new_map_filter = array();
|
||||
$new_map_filter['dont_show_subgroups'] = $old_networkmap['dont_show_subgroups'];
|
||||
$new_map_filter['node_radius'] = 40;
|
||||
$map_values['filter'] = json_encode($new_map_filter);
|
||||
|
||||
$map_values['description'] = "Mapa open migrado";
|
||||
$map_values['width'] = 4000;
|
||||
$map_values['height'] = 4000;
|
||||
$map_values['center_x'] = 2000;
|
||||
$map_values['center_y'] = 2000;
|
||||
$map_values['background'] = "";
|
||||
$map_values['background_options'] = 0;
|
||||
$map_values['source_period'] = 60;
|
||||
$map_values['source'] = 0;
|
||||
$map_values['source_data'] = $old_networkmap['id_group'];
|
||||
if ($old_networkmap['type'] == 'radial_dinamic') {
|
||||
$map_values['generation_method'] = 6;
|
||||
}
|
||||
else {
|
||||
$map_values['generation_method'] = 4;
|
||||
}
|
||||
$map_values['generated'] = 0;
|
||||
|
||||
$id_new_map = db_process_sql_insert('tmap', $map_values);
|
||||
|
||||
if (!$id_new_map) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function show_networkmap($id = 0, $user_readonly = false, $nodes_and_relations = array()) {
|
||||
global $config;
|
||||
|
||||
|
|
|
@ -106,6 +106,8 @@ if ($edit_networkmap) {
|
|||
break;
|
||||
case 5:
|
||||
$method = "fdp";
|
||||
case 6:
|
||||
$method = "radial_dinamic";
|
||||
break;
|
||||
}
|
||||
$recon_task_id = 0;
|
||||
|
@ -216,7 +218,8 @@ else {
|
|||
'dot' => 'flat',
|
||||
'circo' => 'circular',
|
||||
'neato' => 'spring1',
|
||||
'fdp' => 'spring2'
|
||||
'fdp' => 'spring2',
|
||||
'radial_dinamic' => 'radial dinamic'
|
||||
);
|
||||
|
||||
$table->data[4][0] = __('Method generation networkmap');
|
||||
|
|
|
@ -111,6 +111,9 @@ if ($new_networkmap || $save_networkmap) {
|
|||
case 'fdp':
|
||||
$values['generation_method'] = 4;
|
||||
break;
|
||||
case 'radial_dinamic':
|
||||
$values['generation_method'] = 6;
|
||||
break;
|
||||
default:
|
||||
$values['generation_method'] = 2;
|
||||
break;
|
||||
|
@ -269,15 +272,17 @@ else if ($update_networkmap || $copy_networkmap || $delete) {
|
|||
}
|
||||
}
|
||||
else if ($migrate_networkmap) {
|
||||
$result = migrate_older_open_maps();
|
||||
|
||||
if (enterprise_installed()) {
|
||||
enterprise_include_once ('include/functions_pandora_networkmap.php');
|
||||
|
||||
$result = migrate_older_networkmap();
|
||||
|
||||
$result_txt = ui_print_result_message($result,
|
||||
__('Succesfully migrated (New map, I AM YOUR FATHER)'), __('Could not be migrated'), '',
|
||||
true);
|
||||
$result = migrate_older_networkmap_enterprise();
|
||||
}
|
||||
|
||||
$result_txt = ui_print_result_message($result,
|
||||
__('Succesfully migrated (New map, I AM YOUR FATHER)'), __('Could not be migrated'), '',
|
||||
true);
|
||||
}
|
||||
|
||||
switch ($tab) {
|
||||
|
|
Loading…
Reference in New Issue