2010-01-18 15:23:30 +01:00
< ? php
/**
2021-11-04 16:28:15 +01:00
* Pandora FMS - http :// pandorafms . com
2010-01-18 15:23:30 +01:00
* ==================================================
2020-11-27 13:52:35 +01:00
* Copyright ( c ) 2005 - 2021 Artica Soluciones Tecnologicas
2019-01-30 16:18:44 +01:00
*
2010-01-18 15:23:30 +01:00
* This program is free software ; you can redistribute it and / or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*/
// Load global vars
2010-03-03 18:10:37 +01:00
global $config ;
2010-01-18 15:23:30 +01:00
2019-01-30 16:18:44 +01:00
check_login ();
2010-01-18 15:23:30 +01:00
2019-01-30 16:18:44 +01:00
if ( ! check_acl ( $config [ 'id_user' ], 0 , 'PM' ) && ! is_user_admin ( $config [ 'id_user' ])) {
2022-02-01 13:39:18 +01:00
db_pandora_audit (
AUDIT_LOG_ACL_VIOLATION ,
'Trying to access Visual Setup Management'
);
2019-01-30 16:18:44 +01:00
include 'general/noaccess.php' ;
return ;
2010-01-18 15:23:30 +01:00
}
2019-01-30 16:18:44 +01:00
require_once 'include/functions_gis.php' ;
2010-01-18 15:23:30 +01:00
2011-04-13 18:11:02 +02:00
ui_require_javascript_file ( 'openlayers.pandora' );
2010-02-09 18:06:25 +01:00
2010-01-26 11:13:44 +01:00
$action = get_parameter ( 'action' );
2010-05-17 10:13:41 +02:00
switch ( $action ) {
2019-01-30 16:18:44 +01:00
case 'save_edit_map_connection' :
if ( ! $errorfill ) {
ui_print_success_message ( __ ( 'Successfully updated' ));
} else {
ui_print_error_message ( __ ( 'Could not be updated' ));
}
break ;
case 'save_map_connection' :
if ( ! $errorfill ) {
ui_print_success_message ( __ ( 'Successfully created' ));
} else {
ui_print_error_message ( __ ( 'Could not be created' ));
}
break ;
case 'delete_connection' :
$idConnectionMap = get_parameter ( 'id_connection_map' );
$result = gis_delete_map_connection ( $idConnectionMap );
if ( $result === false ) {
ui_print_error_message ( __ ( 'Could not be deleted' ));
} else {
ui_print_success_message ( __ ( 'Successfully deleted' ));
}
break ;
2010-01-26 11:13:44 +01:00
}
2010-01-18 15:23:30 +01:00
2022-11-30 15:57:49 +01:00
$table = new stdClass ();
2019-03-29 11:05:52 +01:00
$table -> class = 'info_table' ;
2011-06-28 15:31:52 +02:00
$table -> width = '98%' ;
2010-01-26 11:13:44 +01:00
$table -> head [ 0 ] = __ ( 'Map connection name' );
$table -> head [ 1 ] = __ ( 'Group' );
$table -> head [ 3 ] = __ ( 'Delete' );
2010-01-18 15:23:30 +01:00
2019-04-02 13:42:30 +02:00
$table -> align [ 1 ] = 'left' ;
$table -> align [ 2 ] = 'left' ;
$table -> align [ 3 ] = 'left' ;
2010-01-26 11:13:44 +01:00
2019-01-30 16:18:44 +01:00
$mapsConnections = db_get_all_rows_in_table ( 'tgis_map_connection' , 'conection_name' );
2010-01-26 11:13:44 +01:00
2019-01-30 16:18:44 +01:00
$table -> data = [];
2010-01-26 11:13:44 +01:00
if ( $mapsConnections !== false ) {
2019-01-30 16:18:44 +01:00
foreach ( $mapsConnections as $mapsConnection ) {
$table -> data [] = [
'<a href="index.php?sec=gsetup&sec2=godmode/setup/gis_step_2&action=edit_connection_map&id_connection_map=' . $mapsConnection [ 'id_tmap_connection' ] . '">' . $mapsConnection [ 'conection_name' ] . '</a>' ,
ui_print_group_icon ( $mapsConnection [ 'group_id' ], true ),
2019-10-29 13:26:36 +01:00
'<a href="index.php?sec=gsetup&sec2=godmode/setup/setup&section=gis&id_connection_map=' . $mapsConnection [ 'id_tmap_connection' ] . ' & amp ; action = delete_connection "
2021-03-11 15:40:23 +01:00
onClick = " javascript: if (!confirm( \ ''.__('Do you wan delete this connection?').' \ ')) return false; " > '.html_print_image(' images / cross . png ', true, [' class ' => ' invert_filter ']).' </ a > ' ,
2019-01-30 16:18:44 +01:00
];
2022-11-30 10:14:42 +01:00
$table -> cellclass [][ 2 ] = 'table_action_buttons' ;
2019-01-30 16:18:44 +01:00
}
2010-01-26 11:13:44 +01:00
}
2010-01-18 15:23:30 +01:00
2011-04-27 15:43:31 +02:00
html_print_table ( $table );
2010-01-18 15:23:30 +01:00
2010-01-26 11:13:44 +01:00
echo '<div class="action-buttons" style="width: ' . $table -> width . '">' ;
echo '<form action="index.php?sec=gsetup&sec2=godmode/setup/gis_step_2" method="post">' ;
2019-01-30 16:18:44 +01:00
html_print_input_hidden ( 'action' , 'create_connection_map' );
html_print_submit_button ( __ ( 'Create' ), '' , false , 'class="sub next"' );
2010-01-26 11:13:44 +01:00
echo '</form>' ;
echo '</div>' ;