2010-01-27 Miguel de Dios <miguel.dedios@artica.es>

* include/functions_gis.php: add function "deleteMap" for to delete the map
	and other rows in tables related.
	
	* godmode/gis_maps/index.php: use the "deleteMap" in link of delete map.
	
	* include/functions_db.php: add function "clean_cache" for clean the
	problematic (sometimes) cache.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2317 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2010-01-28 17:58:30 +00:00
parent 676532f53c
commit be35a2a1ee
4 changed files with 58 additions and 0 deletions

View File

@ -1,3 +1,13 @@
2010-01-27 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_gis.php: add function "deleteMap" for to delete the map
and other rows in tables related.
* godmode/gis_maps/index.php: use the "deleteMap" in link of delete map.
* include/functions_db.php: add function "clean_cache" for clean the
problematic (sometimes) cache.
2010-01-27 Miguel de Dios <miguel.dedios@artica.es>
* operation/gis_maps/ajax.php: clean source code, erased comment lines.

View File

@ -25,6 +25,15 @@ if (! give_acl ($config['id_user'], 0, "IW")) {
return;
}
$action = get_parameter('action');
switch ($action) {
case 'delete_map':
$idMap = get_parameter('id_map');
deleteMap($idMap);
break;
}
echo "<h2>" . __('GIS Maps') . " &raquo; " . __('Builder') . "</h2>";
$table->width = '500px';

View File

@ -19,6 +19,12 @@
* @subpackage DataBase
*/
/**
* When you delete (with the function "process_sql_delete" or other) any row in
* any table, some times the cache save the data just deleted, because you
* must use "clean_cache".
*/
/**
* Check if login session variables are set.
*
@ -1985,6 +1991,18 @@ function add_database_debug_trace ($sql, $result = false, $affected = false, $ex
$config['db_debug'][$sql] = $var;
}
/**
* Clean the cache for to have errors and ghost rows when you do "select <table>",
* "delete <table>" and "select <table>".
*
* @return None
*/
function clean_cache() {
global $sql_cache;
$sql_cache = array ('saved' => 0);
}
/**
* This function comes back with an array in case of SELECT
* in case of UPDATE, DELETE etc. with affected rows

View File

@ -455,6 +455,27 @@ function saveMapConnection($mapConnection_name, $mapConnection_group,
return $returnQuery;
}
/**
* Delete the map in the all tables are related.
*
* @param $idMap integer The id of map.
* @return None
*/
function deleteMap($idMap) {
$listIdLayers = get_db_all_rows_sql("SELECT id_tmap_layer FROM tgis_map_layer WHERE tgis_map_id_tgis_map = " . $idMap);
if ($listIdLayers !== false) {
foreach ($listIdLayers as $idLayer) {
process_sql_delete('tgis_map_layer_has_tagente', array('tgis_map_layer_id_tmap_layer' => $idLayer));
}
}
process_sql_delete('tgis_map_layer', array('tgis_map_id_tgis_map' => $idMap));
process_sql_delete('tgis_map_has_tgis_map_connection', array('tgis_map_id_tgis_map' => $idMap));
process_sql_delete('tgis_map', array('id_tgis_map' => $idMap));
clean_cache();
}
/**
* Save the map into DB, tgis_map and with id_map save the connetions in
* tgis_map_has_tgis_map_connection, and with id_map save the layers in