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
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
check_login ();
if ( ! give_acl ( $config [ 'id_user' ], 0 , " PM " ) && ! is_user_admin ( $config [ 'id_user' ])) {
2010-03-09 13:34:09 +01:00
audit_db ( $config [ 'id_user' ], $_SERVER [ 'REMOTE_ADDR' ], " ACL Violation " , " Trying to access Visual Setup Management " );
2010-01-18 15:23:30 +01:00
require ( " general/noaccess.php " );
return ;
}
require_once ( 'include/functions_gis.php' );
2010-02-09 18:06:25 +01:00
require_javascript_file ( 'openlayers.pandora' );
2010-03-04 17:08:09 +01:00
// Header
2010-04-06 18:24:54 +02:00
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 ) {
case 'save_edit_map_connection' :
if ( ! $errorfill )
echo '<h3 class="suc">' . __ ( 'Successfully updated' ) . '</h3>' ;
else
echo '<h3 class="error">' . __ ( 'Could not be updated' ) . '</h3>' ;
break ;
case 'save_map_connection' :
if ( ! $errorfill )
echo '<h3 class="suc">' . __ ( 'Successfully created' ) . '</h3>' ;
else
echo '<h3 class="error">' . __ ( 'Could not be created' ) . '</h3>' ;
break ;
case 'delete_connection' :
$idConnectionMap = get_parameter ( 'id_connection_map' );
2010-01-26 11:13:44 +01:00
2010-05-17 10:13:41 +02:00
$result = deleteMapConnection ( $idConnectionMap );
if ( $result === false )
echo '<h3 class="error">' . __ ( 'Could not be deleted' ) . '</h3>' ;
else
echo '<h3 class="suc">' . __ ( 'Successfully deleted' ) . '</h3>' ;
break ;
2010-01-26 11:13:44 +01:00
}
2010-01-18 15:23:30 +01:00
2010-01-26 11:13:44 +01:00
$table -> width = '500px' ;
$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' ;
$mapsConnections = get_db_all_rows_in_table ( 'tgis_map_connection' , 'conection_name' );
$table -> data = array ();
if ( $mapsConnections !== false ) {
foreach ( $mapsConnections as $mapsConnection ) {
$table -> data [] = array ( '<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>' ,
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; " > ' . print_image ("images/cross.png", true).' </ a > ' );
}
}
2010-01-18 15:23:30 +01:00
2010-01-26 11:13:44 +01:00
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">' ;
print_input_hidden ( 'action' , 'create_connection_map' );
print_submit_button ( __ ( 'Create' ), '' , false , 'class="sub next"' );
echo '</form>' ;
echo '</div>' ;
2010-03-03 18:10:37 +01:00
?>