2010-01-18 15:23:30 +01:00
< ? php
/**
* Pandora FMS - http :// pandorafms . com
* ==================================================
2010-03-04 17:08:09 +01:00
* Copyright ( c ) 2005 - 2010 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' ])) {
db_pandora_audit ( 'ACL Violation' , 'Trying to access Visual Setup Management' );
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-03-04 17:08:09 +01:00
// Header
2019-01-30 16:18:44 +01:00
ui_print_page_header ( __ ( 'Map conections GIS' ), '' , false , 'setup_gis_index' , true );
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
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
2010-01-26 11:13:44 +01:00
$table -> align [ 1 ] = 'center' ;
$table -> align [ 2 ] = 'center' ;
$table -> align [ 3 ] = 'center' ;
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 ),
'<a href="index.php?sec=gsetup&sec2=godmode/setup/gis&id_connection_map=' . $mapsConnection [ 'id_tmap_connection' ] . ' & amp ; action = delete_connection "
onClick = " javascript: if (!confirm( \ ''.__('Do you wan delete this connection?').' \ ')) return false; " > '.html_print_image(' images / cross . png ', true).' </ a > ' ,
];
}
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>' ;