Commit eb44fdea4832325c3f4b2c926f3fbdb8d37654d4
1 parent
a1d28686
Exists in
master
and in
7 other branches
Inclusão de opção para abrir no i3geo uma variável estatística cadastrada
Showing
6 changed files
with
152 additions
and
62 deletions
Show diff stats
admin/js/estat_variavel.js
| @@ -429,9 +429,13 @@ function sql(tipo,id) { | @@ -429,9 +429,13 @@ function sql(tipo,id) { | ||
| 429 | ins += "<input type=text value='' id='filtrosql' />"; | 429 | ins += "<input type=text value='' id='filtrosql' />"; |
| 430 | ins +="<p>Agrupar pela coluna<br>"; | 430 | ins +="<p>Agrupar pela coluna<br>"; |
| 431 | ins += "<input type=text value='' id='agruparsql' />"; | 431 | ins += "<input type=text value='' id='agruparsql' />"; |
| 432 | + ins +="<p>Tipo de layer (para o caso de mapas ou mapfiles, podendo ser point,line ou polygon)<br>"; | ||
| 433 | + ins += "<input type=text value='' id='tipolayer' />"; | ||
| 432 | ins += '<p><input type=button id="sqljson" value="JSON" />'; | 434 | ins += '<p><input type=button id="sqljson" value="JSON" />'; |
| 433 | ins += ' <input type=button id="sumarioestat" value="Sumário" />'; | 435 | ins += ' <input type=button id="sumarioestat" value="Sumário" />'; |
| 434 | ins += ' <input type=button id="graficoestat" value="Gráfico" />'; | 436 | ins += ' <input type=button id="graficoestat" value="Gráfico" />'; |
| 437 | + ins += ' <input type=button id="mapfileestat" value="Mapfile" />'; | ||
| 438 | + ins += ' <input type=button id="i3geoestat" value="i3Geo" />'; | ||
| 435 | 439 | ||
| 436 | $i("editor_bd").innerHTML = ins; | 440 | $i("editor_bd").innerHTML = ins; |
| 437 | new YAHOO.widget.Button("sqljson"); | 441 | new YAHOO.widget.Button("sqljson"); |
| @@ -440,15 +444,42 @@ function sql(tipo,id) { | @@ -440,15 +444,42 @@ function sql(tipo,id) { | ||
| 440 | if($i("incluirtodascolunas").checked === true){ | 444 | if($i("incluirtodascolunas").checked === true){ |
| 441 | colunas = 1; | 445 | colunas = 1; |
| 442 | } | 446 | } |
| 443 | - window.open('../php/metaestat.php?funcao=dadosMedidaVariavel&formato=json&id_medida_variavel='+id+"&agruparpor="+$i("agruparsql").value+"&filtro="+$i("filtrosql").value+"&todasascolunas="+colunas); | 447 | + window.open('../php/metaestat.php?funcao=dadosMedidaVariavel&formato=json&id_medida_variavel='+id+"&filtro="+$i("filtrosql").value+"&todasascolunas="+colunas); |
| 444 | }; | 448 | }; |
| 445 | new YAHOO.widget.Button("sumarioestat"); | 449 | new YAHOO.widget.Button("sumarioestat"); |
| 446 | $i("sumarioestat-button").onclick = function(){ | 450 | $i("sumarioestat-button").onclick = function(){ |
| 447 | window.open('../php/metaestat.php?funcao=sumarioMedidaVariavel&formato=json&id_medida_variavel='+id+"&agruparpor="+$i("agruparsql").value+"&filtro="+$i("filtrosql").value); | 451 | window.open('../php/metaestat.php?funcao=sumarioMedidaVariavel&formato=json&id_medida_variavel='+id+"&agruparpor="+$i("agruparsql").value+"&filtro="+$i("filtrosql").value); |
| 448 | }; | 452 | }; |
| 453 | + new YAHOO.widget.Button("mapfileestat"); | ||
| 454 | + $i("mapfileestat-button").onclick = function(){ | ||
| 455 | + var colunas = 0; | ||
| 456 | + if($i("incluirtodascolunas").checked === true){ | ||
| 457 | + colunas = 1; | ||
| 458 | + } | ||
| 459 | + window.open('../php/metaestat.php?funcao=mapfileMedidaVariavel&formato=json&id_medida_variavel='+id+"&filtro="+$i("filtrosql").value+"&todasascolunas="+colunas+"&tipolayer="+$i("tipolayer").value); | ||
| 460 | + }; | ||
| 461 | + new YAHOO.widget.Button("i3geoestat"); | ||
| 462 | + $i("i3geoestat-button").onclick = function(){ | ||
| 463 | + var callback = { | ||
| 464 | + success: function(oResponse){ | ||
| 465 | + var dados = YAHOO.lang.JSON.parse(oResponse.responseText); | ||
| 466 | + window.open("../../ms_criamapa.php?temasa="+dados.mapfile+"&layers="+dados.layer); | ||
| 467 | + core_carregando("desativa"); | ||
| 468 | + }, | ||
| 469 | + failure:core_handleFailure, | ||
| 470 | + argument: { foo:"foo", bar:"bar" } | ||
| 471 | + }, | ||
| 472 | + colunas = 0; | ||
| 473 | + if($i("incluirtodascolunas").checked === true){ | ||
| 474 | + colunas = 1; | ||
| 475 | + } | ||
| 476 | + sUrl = '../php/metaestat.php?funcao=mapfileMedidaVariavel&formato=json&id_medida_variavel='+id+"&filtro="+$i("filtrosql").value+"&todasascolunas="+colunas+"&tipolayer="+$i("tipolayer").value; | ||
| 477 | + core_carregando("ativa"); | ||
| 478 | + core_makeRequest(sUrl,callback); | ||
| 479 | + }; | ||
| 449 | new YAHOO.widget.Button("graficoestat"); | 480 | new YAHOO.widget.Button("graficoestat"); |
| 450 | $i("graficoestat-button").onclick = function(){ | 481 | $i("graficoestat-button").onclick = function(){ |
| 451 | - callback = { | 482 | + var callback = { |
| 452 | success: function(oResponse){ | 483 | success: function(oResponse){ |
| 453 | var dados = YAHOO.lang.JSON.parse(oResponse.responseText); | 484 | var dados = YAHOO.lang.JSON.parse(oResponse.responseText); |
| 454 | dados = dados.grupos; | 485 | dados = dados.grupos; |
| @@ -516,8 +547,8 @@ function sql(tipo,id) { | @@ -516,8 +547,8 @@ function sql(tipo,id) { | ||
| 516 | }, | 547 | }, |
| 517 | failure:core_handleFailure, | 548 | failure:core_handleFailure, |
| 518 | argument: { foo:"foo", bar:"bar" } | 549 | argument: { foo:"foo", bar:"bar" } |
| 519 | - }; | ||
| 520 | - sUrl = '../php/metaestat.php?funcao=sumarioMedidaVariavel&formato=json&id_medida_variavel='+id+"&agruparpor="+$i("agruparsql").value+"&filtro="+document.getElementById("filtrosql").value; | 550 | + }, |
| 551 | + sUrl = '../php/metaestat.php?funcao=sumarioMedidaVariavel&formato=json&id_medida_variavel='+id+"&agruparpor="+$i("agruparsql").value+"&filtro="+document.getElementById("filtrosql").value; | ||
| 521 | core_carregando("ativa"); | 552 | core_carregando("ativa"); |
| 522 | core_makeRequest(sUrl,callback); | 553 | core_makeRequest(sUrl,callback); |
| 523 | }; | 554 | }; |
admin/php/classe_metaestat.php
| @@ -40,6 +40,7 @@ class Metaestat{ | @@ -40,6 +40,7 @@ class Metaestat{ | ||
| 40 | public $dbh; | 40 | public $dbh; |
| 41 | protected $dbhw; | 41 | protected $dbhw; |
| 42 | protected $convUTF; | 42 | protected $convUTF; |
| 43 | + public $dir_tmp; | ||
| 43 | /* | 44 | /* |
| 44 | Function: __construct | 45 | Function: __construct |
| 45 | 46 | ||
| @@ -48,6 +49,9 @@ class Metaestat{ | @@ -48,6 +49,9 @@ class Metaestat{ | ||
| 48 | function __construct(){ | 49 | function __construct(){ |
| 49 | error_reporting(0); | 50 | error_reporting(0); |
| 50 | include(__DIR__."/conexao.php"); | 51 | include(__DIR__."/conexao.php"); |
| 52 | + //vem do include | ||
| 53 | + $this->dir_tmp = $dir_tmp; | ||
| 54 | + $this->locaplic = $locaplic; | ||
| 51 | if(!isset($convUTF)){ | 55 | if(!isset($convUTF)){ |
| 52 | $convUTF = true; | 56 | $convUTF = true; |
| 53 | } | 57 | } |
| @@ -62,6 +66,16 @@ class Metaestat{ | @@ -62,6 +66,16 @@ class Metaestat{ | ||
| 62 | function __destruct(){ | 66 | function __destruct(){ |
| 63 | $this->fechaConexao; | 67 | $this->fechaConexao; |
| 64 | } | 68 | } |
| 69 | + function nomeRandomico($n=10){ | ||
| 70 | + $nomes = ""; | ||
| 71 | + $a = 'azertyuiopqsdfghjklmwxcvbnABCDEFGHIJKLMNOPQRSTUVWXYZ'; | ||
| 72 | + $max = 51; | ||
| 73 | + for($i=0; $i < $n; ++$i) | ||
| 74 | + { | ||
| 75 | + $nomes .= $a{mt_rand(0, $max)}; | ||
| 76 | + } | ||
| 77 | + return $nomes; | ||
| 78 | + } | ||
| 65 | function fechaConexao(){ | 79 | function fechaConexao(){ |
| 66 | $this->dbh = null; | 80 | $this->dbh = null; |
| 67 | $this->dbhw = null; | 81 | $this->dbhw = null; |
| @@ -195,7 +209,7 @@ class Metaestat{ | @@ -195,7 +209,7 @@ class Metaestat{ | ||
| 195 | } | 209 | } |
| 196 | else{ | 210 | else{ |
| 197 | $sql = " SELECT d.* "; | 211 | $sql = " SELECT d.* "; |
| 198 | - $sqlgeo = " SELECT ".$dados["tabela"].".*,g.".$dados["colunaidgeo"]; | 212 | + $sqlgeo = $sql.",g.".$dadosgeo["colunageo"]; |
| 199 | } | 213 | } |
| 200 | $sql .= " FROM ".$dados["esquemadb"].".".$dados["tabela"]." as d "; | 214 | $sql .= " FROM ".$dados["esquemadb"].".".$dados["tabela"]." as d "; |
| 201 | $sqlgeo .= " FROM ".$dados["esquemadb"].".".$dados["tabela"]." as d,".$dadosgeo["esquemadb"].".".$dadosgeo["tabela"]." as g "; | 215 | $sqlgeo .= " FROM ".$dados["esquemadb"].".".$dados["tabela"]." as d,".$dadosgeo["esquemadb"].".".$dadosgeo["tabela"]." as g "; |
| @@ -212,9 +226,57 @@ class Metaestat{ | @@ -212,9 +226,57 @@ class Metaestat{ | ||
| 212 | else{ | 226 | else{ |
| 213 | $sqlgeo .= " WHERE ".$j; | 227 | $sqlgeo .= " WHERE ".$j; |
| 214 | } | 228 | } |
| 215 | - $sqlgeo = $dadosgeo["colunageo"]." from ($sqlgeo) as foo using unique ".$dados["colunaidgeo"]." using srid= ".$dadosgeo["srid"]; | 229 | + //atencao: cuidado ao alterar essa string pois ') as foo' pode ser usado para replace em outras funcoes |
| 230 | + $sqlgeo = $dadosgeo["colunageo"]." from ($sqlgeo) as foo using unique ".$dados["colunaidgeo"]." using srid=".$dadosgeo["srid"]; | ||
| 216 | return array("sql"=>$sql,"sqlmapserver"=>$sqlgeo,"filtro"=>$filtro); | 231 | return array("sql"=>$sql,"sqlmapserver"=>$sqlgeo,"filtro"=>$filtro); |
| 217 | } | 232 | } |
| 233 | + function mapfileMedidaVariavel($id_medida_variavel,$filtro="",$todasascolunas = 0,$tipolayer="polygon",$titulolayer=""){ | ||
| 234 | + if(empty($tipolayer)){ | ||
| 235 | + $tipolayer = "polygon"; | ||
| 236 | + } | ||
| 237 | + $meta = $this->listaMedidaVariavel("",$id_medida_variavel); | ||
| 238 | + if($titulolayer == ""){ | ||
| 239 | + $titulolayer = $meta["nomemedida"]; | ||
| 240 | + } | ||
| 241 | + $conexao = $this->listaConexao($meta["codigo_estat_conexao"],true); | ||
| 242 | + $conexao = "user=".$conexao["usuario"]." password=".$conexao["senha"]." dbname=".$conexao["bancodedados"]." host=".$conexao["host"]." port=".$conexao["porta"].""; | ||
| 243 | + //echo $conexao;exit; | ||
| 244 | + $sql = $this->sqlMedidaVariavel($id_medida_variavel,$todasascolunas); | ||
| 245 | + $sqlf = $sql["sqlmapserver"]; | ||
| 246 | + if(!empty($filtro)){ | ||
| 247 | + $sqlf = str_replace(") as foo"," AND ".$filtro." ) foo",$sqlf); | ||
| 248 | + } | ||
| 249 | + //echo $sqlf;exit; | ||
| 250 | + $rand = $this->nomeRandomico(); | ||
| 251 | + $arq = $this->dir_tmp."/".$rand.".map"; | ||
| 252 | + $dados[] = "MAP"; | ||
| 253 | + $dados[] = "SYMBOLSET ".$this->locaplic."/symbols/simbolosv6.sym"; | ||
| 254 | + $dados[] = 'FONTSET "'.$this->locaplic.'/symbols/fontes.txt"'; | ||
| 255 | + $dados[] = "LAYER"; | ||
| 256 | + $dados[] = ' NAME "'.$rand.'"'; | ||
| 257 | + $dados[] = " TYPE $tipolayer"; | ||
| 258 | + $dados[] = ' DATA "'.$sqlf.'"'; | ||
| 259 | + $dados[] = ' CONNECTION "'.$conexao.'"'; | ||
| 260 | + $dados[] = ' CONNECTIONTYPE POSTGIS'; | ||
| 261 | + $dados[] = ' STATUS OFF'; | ||
| 262 | + $dados[] = ' METADATA'; | ||
| 263 | + $dados[] = ' TEMA "'.$titulolayer.'"'; | ||
| 264 | + $dados[] = ' CLASSE "SIM"'; | ||
| 265 | + $dados[] = ' END'; | ||
| 266 | + $dados[] = ' CLASS'; | ||
| 267 | + $dados[] = ' NAME ""'; | ||
| 268 | + $dados[] = ' STYLE'; | ||
| 269 | + $dados[] = ' COLOR 200 0 0'; | ||
| 270 | + $dados[] = ' END'; | ||
| 271 | + $dados[] = ' END'; | ||
| 272 | + $dados[] = "END"; | ||
| 273 | + $dados[] = "END"; | ||
| 274 | + $fp = fopen($arq,"w"); | ||
| 275 | + foreach ($dados as $dado){ | ||
| 276 | + fwrite($fp,$dado."\n"); | ||
| 277 | + } | ||
| 278 | + return array("mapfile"=>$arq,"layer"=>$rand,"titulolayer"=>$titulolayer); | ||
| 279 | + } | ||
| 218 | function dadosMedidaVariavel($id_medida_variavel,$filtro="",$todasascolunas = 0){ | 280 | function dadosMedidaVariavel($id_medida_variavel,$filtro="",$todasascolunas = 0){ |
| 219 | $sql = $this->sqlMedidaVariavel($id_medida_variavel,$todasascolunas); | 281 | $sql = $this->sqlMedidaVariavel($id_medida_variavel,$todasascolunas); |
| 220 | $sqlf = $sql["sql"]; | 282 | $sqlf = $sql["sql"]; |
admin/php/conexao.php
| @@ -41,42 +41,16 @@ Free Software Foundation, Inc., no endere&ccedil;o | @@ -41,42 +41,16 @@ Free Software Foundation, Inc., no endere&ccedil;o | ||
| 41 | Arquivo: i3geo/admin/php/conexao.php | 41 | Arquivo: i3geo/admin/php/conexao.php |
| 42 | 42 | ||
| 43 | */ | 43 | */ |
| 44 | -if(isset($locaplic) && $locaplic != "") | ||
| 45 | -{ | 44 | +if(isset($locaplic) && $locaplic != ""){ |
| 46 | include($locaplic."/ms_configura.php"); | 45 | include($locaplic."/ms_configura.php"); |
| 47 | } | 46 | } |
| 48 | -else | ||
| 49 | -{ | ||
| 50 | - if (file_exists("../../../ms_configura.php")) | ||
| 51 | - { | ||
| 52 | - include("../../../ms_configura.php"); | ||
| 53 | - } | ||
| 54 | - else | ||
| 55 | - { | ||
| 56 | - if (file_exists("../../ms_configura.php")) | ||
| 57 | - { | ||
| 58 | - include("../../ms_configura.php"); | ||
| 59 | - } | ||
| 60 | - else | ||
| 61 | - { | ||
| 62 | - if (file_exists("../ms_configura.php")) | ||
| 63 | - { | ||
| 64 | - include("../ms_configura.php"); | ||
| 65 | - } | ||
| 66 | - else | ||
| 67 | - if (file_exists("ms_configura.php")) | ||
| 68 | - { | ||
| 69 | - include("ms_configura.php"); | ||
| 70 | - } | ||
| 71 | - } | ||
| 72 | - } | 47 | +else{ |
| 48 | + include(__DIR__."/../../ms_configura.php"); | ||
| 73 | } | 49 | } |
| 74 | -if(!isset($conexaoadmin)) | ||
| 75 | -{ | 50 | +if(!isset($conexaoadmin)){ |
| 76 | $conexaoadmin = ""; | 51 | $conexaoadmin = ""; |
| 77 | } | 52 | } |
| 78 | -if(!isset($esquemaadmin)) | ||
| 79 | -{ | 53 | +if(!isset($esquemaadmin)){ |
| 80 | $esquemaadmin = ""; | 54 | $esquemaadmin = ""; |
| 81 | } | 55 | } |
| 82 | // | 56 | // |
| @@ -84,11 +58,9 @@ if(!isset($esquemaadmin)) | @@ -84,11 +58,9 @@ if(!isset($esquemaadmin)) | ||
| 84 | // | 58 | // |
| 85 | $convUTF = true; | 59 | $convUTF = true; |
| 86 | 60 | ||
| 87 | -if($conexaoadmin == "") | ||
| 88 | -{ | 61 | +if($conexaoadmin == ""){ |
| 89 | $arquivosqlite = $locaplic."/admin/admin.db"; | 62 | $arquivosqlite = $locaplic."/admin/admin.db"; |
| 90 | - if(!file_exists($arquivosqlite)) | ||
| 91 | - { | 63 | + if(!file_exists($arquivosqlite)){ |
| 92 | echo "O arquivo admin.db não existe. Utilize i3geo/admin/criabanco.php para criar o banco de dados SQLITE."; | 64 | echo "O arquivo admin.db não existe. Utilize i3geo/admin/criabanco.php para criar o banco de dados SQLITE."; |
| 93 | exit; | 65 | exit; |
| 94 | } | 66 | } |
| @@ -97,15 +69,13 @@ if($conexaoadmin == "") | @@ -97,15 +69,13 @@ if($conexaoadmin == "") | ||
| 97 | if(!extension_loaded("PDO")){ | 69 | if(!extension_loaded("PDO")){ |
| 98 | echo "A extensao do PHP 'PDO' nao esta instalada."; | 70 | echo "A extensao do PHP 'PDO' nao esta instalada."; |
| 99 | } | 71 | } |
| 100 | - try | ||
| 101 | - { | 72 | + try { |
| 102 | //para escrita | 73 | //para escrita |
| 103 | $dbhw = new PDO($conAdminw); | 74 | $dbhw = new PDO($conAdminw); |
| 104 | //para leitura | 75 | //para leitura |
| 105 | $dbh = new PDO($conAdmin); | 76 | $dbh = new PDO($conAdmin); |
| 106 | } | 77 | } |
| 107 | - catch (PDOException $e) | ||
| 108 | - { | 78 | + catch (PDOException $e) { |
| 109 | print "Erro ao criar o objeto PDO!: " . $e->getMessage() . "<br/> Talvez exista alguma incompatibilidade entre o PHP e o banco admin.db. Vc pode apagar o arquivo menutemas/admin.db e recria-lo com admin/php/criasqlite.php"; | 79 | print "Erro ao criar o objeto PDO!: " . $e->getMessage() . "<br/> Talvez exista alguma incompatibilidade entre o PHP e o banco admin.db. Vc pode apagar o arquivo menutemas/admin.db e recria-lo com admin/php/criasqlite.php"; |
| 110 | die(); | 80 | die(); |
| 111 | } | 81 | } |
admin/php/editormapfile.php
| @@ -1144,7 +1144,7 @@ function criarNovoMap() | @@ -1144,7 +1144,7 @@ function criarNovoMap() | ||
| 1144 | if(!file_exists($arq)) | 1144 | if(!file_exists($arq)) |
| 1145 | { | 1145 | { |
| 1146 | $dados[] = "MAP"; | 1146 | $dados[] = "MAP"; |
| 1147 | - $dados[] = "SYMBOLSET ../symbols/simbolos.sym"; | 1147 | + $dados[] = "SYMBOLSET ../symbols/simbolosv6.sym"; |
| 1148 | $dados[] = 'FONTSET "../symbols/fontes.txt"'; | 1148 | $dados[] = 'FONTSET "../symbols/fontes.txt"'; |
| 1149 | $dados[] = "LAYER"; | 1149 | $dados[] = "LAYER"; |
| 1150 | $dados[] = " NAME $codigo"; | 1150 | $dados[] = " NAME $codigo"; |
admin/php/metaestat.php
| @@ -511,7 +511,33 @@ switch (strtoupper($funcao)) | @@ -511,7 +511,33 @@ switch (strtoupper($funcao)) | ||
| 511 | case "DADOSMEDIDAVARIAVEL": | 511 | case "DADOSMEDIDAVARIAVEL": |
| 512 | $m = new Metaestat(); | 512 | $m = new Metaestat(); |
| 513 | if($formato == "json"){ | 513 | if($formato == "json"){ |
| 514 | - retornaJSON($m->dadosMedidaVariavel($id_medida_variavel,$filtro,$todasascolunas,$agruparpor)); | 514 | + retornaJSON($m->dadosMedidaVariavel($id_medida_variavel,$filtro,$todasascolunas)); |
| 515 | + } | ||
| 516 | + exit; | ||
| 517 | + break; | ||
| 518 | + /* | ||
| 519 | + Valor: MAPFILEMEDIDAVARIAVEL | ||
| 520 | + | ||
| 521 | + Cria o mapfile de uma media de uma variavel | ||
| 522 | + | ||
| 523 | + Parametros: | ||
| 524 | + | ||
| 525 | + formato | ||
| 526 | + | ||
| 527 | + filtro | ||
| 528 | + | ||
| 529 | + agruparpor | ||
| 530 | + | ||
| 531 | + todasascolunas - 0 ou 1 | ||
| 532 | + | ||
| 533 | + Retorno: | ||
| 534 | + | ||
| 535 | + {JSON} | ||
| 536 | + */ | ||
| 537 | + case "MAPFILEMEDIDAVARIAVEL": | ||
| 538 | + $m = new Metaestat(); | ||
| 539 | + if($formato == "json"){ | ||
| 540 | + retornaJSON($m->mapfileMedidaVariavel($id_medida_variavel,$filtro,$todasascolunas,$tipolayer,$titulolayer)); | ||
| 515 | } | 541 | } |
| 516 | exit; | 542 | exit; |
| 517 | break; | 543 | break; |
testamapfile.php
| @@ -102,7 +102,7 @@ if (isset($map) && $map != "") | @@ -102,7 +102,7 @@ if (isset($map) && $map != "") | ||
| 102 | if(!isset($solegenda)){$solegenda = "nao";} | 102 | if(!isset($solegenda)){$solegenda = "nao";} |
| 103 | if ($map == "todos") | 103 | if ($map == "todos") |
| 104 | { | 104 | { |
| 105 | - $tipo = "todos"; | 105 | + $tipo = "todos"; |
| 106 | $conta = 0; | 106 | $conta = 0; |
| 107 | echo "<br>Número de mapas = ".(count($arqs["arquivos"]))." Faltam= ".(count($arqs["arquivos"])-$iniciar-10)."<br>"; | 107 | echo "<br>Número de mapas = ".(count($arqs["arquivos"]))." Faltam= ".(count($arqs["arquivos"])-$iniciar-10)."<br>"; |
| 108 | if (!isset($iniciar)){$iniciar = 0;} | 108 | if (!isset($iniciar)){$iniciar = 0;} |
| @@ -121,7 +121,7 @@ if (isset($map) && $map != "") | @@ -121,7 +121,7 @@ if (isset($map) && $map != "") | ||
| 121 | echo "<hr><br><br><a href='testamapfile.php?map=todos&iniciar=".($iniciar+10)."' >Próximos mapas</a>"; | 121 | echo "<hr><br><br><a href='testamapfile.php?map=todos&iniciar=".($iniciar+10)."' >Próximos mapas</a>"; |
| 122 | } | 122 | } |
| 123 | else | 123 | else |
| 124 | - {verifica($map,$solegenda);} | 124 | + {verifica($map,$solegenda);} |
| 125 | } | 125 | } |
| 126 | echo '</div>'; | 126 | echo '</div>'; |
| 127 | echo '<script>if(screen.availWidth > 700){document.getElementById("divGeral").style.width = "700px";}</script>'; | 127 | echo '<script>if(screen.availWidth > 700){document.getElementById("divGeral").style.width = "700px";}</script>'; |
| @@ -134,20 +134,20 @@ function verifica($map,$solegenda) | @@ -134,20 +134,20 @@ function verifica($map,$solegenda) | ||
| 134 | { | 134 | { |
| 135 | Header("Content-type: image/png"); | 135 | Header("Content-type: image/png"); |
| 136 | ImagePng(ImageCreateFromPNG('temas/miniaturas/'.$map.".mini.png")); | 136 | ImagePng(ImageCreateFromPNG('temas/miniaturas/'.$map.".mini.png")); |
| 137 | - exit; | 137 | + exit; |
| 138 | } | 138 | } |
| 139 | if ($tipo == "grande" && file_exists('temas/miniaturas/'.$map.".grande.png")) | 139 | if ($tipo == "grande" && file_exists('temas/miniaturas/'.$map.".grande.png")) |
| 140 | { | 140 | { |
| 141 | Header("Content-type: image/png"); | 141 | Header("Content-type: image/png"); |
| 142 | ImagePng(ImageCreateFromPNG('temas/miniaturas/'.$map.".grande.png")); | 142 | ImagePng(ImageCreateFromPNG('temas/miniaturas/'.$map.".grande.png")); |
| 143 | - exit; | 143 | + exit; |
| 144 | } | 144 | } |
| 145 | ms_ResetErrorList(); | 145 | ms_ResetErrorList(); |
| 146 | $tema = ""; | 146 | $tema = ""; |
| 147 | if(file_exists($map)) | 147 | if(file_exists($map)) |
| 148 | {$tema = $map;} | 148 | {$tema = $map;} |
| 149 | else | 149 | else |
| 150 | - { | 150 | + { |
| 151 | $map = str_replace("\\","/",$map); | 151 | $map = str_replace("\\","/",$map); |
| 152 | $map = basename($map); | 152 | $map = basename($map); |
| 153 | if (file_exists('temas/'.$map)) | 153 | if (file_exists('temas/'.$map)) |
| @@ -174,13 +174,13 @@ function verifica($map,$solegenda) | @@ -174,13 +174,13 @@ function verifica($map,$solegenda) | ||
| 174 | if($base == "" && file_exists('/var/www/i3geo/aplicmap/geral1debianv'.$versao.'.map')){ | 174 | if($base == "" && file_exists('/var/www/i3geo/aplicmap/geral1debianv'.$versao.'.map')){ |
| 175 | $base = "/var/www/i3geo/aplicmap/geral1debianv".$versao.".map"; | 175 | $base = "/var/www/i3geo/aplicmap/geral1debianv".$versao.".map"; |
| 176 | } | 176 | } |
| 177 | - if($f == "" && file_exists('/var/www/html/i3geo/aplicmap/geral1fedorav'.$versao.'.map')){ | 177 | + if($base == "" && file_exists('/var/www/html/i3geo/aplicmap/geral1fedorav'.$versao.'.map')){ |
| 178 | $base = "/var/www/html/i3geo/aplicmap/geral1fedorav".$versao.".map"; | 178 | $base = "/var/www/html/i3geo/aplicmap/geral1fedorav".$versao.".map"; |
| 179 | } | 179 | } |
| 180 | - if($f == "" && file_exists('/opt/www/html/i3geo/aplicmap/geral1fedorav'.$versao.'.map')){ | 180 | + if($base == "" && file_exists('/opt/www/html/i3geo/aplicmap/geral1fedorav'.$versao.'.map')){ |
| 181 | $base = "/opt/www/html/i3geo/aplicmap/geral1v".$versao.".map"; | 181 | $base = "/opt/www/html/i3geo/aplicmap/geral1v".$versao.".map"; |
| 182 | } | 182 | } |
| 183 | - if($f == "") | 183 | + if($base == "") |
| 184 | {$base = $locaplic."/aplicmap/geral1v".$versao.".map";} | 184 | {$base = $locaplic."/aplicmap/geral1v".$versao.".map";} |
| 185 | } | 185 | } |
| 186 | } | 186 | } |
| @@ -188,6 +188,7 @@ function verifica($map,$solegenda) | @@ -188,6 +188,7 @@ function verifica($map,$solegenda) | ||
| 188 | if(!file_exists($base)) | 188 | if(!file_exists($base)) |
| 189 | {$base = $locaplic."/aplicmap/".$base;} | 189 | {$base = $locaplic."/aplicmap/".$base;} |
| 190 | } | 190 | } |
| 191 | + //echo $base;exit; | ||
| 191 | $mapa = ms_newMapObj($base); | 192 | $mapa = ms_newMapObj($base); |
| 192 | error_reporting(0); | 193 | error_reporting(0); |
| 193 | $temasn = $mapa->getAllLayerNames(); | 194 | $temasn = $mapa->getAllLayerNames(); |
| @@ -204,7 +205,7 @@ function verifica($map,$solegenda) | @@ -204,7 +205,7 @@ function verifica($map,$solegenda) | ||
| 204 | if(($lcon == " ") || ($lcon == "")) //para efeitos de compatibilidade | 205 | if(($lcon == " ") || ($lcon == "")) //para efeitos de compatibilidade |
| 205 | {$layern->set("connection",$postgis_mapa);} | 206 | {$layern->set("connection",$postgis_mapa);} |
| 206 | else | 207 | else |
| 207 | - {$layern->set("connection",$postgis_mapa[$lcon]);} | 208 | + {$layern->set("connection",$postgis_mapa[$lcon]);} |
| 208 | } | 209 | } |
| 209 | } | 210 | } |
| 210 | } | 211 | } |
| @@ -251,13 +252,13 @@ function verifica($map,$solegenda) | @@ -251,13 +252,13 @@ function verifica($map,$solegenda) | ||
| 251 | if ($layern->connectiontype == MS_POSTGIS) | 252 | if ($layern->connectiontype == MS_POSTGIS) |
| 252 | { | 253 | { |
| 253 | $lcon = $layern->connection; | 254 | $lcon = $layern->connection; |
| 254 | - error_reporting(0); | 255 | + error_reporting(0); |
| 255 | if (($lcon == " ") || ($lcon == "") || (in_array($lcon,array_keys($postgis_mapa)))) | 256 | if (($lcon == " ") || ($lcon == "") || (in_array($lcon,array_keys($postgis_mapa)))) |
| 256 | { | 257 | { |
| 257 | if(($lcon == " ") || ($lcon == "")) //para efeitos de compatibilidade | 258 | if(($lcon == " ") || ($lcon == "")) //para efeitos de compatibilidade |
| 258 | {$layern->set("connection",$postgis_mapa);} | 259 | {$layern->set("connection",$postgis_mapa);} |
| 259 | else | 260 | else |
| 260 | - {$layern->set("connection",$postgis_mapa[$lcon]);} | 261 | + {$layern->set("connection",$postgis_mapa[$lcon]);} |
| 261 | } | 262 | } |
| 262 | } | 263 | } |
| 263 | } | 264 | } |
| @@ -281,7 +282,7 @@ function verifica($map,$solegenda) | @@ -281,7 +282,7 @@ function verifica($map,$solegenda) | ||
| 281 | $dados = $layern->connection; | 282 | $dados = $layern->connection; |
| 282 | else | 283 | else |
| 283 | $dados = $layern->data; | 284 | $dados = $layern->data; |
| 284 | - $pegarext = $teman; | 285 | + $pegarext = $teman; |
| 285 | } | 286 | } |
| 286 | } | 287 | } |
| 287 | zoomTema($pegarext,$mapa); | 288 | zoomTema($pegarext,$mapa); |
| @@ -322,7 +323,7 @@ function verifica($map,$solegenda) | @@ -322,7 +323,7 @@ function verifica($map,$solegenda) | ||
| 322 | $nomec = ($objImagem->imagepath).nomeRandomico()."teste.png"; | 323 | $nomec = ($objImagem->imagepath).nomeRandomico()."teste.png"; |
| 323 | $objImagem->saveImage($nomec); | 324 | $objImagem->saveImage($nomec); |
| 324 | $nomer = ($objImagem->imageurl).basename($nomec); | 325 | $nomer = ($objImagem->imageurl).basename($nomec); |
| 325 | - | 326 | + |
| 326 | $nomel = ($objImagemLegenda->imagepath).nomeRandomico()."testel.png"; | 327 | $nomel = ($objImagemLegenda->imagepath).nomeRandomico()."testel.png"; |
| 327 | $objImagemLegenda->saveImage($nomel); | 328 | $objImagemLegenda->saveImage($nomel); |
| 328 | $nomerl = ($objImagemLegenda->imageurl).basename($nomel); | 329 | $nomerl = ($objImagemLegenda->imageurl).basename($nomel); |
| @@ -346,7 +347,7 @@ function verifica($map,$solegenda) | @@ -346,7 +347,7 @@ function verifica($map,$solegenda) | ||
| 346 | $error = $error->next(); | 347 | $error = $error->next(); |
| 347 | } | 348 | } |
| 348 | } | 349 | } |
| 349 | - | 350 | + |
| 350 | } | 351 | } |
| 351 | else | 352 | else |
| 352 | { | 353 | { |
| @@ -360,7 +361,7 @@ function zoomTema($nomelayer,&$mapa) | @@ -360,7 +361,7 @@ function zoomTema($nomelayer,&$mapa) | ||
| 360 | { | 361 | { |
| 361 | $layer = $mapa->getlayerbyname($nomelayer); | 362 | $layer = $mapa->getlayerbyname($nomelayer); |
| 362 | if($layer->data == "" && $layer->connection == "") | 363 | if($layer->data == "" && $layer->connection == "") |
| 363 | - {return;} | 364 | + {return;} |
| 364 | $prjMapa = $mapa->getProjection(); | 365 | $prjMapa = $mapa->getProjection(); |
| 365 | $prjTema = $layer->getProjection(); | 366 | $prjTema = $layer->getProjection(); |
| 366 | $extatual = $mapa->extent; | 367 | $extatual = $mapa->extent; |