exec.php
1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
include_once(dirname(__FILE__)."/../inicia.php");
//
//faz a busca da função que deve ser executada
//
$retorno = ""; //string que será retornada ao browser via JSON
switch (strtoupper($funcao))
{
/*
Valor: APLICAR
Aplica a substituicao de chaves pelos valores enviados
*/
case "APLICAR":
$map = ms_newMapObj($map_file);
$layer = $map->getlayerbyname($tema);
$data = $layer->data;
$chaves = explode(",",$chaves);
$valores = explode(",",$valores);
$n = count($chaves);
for($i = 0; $i < $n; $i++){
$data = str_replace($chaves[$i],$valores[$i],$data);
}
$layer->set("data",$data);
$layer->set("status",MS_DEFAULT);
$layer->setmetadata("PLUGINI3GEO","");
if (connection_aborted()){exit();}
$salvo = $map->save($map_file);
$retorno = "ok";
break;
case "REMOVER":
$map = ms_newMapObj($map_file);
$layer = $map->getlayerbyname($tema);
$layer->set("status",MS_DELETE);
$salvo = $map->save($map_file);
$retorno = "ok";
break;
}
if (!connection_aborted()){
cpjson($retorno);
}
else
{exit();}
?>