mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 16:24:54 +02:00
New maps in progress...
This commit is contained in:
parent
d834146122
commit
a14521312b
@ -49,10 +49,38 @@ function maps_get_subtype_string($subtype) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function maps_get_count_nodes($id) {
|
function maps_duplicate_map($id) {
|
||||||
$result = db_get_sql(
|
global $config;
|
||||||
"SELECT COUNT(*) FROM titem WHERE id_map = " . $id);
|
$map = db_get_sql("SELECT * FROM tmap WHERE id_map = " . $id);
|
||||||
|
$result = 0;
|
||||||
|
if (!empty($map)) {
|
||||||
|
$map_names = db_get_all_rows_sql("SELECT name FROM tmap WHERE name LIKE '" . $map['name'] . "%'");
|
||||||
|
$index = 0;
|
||||||
|
foreach ($map_names as $map_name) {
|
||||||
|
$index++;
|
||||||
|
}
|
||||||
|
$map['name'] = $map['name'] . '_' . $index;
|
||||||
|
$result = db_process_sql_insert('tmap', array('id_group' => $map['id_group'],
|
||||||
|
'id_user' => $config['id_user'], 'type' => $map['type'], 'subtype' => $map['subtype'],
|
||||||
|
'name' => $map['name'], 'description' => $map['description'], 'width' => $map['width'],
|
||||||
|
'height' => $map['height'], 'center_x' => $map['center_x'], 'center_y' => $map['center_y'],
|
||||||
|
'background' => $map['background'], 'background_options' => $map['background_options'],
|
||||||
|
'source_period' => $map['source_period'], 'source' => $map['source'],
|
||||||
|
'source_data' => $map['source_data'], 'generation_method' => $map['generation_method'],
|
||||||
|
'filter' => $map['filter']));
|
||||||
|
}
|
||||||
return (int)$result;
|
return (int)$result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function maps_get_count_nodes($id) {
|
||||||
|
$result = db_get_sql("SELECT COUNT(*) FROM titem WHERE id_map = " . $id);
|
||||||
|
return (int)$result;
|
||||||
|
}
|
||||||
|
|
||||||
|
function maps_update_map ($id, $values) {
|
||||||
|
$where = 'id=' . $id;
|
||||||
|
$result = db_process_sql_update('tmap', $values, $where);
|
||||||
|
return (int)$result;
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -25,22 +25,24 @@ $networkmaps_write = check_acl ($config['id_user'], 0, "MW");
|
|||||||
$networkmaps_manage = check_acl ($config['id_user'], 0, "MM");
|
$networkmaps_manage = check_acl ($config['id_user'], 0, "MM");
|
||||||
|
|
||||||
$id = (int)get_parameter('id_networkmap', 0);
|
$id = (int)get_parameter('id_networkmap', 0);
|
||||||
|
$edit_networkmap = (int)get_parameter('edit_networkmap', 0);
|
||||||
|
$add_networkmap = (int)get_parameter('add_networkmap', 0);
|
||||||
|
|
||||||
|
if ($edit_networkmap) {
|
||||||
$name = (string) get_parameter ('name');
|
$name = (string) get_parameter ('name');
|
||||||
$description = (string) get_parameter ('description');
|
$description = (string) get_parameter ('description');
|
||||||
$id_group = (int) get_parameter ('id_group');
|
$id_group = (int) get_parameter ('id_group');
|
||||||
$type = (string) get_parameter ('type');
|
$type = (string) get_parameter ('type');
|
||||||
|
|
||||||
if ($name == "")
|
if ($name == "") {
|
||||||
$result = false;
|
$result = 0;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
//FUNCION
|
$result = maps_update_map ($id,
|
||||||
/*$result = networkmap_update_networkmap ($id,
|
|
||||||
array ('name' => $name,
|
array ('name' => $name,
|
||||||
'id_group' => $id_group,
|
'id_group' => $id_group,
|
||||||
'description' => $description),
|
'description' => $description),
|
||||||
'type' => $type);*/
|
'type' => $type);
|
||||||
$result = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$info = ' Name: ' . $name . ' Description: ' . $description . ' ID group: ' . $id_group . ' Type: ' . $type;
|
$info = ' Name: ' . $name . ' Description: ' . $description . ' ID group: ' . $id_group . ' Type: ' . $type;
|
||||||
@ -55,5 +57,9 @@ else {
|
|||||||
ui_print_result_message ($result,
|
ui_print_result_message ($result,
|
||||||
__('Successfully updated'),
|
__('Successfully updated'),
|
||||||
__('Could not be updated'));
|
__('Could not be updated'));
|
||||||
|
}
|
||||||
|
else if ($add_networkmap) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -80,9 +80,7 @@ if ($delete_networkmap) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($duplicate_networkmap) {
|
if ($duplicate_networkmap) {
|
||||||
//FUNCION
|
$result_duplicate = maps_duplicate_map($id);
|
||||||
//$result_duplicate = networkmap_duplicate($id);
|
|
||||||
$result_duplicate = array();
|
|
||||||
|
|
||||||
ui_print_result_message ($result,
|
ui_print_result_message ($result,
|
||||||
__('Successfully duplicate'),
|
__('Successfully duplicate'),
|
||||||
@ -135,7 +133,6 @@ $table->head['copy'] = __('Copy');
|
|||||||
$table->head['edit'] = __('Edit');
|
$table->head['edit'] = __('Edit');
|
||||||
$table->head['delete'] = __('Delete');
|
$table->head['delete'] = __('Delete');
|
||||||
|
|
||||||
//FUNCION
|
|
||||||
$networkmaps = maps_get_maps(array('type' => MAP_TYPE_NETWORKMAP));
|
$networkmaps = maps_get_maps(array('type' => MAP_TYPE_NETWORKMAP));
|
||||||
|
|
||||||
if (empty($networkmaps)) {
|
if (empty($networkmaps)) {
|
||||||
@ -184,7 +181,7 @@ else {
|
|||||||
$data['edit'] = '<a href="index.php?' .
|
$data['edit'] = '<a href="index.php?' .
|
||||||
'sec=maps&;' .
|
'sec=maps&;' .
|
||||||
'sec2=operation/maps/networkmap_editor&' .
|
'sec2=operation/maps/networkmap_editor&' .
|
||||||
'id_networkmap=' . $networkmap['id'] .'">' .
|
'edit_networkmap=1&id_networkmap=' . $networkmap['id'] .'">' .
|
||||||
html_print_image("images/edit.png", true) . '</a>';
|
html_print_image("images/edit.png", true) . '</a>';
|
||||||
|
|
||||||
$data['delete'] = '<a href="index.php?' .
|
$data['delete'] = '<a href="index.php?' .
|
||||||
|
Loading…
x
Reference in New Issue
Block a user