Commit 5c8fdff9dece41b1b3bc994daa317542fc49722c
1 parent
f6868537
Exists in
master
and in
7 other branches
Remoção da opção de edição de conexões do sistema de administração em prol de va…
…riável definida em ms_configura.php
Showing
12 changed files
with
118 additions
and
24 deletions
Show diff stats
admin/admin.db
No preview for this file type
admin1/dicionario/principal.js
@@ -80,6 +80,11 @@ i3GEOadmin.principal.dicionario = { | @@ -80,6 +80,11 @@ i3GEOadmin.principal.dicionario = { | ||
80 | en : "", | 80 | en : "", |
81 | es : "" | 81 | es : "" |
82 | } ], | 82 | } ], |
83 | + 'leiaMe1' : [ { | ||
84 | + pt : "Na versão 7 do i3Geo, a opção de cadastro de conexões com o banco de dados foi removida. A string de conexão deve ser definida no arquivo i3geo/ms_configura.php por meio da variável $postgis_mapa (veja detalhes nesse mesmo arquivo).", | ||
85 | + en : "", | ||
86 | + es : "" | ||
87 | + } ], | ||
83 | 'erroLogin' : [ { | 88 | 'erroLogin' : [ { |
84 | pt : "É necessário fazer login", | 89 | pt : "É necessário fazer login", |
85 | en : "", | 90 | en : "", |
admin1/index.php
@@ -94,6 +94,7 @@ include "head.php"; | @@ -94,6 +94,7 @@ include "head.php"; | ||
94 | </p> | 94 | </p> |
95 | </div> | 95 | </div> |
96 | <div class="alert alert-warning">{{{leiaMe}}}</div> | 96 | <div class="alert alert-warning">{{{leiaMe}}}</div> |
97 | + <div class="alert alert-warning">{{{leiaMe1}}}</div> | ||
97 | 98 | ||
98 | </div> | 99 | </div> |
99 | </div> | 100 | </div> |
admin1/menu.js
@@ -46,9 +46,9 @@ menuPrincipal = [ | @@ -46,9 +46,9 @@ menuPrincipal = [ | ||
46 | html: "<a href='" + i3GEO.configura.locaplic + "/admin1/metaestat/variaveis/index.php' >"+$trad("cadastroVariav",i3GEOadmin.menup.dicionario)+"</a>" | 46 | html: "<a href='" + i3GEO.configura.locaplic + "/admin1/metaestat/variaveis/index.php' >"+$trad("cadastroVariav",i3GEOadmin.menup.dicionario)+"</a>" |
47 | },{ | 47 | },{ |
48 | html: "<a href='" + i3GEO.configura.locaplic + "/admin1/metaestat/unidades/index.php' >"+$trad("cadastroMedidas",i3GEOadmin.menup.dicionario)+"</a>" | 48 | html: "<a href='" + i3GEO.configura.locaplic + "/admin1/metaestat/unidades/index.php' >"+$trad("cadastroMedidas",i3GEOadmin.menup.dicionario)+"</a>" |
49 | - },{ | ||
50 | - html: "<a href='" + i3GEO.configura.locaplic + "/admin1/metaestat/periodos/index.php' >"+$trad("cadastroPeriodos",i3GEOadmin.menup.dicionario)+"</a>" | ||
51 | - },{ | 49 | + } |
50 | + //,{html: "<a href='" + i3GEO.configura.locaplic + "/admin1/metaestat/periodos/index.php' >"+$trad("cadastroPeriodos",i3GEOadmin.menup.dicionario)+"</a>"} | ||
51 | + ,{ | ||
52 | html: "<a href='" + i3GEO.configura.locaplic + "/admin1/metaestat/conexoes/index.php' >"+$trad("cadastroConexoes",i3GEOadmin.menup.dicionario)+"</a>" | 52 | html: "<a href='" + i3GEO.configura.locaplic + "/admin1/metaestat/conexoes/index.php' >"+$trad("cadastroConexoes",i3GEOadmin.menup.dicionario)+"</a>" |
53 | },{ | 53 | },{ |
54 | html: "<a href='" + i3GEO.configura.locaplic + "/admin1/metaestat/regioes/index.php' >"+$trad("cadastroTabelas",i3GEOadmin.menup.dicionario)+"</a>" | 54 | html: "<a href='" + i3GEO.configura.locaplic + "/admin1/metaestat/regioes/index.php' >"+$trad("cadastroTabelas",i3GEOadmin.menup.dicionario)+"</a>" |
admin1/metaestat/regioes/funcoes.php
@@ -92,8 +92,9 @@ function colunasRegiao($dbh,$codigo_tipo_regiao){ | @@ -92,8 +92,9 @@ function colunasRegiao($dbh,$codigo_tipo_regiao){ | ||
92 | //parametros da regiao | 92 | //parametros da regiao |
93 | $regiao = \admin\metaestat\regioes\listar($dbh, $codigo_tipo_regiao); | 93 | $regiao = \admin\metaestat\regioes\listar($dbh, $codigo_tipo_regiao); |
94 | //parametros de conexao | 94 | //parametros de conexao |
95 | - $c = \admin\php\funcoesAdmin\pegaDados ( "SELECT * from " . $esquemaadmin . "i3geoestat_conexao WHERE codigo_estat_conexao = " . $regiao["codigo_estat_conexao"], $dbh, false ); | ||
96 | - $c = $c[0]; | 95 | + //$c = \admin\php\funcoesAdmin\pegaDados ( "SELECT * from " . $esquemaadmin . "i3geoestat_conexao WHERE codigo_estat_conexao = " . $regiao["codigo_estat_conexao"], $dbh, false ); |
96 | + //$c = $c[0]; | ||
97 | + $c = \admin\php\funcoesAdmin\listaConexaoMetaestat(); | ||
97 | $dbhBD = new PDO('pgsql:dbname='.$c["bancodedados"].';user='.$c["usuario"].';password='.$c["senha"].';host='.$c["host"].';port='.$c["porta"]); | 98 | $dbhBD = new PDO('pgsql:dbname='.$c["bancodedados"].';user='.$c["usuario"].';password='.$c["senha"].';host='.$c["host"].';port='.$c["porta"]); |
98 | 99 | ||
99 | $sql = "SELECT a.attnum,a.attname AS field,t.typname AS type,a.attlen AS length,a.atttypmod AS lengthvar,a.attnotnull AS notnull,p.nspname as esquema FROM pg_class c,pg_attribute a,pg_type t,pg_namespace p WHERE c.relname = '" . $regiao["tabela"] . "' and p.nspname = '" . $regiao["esquemadb"] . "' and a.attnum > 0 and a.attrelid = c.oid and a.atttypid = t.oid and c.relnamespace = p.oid ORDER BY a.attname"; | 100 | $sql = "SELECT a.attnum,a.attname AS field,t.typname AS type,a.attlen AS length,a.atttypmod AS lengthvar,a.attnotnull AS notnull,p.nspname as esquema FROM pg_class c,pg_attribute a,pg_type t,pg_namespace p WHERE c.relname = '" . $regiao["tabela"] . "' and p.nspname = '" . $regiao["esquemadb"] . "' and a.attnum > 0 and a.attrelid = c.oid and a.atttypid = t.oid and c.relnamespace = p.oid ORDER BY a.attname"; |
admin1/metaestat/variaveis/medidas/funcoes.php
@@ -82,8 +82,9 @@ function colunasMedida($dbh,$id_medida_variavel){ | @@ -82,8 +82,9 @@ function colunasMedida($dbh,$id_medida_variavel){ | ||
82 | //parametros da regiao | 82 | //parametros da regiao |
83 | $medida = \admin\metaestat\variaveis\medidas\listar($dbh, "", $id_medida_variavel); | 83 | $medida = \admin\metaestat\variaveis\medidas\listar($dbh, "", $id_medida_variavel); |
84 | //parametros de conexao | 84 | //parametros de conexao |
85 | - $c = \admin\php\funcoesAdmin\pegaDados ( "SELECT * from " . $esquemaadmin . "i3geoestat_conexao WHERE codigo_estat_conexao = " . $medida["codigo_estat_conexao"], $dbh, false ); | ||
86 | - $c = $c[0]; | 85 | + //$c = \admin\php\funcoesAdmin\pegaDados ( "SELECT * from " . $esquemaadmin . "i3geoestat_conexao WHERE codigo_estat_conexao = " . $medida["codigo_estat_conexao"], $dbh, false ); |
86 | + //$c = $c[0]; | ||
87 | + $c = \admin\php\funcoesAdmin\listaConexaoMetaestat(); | ||
87 | $dbhBD = new PDO('pgsql:dbname='.$c["bancodedados"].';user='.$c["usuario"].';password='.$c["senha"].';host='.$c["host"].';port='.$c["porta"]); | 88 | $dbhBD = new PDO('pgsql:dbname='.$c["bancodedados"].';user='.$c["usuario"].';password='.$c["senha"].';host='.$c["host"].';port='.$c["porta"]); |
88 | 89 | ||
89 | $sql = "SELECT a.attnum,a.attname AS field,t.typname AS type,a.attlen AS length,a.atttypmod AS lengthvar,a.attnotnull AS notnull,p.nspname as esquema FROM pg_class c,pg_attribute a,pg_type t,pg_namespace p WHERE c.relname = '" . $medida["tabela"] . "' and p.nspname = '" . $medida["esquemadb"] . "' and a.attnum > 0 and a.attrelid = c.oid and a.atttypid = t.oid and c.relnamespace = p.oid ORDER BY a.attname"; | 90 | $sql = "SELECT a.attnum,a.attname AS field,t.typname AS type,a.attlen AS length,a.atttypmod AS lengthvar,a.attnotnull AS notnull,p.nspname as esquema FROM pg_class c,pg_attribute a,pg_type t,pg_namespace p WHERE c.relname = '" . $medida["tabela"] . "' and p.nspname = '" . $medida["esquemadb"] . "' and a.attnum > 0 and a.attrelid = c.oid and a.atttypid = t.oid and c.relnamespace = p.oid ORDER BY a.attname"; |
admin1/php/bdexplorer.php
@@ -49,7 +49,8 @@ switch ($funcao) { | @@ -49,7 +49,8 @@ switch ($funcao) { | ||
49 | $parametros = $dbh; | 49 | $parametros = $dbh; |
50 | } else { | 50 | } else { |
51 | $mt = new MetaestatInfo (); | 51 | $mt = new MetaestatInfo (); |
52 | - $parametros = $mt->listaConexao ( ( int ) $_POST ["codigo_estat_conexao"], true, false ); | 52 | + //$parametros = $mt->listaConexao ( ( int ) $_POST ["codigo_estat_conexao"], true, false ); |
53 | + $parametros = $mt->listaConexaoMetaestat(); | ||
53 | } | 54 | } |
54 | $bd = new \i3geo\classesphp\bdexplorer\Bdexplorer ( $_SESSION ["locaplic"], $parametros ); | 55 | $bd = new \i3geo\classesphp\bdexplorer\Bdexplorer ( $_SESSION ["locaplic"], $parametros ); |
55 | $dados = $bd->listaDeTabelas ( $_POST ["esquema"] ); | 56 | $dados = $bd->listaDeTabelas ( $_POST ["esquema"] ); |
@@ -75,7 +76,8 @@ switch ($funcao) { | @@ -75,7 +76,8 @@ switch ($funcao) { | ||
75 | case "LISTARCOLUNAS" : | 76 | case "LISTARCOLUNAS" : |
76 | // pega os parametros de conexao | 77 | // pega os parametros de conexao |
77 | $mt = new MetaestatInfo (); | 78 | $mt = new MetaestatInfo (); |
78 | - $parametros = $mt->listaConexao ( ( int ) $_POST ["codigo_estat_conexao"], true, false ); | 79 | + //$parametros = $mt->listaConexao ( ( int ) $_POST ["codigo_estat_conexao"], true, false ); |
80 | + $parametros = $mt->listaConexaoMetaestat(); | ||
79 | $bd = new \i3geo\classesphp\bdexplorer\Bdexplorer ( $_SESSION ["locaplic"], $parametros ); | 81 | $bd = new \i3geo\classesphp\bdexplorer\Bdexplorer ( $_SESSION ["locaplic"], $parametros ); |
80 | $dados = $bd->listaDeColunas ( $_POST ["esquema"], $_POST ["tabela"] ); | 82 | $dados = $bd->listaDeColunas ( $_POST ["esquema"], $_POST ["tabela"] ); |
81 | if ($dados === false) { | 83 | if ($dados === false) { |
@@ -86,8 +88,10 @@ switch ($funcao) { | @@ -86,8 +88,10 @@ switch ($funcao) { | ||
86 | break; | 88 | break; |
87 | case "LISTARCODIGOSCONEXAO" : | 89 | case "LISTARCODIGOSCONEXAO" : |
88 | // pega os parametros de conexao | 90 | // pega os parametros de conexao |
91 | + \admin\php\funcoesAdmin\retornaJSON ( array() ); | ||
92 | + /* | ||
89 | $mt = new MetaestatInfo (); | 93 | $mt = new MetaestatInfo (); |
90 | - $dados = $mt->listaConexao ( "", false, false ); | 94 | + $dados = $mt->listaConexaoMetaestat(); |
91 | if ($dados === false) { | 95 | if ($dados === false) { |
92 | header ( "HTTP/1.1 500 erro ao consultar banco de dados" ); | 96 | header ( "HTTP/1.1 500 erro ao consultar banco de dados" ); |
93 | } else { | 97 | } else { |
@@ -100,6 +104,7 @@ switch ($funcao) { | @@ -100,6 +104,7 @@ switch ($funcao) { | ||
100 | } | 104 | } |
101 | \admin\php\funcoesAdmin\retornaJSON ( $kv ); | 105 | \admin\php\funcoesAdmin\retornaJSON ( $kv ); |
102 | } | 106 | } |
107 | + */ | ||
103 | break; | 108 | break; |
104 | default : | 109 | default : |
105 | if (! empty ( $funcao )) | 110 | if (! empty ( $funcao )) |
admin1/php/funcoesAdmin.php
@@ -3,6 +3,38 @@ namespace admin\php\funcoesAdmin; | @@ -3,6 +3,38 @@ namespace admin\php\funcoesAdmin; | ||
3 | use PDO; | 3 | use PDO; |
4 | use PDOException; | 4 | use PDOException; |
5 | use Services_JSON; | 5 | use Services_JSON; |
6 | + | ||
7 | +function listaConexaoMetaestat(){ | ||
8 | + if(!isset($_SESSION["postgis_mapa"])){ | ||
9 | + include(dirname(__FILE__)."/../../ms_configura.php"); | ||
10 | + } else { | ||
11 | + $postgis_mapa = $_SESSION["postgis_mapa"]; | ||
12 | + } | ||
13 | + if(isset($postgis_mapa["metaestat"])){ | ||
14 | + $m = $postgis_mapa["metaestat"]; | ||
15 | + if($m == ""){ | ||
16 | + return false; | ||
17 | + } | ||
18 | + $lista = explode(" ",$m); | ||
19 | + $con = array(); | ||
20 | + foreach($lista as $l){ | ||
21 | + $teste = explode("=",$l); | ||
22 | + $con[trim($teste[0])] = trim($teste[1]); | ||
23 | + } | ||
24 | + $c = array( | ||
25 | + "codigo_estat_conexao" => "metaestat", | ||
26 | + "bancodedados" => $con["dbname"], | ||
27 | + "host" => $con["host"], | ||
28 | + "porta" => $con["port"], | ||
29 | + "usuario" => $con["user"], | ||
30 | + "senha" => $con["password"], | ||
31 | + "fonte" => "ms_configura" | ||
32 | + ); | ||
33 | + return $c; | ||
34 | + } else { | ||
35 | + return false; | ||
36 | + } | ||
37 | +} | ||
6 | // | 38 | // |
7 | // verifica se um determinado papel esta registrado na variavel SESSION | 39 | // verifica se um determinado papel esta registrado na variavel SESSION |
8 | // | 40 | // |
classesphp/classe_metaestatinfo.php
@@ -194,7 +194,8 @@ class MetaestatInfo{ | @@ -194,7 +194,8 @@ class MetaestatInfo{ | ||
194 | function execSQLDB($codigo_estat_conexao,$sql){ | 194 | function execSQLDB($codigo_estat_conexao,$sql){ |
195 | $buscar = array("drop","update","insert","delete"); | 195 | $buscar = array("drop","update","insert","delete"); |
196 | $sql = str_ireplace($buscar,"",$sql); | 196 | $sql = str_ireplace($buscar,"",$sql); |
197 | - $c = $this->listaConexao($codigo_estat_conexao,true); | 197 | + //$c = $this->listaConexao($codigo_estat_conexao,true); |
198 | + $c = $this->listaConexaoMetaestat(); | ||
198 | $dbhold = $this->dbh; | 199 | $dbhold = $this->dbh; |
199 | $dbh = new PDO('pgsql:dbname='.$c["bancodedados"].';user='.$c["usuario"].';password='.$c["senha"].';host='.$c["host"].';port='.$c["porta"]); | 200 | $dbh = new PDO('pgsql:dbname='.$c["bancodedados"].';user='.$c["usuario"].';password='.$c["senha"].';host='.$c["host"].';port='.$c["porta"]); |
200 | $this->dbh = $dbh; | 201 | $this->dbh = $dbh; |
@@ -513,7 +514,8 @@ class MetaestatInfo{ | @@ -513,7 +514,8 @@ class MetaestatInfo{ | ||
513 | if($meta["codigo_tipo_regiao"] == $codigo_tipo_regiao || empty($codigo_tipo_regiao) ){ | 514 | if($meta["codigo_tipo_regiao"] == $codigo_tipo_regiao || empty($codigo_tipo_regiao) ){ |
514 | $agruparpor = ""; | 515 | $agruparpor = ""; |
515 | } | 516 | } |
516 | - $dconexao = $this->listaConexao($meta["codigo_estat_conexao"],true); | 517 | + //$dconexao = $this->listaConexao($meta["codigo_estat_conexao"],true); |
518 | + $dconexao = $this->listaConexaoMetaestat(); | ||
517 | $conexao = "user=".$dconexao["usuario"]." password=".$dconexao["senha"]." dbname=".$dconexao["bancodedados"]." host=".$dconexao["host"]." port=".$dconexao["porta"].""; | 519 | $conexao = "user=".$dconexao["usuario"]." password=".$dconexao["senha"]." dbname=".$dconexao["bancodedados"]." host=".$dconexao["host"]." port=".$dconexao["porta"].""; |
518 | $sql = $this->sqlMedidaVariavel( | 520 | $sql = $this->sqlMedidaVariavel( |
519 | $id_medida_variavel, | 521 | $id_medida_variavel, |
@@ -642,7 +644,8 @@ class MetaestatInfo{ | @@ -642,7 +644,8 @@ class MetaestatInfo{ | ||
642 | $dados[] = ' NAME "'.$this->nomecache.'"'; | 644 | $dados[] = ' NAME "'.$this->nomecache.'"'; |
643 | $dados[] = " TYPE $tipolayer"; | 645 | $dados[] = " TYPE $tipolayer"; |
644 | $dados[] = ' DATA "'.$sqlf.'"'; | 646 | $dados[] = ' DATA "'.$sqlf.'"'; |
645 | - $dados[] = ' CONNECTION "'.$conexao.'"'; | 647 | + //$dados[] = ' CONNECTION "'.$conexao.'"'; |
648 | + $dados[] = ' CONNECTION "metaestat"'; | ||
646 | $dados[] = ' CONNECTIONTYPE POSTGIS'; | 649 | $dados[] = ' CONNECTIONTYPE POSTGIS'; |
647 | $dados[] = ' STATUS OFF'; | 650 | $dados[] = ' STATUS OFF'; |
648 | $dados[] = ' TEMPLATE "none.htm"'; | 651 | $dados[] = ' TEMPLATE "none.htm"'; |
@@ -777,7 +780,8 @@ class MetaestatInfo{ | @@ -777,7 +780,8 @@ class MetaestatInfo{ | ||
777 | $meta = $this->listaTipoRegiao($codigo_tipo_regiao); | 780 | $meta = $this->listaTipoRegiao($codigo_tipo_regiao); |
778 | $titulolayer = $meta["nome_tipo_regiao"]; | 781 | $titulolayer = $meta["nome_tipo_regiao"]; |
779 | $titulolayer = mb_convert_encoding($titulolayer,"ISO-8859-1",mb_detect_encoding($titulolayer)); | 782 | $titulolayer = mb_convert_encoding($titulolayer,"ISO-8859-1",mb_detect_encoding($titulolayer)); |
780 | - $conexao = $this->listaConexao($meta["codigo_estat_conexao"],true); | 783 | + //$conexao = $this->listaConexao($meta["codigo_estat_conexao"],true); |
784 | + $conexao = $this->listaConexaoMetaestat(); | ||
781 | $conexao = "user=".$conexao["usuario"]." password=".$conexao["senha"]." dbname=".$conexao["bancodedados"]." host=".$conexao["host"]." port=".$conexao["porta"].""; | 785 | $conexao = "user=".$conexao["usuario"]." password=".$conexao["senha"]." dbname=".$conexao["bancodedados"]." host=".$conexao["host"]." port=".$conexao["porta"].""; |
782 | $colunageo = $meta["colunageo"]; | 786 | $colunageo = $meta["colunageo"]; |
783 | $srid = $meta["srid"]; | 787 | $srid = $meta["srid"]; |
@@ -1000,7 +1004,8 @@ class MetaestatInfo{ | @@ -1000,7 +1004,8 @@ class MetaestatInfo{ | ||
1000 | //echo $sqlf;exit; | 1004 | //echo $sqlf;exit; |
1001 | $metaVariavel = $this->listaMedidaVariavel("",$id_medida_variavel); | 1005 | $metaVariavel = $this->listaMedidaVariavel("",$id_medida_variavel); |
1002 | if(!empty($metaVariavel["codigo_estat_conexao"])){ | 1006 | if(!empty($metaVariavel["codigo_estat_conexao"])){ |
1003 | - $c = $this->listaConexao($metaVariavel["codigo_estat_conexao"],true); | 1007 | + //$c = $this->listaConexao($metaVariavel["codigo_estat_conexao"],true); |
1008 | + $c = $this->listaConexaoMetaestat(); | ||
1004 | $dbhold = $this->dbh; | 1009 | $dbhold = $this->dbh; |
1005 | $dbh = new PDO('pgsql:dbname='.$c["bancodedados"].';user='.$c["usuario"].';password='.$c["senha"].';host='.$c["host"].';port='.$c["porta"]); | 1010 | $dbh = new PDO('pgsql:dbname='.$c["bancodedados"].';user='.$c["usuario"].';password='.$c["senha"].';host='.$c["host"].';port='.$c["porta"]); |
1006 | $this->dbh = $dbh; | 1011 | $this->dbh = $dbh; |
@@ -1021,7 +1026,8 @@ class MetaestatInfo{ | @@ -1021,7 +1026,8 @@ class MetaestatInfo{ | ||
1021 | $sqlf = $sqlf["sqlagrupamento"]; | 1026 | $sqlf = $sqlf["sqlagrupamento"]; |
1022 | $metaVariavel = $this->listaMedidaVariavel("",$id_medida_variavel); | 1027 | $metaVariavel = $this->listaMedidaVariavel("",$id_medida_variavel); |
1023 | if(!empty($metaVariavel["codigo_estat_conexao"])){ | 1028 | if(!empty($metaVariavel["codigo_estat_conexao"])){ |
1024 | - $c = $this->listaConexao($metaVariavel["codigo_estat_conexao"],true); | 1029 | + //$c = $this->listaConexao($metaVariavel["codigo_estat_conexao"],true); |
1030 | + $c = $this->listaConexaoMetaestat(); | ||
1025 | $dbhold = $this->dbh; | 1031 | $dbhold = $this->dbh; |
1026 | $dbh = new PDO('pgsql:dbname='.$c["bancodedados"].';user='.$c["usuario"].';password='.$c["senha"].';host='.$c["host"].';port='.$c["porta"]); | 1032 | $dbh = new PDO('pgsql:dbname='.$c["bancodedados"].';user='.$c["usuario"].';password='.$c["senha"].';host='.$c["host"].';port='.$c["porta"]); |
1027 | $this->dbh = $dbh; | 1033 | $this->dbh = $dbh; |
@@ -1317,6 +1323,38 @@ class MetaestatInfo{ | @@ -1317,6 +1323,38 @@ class MetaestatInfo{ | ||
1317 | } | 1323 | } |
1318 | return $regioes; | 1324 | return $regioes; |
1319 | } | 1325 | } |
1326 | + function listaConexaoMetaestat(){ | ||
1327 | + if(!isset($_SESSION["postgis_mapa"])){ | ||
1328 | + include(dirname(__FILE__)."/../ms_configura.php"); | ||
1329 | + } else { | ||
1330 | + $postgis_mapa = $_SESSION["postgis_mapa"]; | ||
1331 | + } | ||
1332 | + if(isset($postgis_mapa["metaestat"])){ | ||
1333 | + $m = $postgis_mapa["metaestat"]; | ||
1334 | + if($m == ""){ | ||
1335 | + return false; | ||
1336 | + } | ||
1337 | + $lista = explode(" ",$m); | ||
1338 | + $con = array(); | ||
1339 | + foreach($lista as $l){ | ||
1340 | + $teste = explode("=",$l); | ||
1341 | + $con[trim($teste[0])] = trim($teste[1]); | ||
1342 | + } | ||
1343 | + $c = array( | ||
1344 | + "codigo_estat_conexao" => "metaestat", | ||
1345 | + "bancodedados" => $con["dbname"], | ||
1346 | + "host" => $con["host"], | ||
1347 | + "porta" => $con["port"], | ||
1348 | + "usuario" => $con["user"], | ||
1349 | + "senha" => $con["password"], | ||
1350 | + "options" => $con["options"], | ||
1351 | + "fonte" => "ms_configura" | ||
1352 | + ); | ||
1353 | + return $c; | ||
1354 | + } else { | ||
1355 | + return false; | ||
1356 | + } | ||
1357 | + } | ||
1320 | /** | 1358 | /** |
1321 | * Lista os dados de uma conexao ou de todas | 1359 | * Lista os dados de uma conexao ou de todas |
1322 | * @param id da conexao | 1360 | * @param id da conexao |
@@ -1494,7 +1532,8 @@ class MetaestatInfo{ | @@ -1494,7 +1532,8 @@ class MetaestatInfo{ | ||
1494 | function listaPropGeoRegiao($codigo_tipo_regiao){ | 1532 | function listaPropGeoRegiao($codigo_tipo_regiao){ |
1495 | //st_dimension returns 0 for POINT, 1 for LINESTRING, 2 for POLYGON | 1533 | //st_dimension returns 0 for POINT, 1 for LINESTRING, 2 for POLYGON |
1496 | $regiao = $this->listaTipoRegiao($codigo_tipo_regiao); | 1534 | $regiao = $this->listaTipoRegiao($codigo_tipo_regiao); |
1497 | - $c = $this->listaConexao($regiao["codigo_estat_conexao"],true); | 1535 | + //$c = $this->listaConexao($regiao["codigo_estat_conexao"],true); |
1536 | + $c = $this->listaConexaoMetaestat(); | ||
1498 | $dbh = new PDO('pgsql:dbname='.$c["bancodedados"].';user='.$c["usuario"].';password='.$c["senha"].';host='.$c["host"].';port='.$c["porta"]); | 1537 | $dbh = new PDO('pgsql:dbname='.$c["bancodedados"].';user='.$c["usuario"].';password='.$c["senha"].';host='.$c["host"].';port='.$c["porta"]); |
1499 | $c = $regiao["colunageo"]; | 1538 | $c = $regiao["colunageo"]; |
1500 | $sql = "select st_dimension(".$regiao["colunageo"].") as st_dimension from ".$regiao["esquemadb"].".".$regiao["tabela"]." limit 1"; | 1539 | $sql = "select st_dimension(".$regiao["colunageo"].") as st_dimension from ".$regiao["esquemadb"].".".$regiao["tabela"]." limit 1"; |
@@ -1578,7 +1617,8 @@ class MetaestatInfo{ | @@ -1578,7 +1617,8 @@ class MetaestatInfo{ | ||
1578 | function listaDadosRegiao($codigo_tipo_regiao,$codigo_tipo_regiaopai="",$valorregiaopai=""){ | 1617 | function listaDadosRegiao($codigo_tipo_regiao,$codigo_tipo_regiaopai="",$valorregiaopai=""){ |
1579 | //pega a tabela, esquema e conexao para acessar os dados da regiao | 1618 | //pega a tabela, esquema e conexao para acessar os dados da regiao |
1580 | $regiao = $this->listaTipoRegiao($codigo_tipo_regiao); | 1619 | $regiao = $this->listaTipoRegiao($codigo_tipo_regiao); |
1581 | - $c = $this->listaConexao($regiao["codigo_estat_conexao"],true); | 1620 | + //$c = $this->listaConexao($regiao["codigo_estat_conexao"],true); |
1621 | + $c = $this->listaConexaoMetaestat(); | ||
1582 | $dbh = new PDO('pgsql:dbname='.$c["bancodedados"].';user='.$c["usuario"].';password='.$c["senha"].';host='.$c["host"].';port='.$c["porta"]); | 1622 | $dbh = new PDO('pgsql:dbname='.$c["bancodedados"].';user='.$c["usuario"].';password='.$c["senha"].';host='.$c["host"].';port='.$c["porta"]); |
1583 | $c = $regiao["colunageo"]; | 1623 | $c = $regiao["colunageo"]; |
1584 | $bbox = "ST_XMin($c)||' '||ST_YMin($c)||' '||ST_XMax($c)||' '||ST_YMax($c) as ext "; | 1624 | $bbox = "ST_XMin($c)||' '||ST_YMin($c)||' '||ST_XMax($c)||' '||ST_YMax($c) as ext "; |
@@ -1603,7 +1643,8 @@ class MetaestatInfo{ | @@ -1603,7 +1643,8 @@ class MetaestatInfo{ | ||
1603 | function listaDadosGeometriaRegiao($codigo_tipo_regiao){ | 1643 | function listaDadosGeometriaRegiao($codigo_tipo_regiao){ |
1604 | //pega a tabela, esquema e conexao para acessar os dados da regiao | 1644 | //pega a tabela, esquema e conexao para acessar os dados da regiao |
1605 | $regiao = $this->listaTipoRegiao($codigo_tipo_regiao); | 1645 | $regiao = $this->listaTipoRegiao($codigo_tipo_regiao); |
1606 | - $c = $this->listaConexao($regiao["codigo_estat_conexao"],true); | 1646 | + //$c = $this->listaConexao($regiao["codigo_estat_conexao"],true); |
1647 | + $c = $this->listaConexaoMetaestat(); | ||
1607 | $dbh = new PDO('pgsql:dbname='.$c["bancodedados"].';user='.$c["usuario"].';password='.$c["senha"].';host='.$c["host"].';port='.$c["porta"]); | 1648 | $dbh = new PDO('pgsql:dbname='.$c["bancodedados"].';user='.$c["usuario"].';password='.$c["senha"].';host='.$c["host"].';port='.$c["porta"]); |
1608 | $c = $regiao["colunageo"]; | 1649 | $c = $regiao["colunageo"]; |
1609 | $s = "ST_dimension($c) as dimension "; | 1650 | $s = "ST_dimension($c) as dimension "; |
@@ -1952,7 +1993,8 @@ class MetaestatInfo{ | @@ -1952,7 +1993,8 @@ class MetaestatInfo{ | ||
1952 | function xy2regiao($codigo_tipo_regiao,$x,$y){ | 1993 | function xy2regiao($codigo_tipo_regiao,$x,$y){ |
1953 | //pega a tabela, esquema e conexao para acessar os dados da regiao | 1994 | //pega a tabela, esquema e conexao para acessar os dados da regiao |
1954 | $regiao = $this->listaTipoRegiao($codigo_tipo_regiao); | 1995 | $regiao = $this->listaTipoRegiao($codigo_tipo_regiao); |
1955 | - $c = $this->listaConexao($regiao["codigo_estat_conexao"],true); | 1996 | + //$c = $this->listaConexao($regiao["codigo_estat_conexao"],true); |
1997 | + $c = $this->listaConexaoMetaestat(); | ||
1956 | $dbh = new PDO('pgsql:dbname='.$c["bancodedados"].';user='.$c["usuario"].';password='.$c["senha"].';host='.$c["host"].';port='.$c["porta"]); | 1998 | $dbh = new PDO('pgsql:dbname='.$c["bancodedados"].';user='.$c["usuario"].';password='.$c["senha"].';host='.$c["host"].';port='.$c["porta"]); |
1957 | $sql = "select ".$regiao["identificador"]." as identificador_regiao,".$regiao["colunanomeregiao"]." as nomeregiao from i3geo_metaestat.".$regiao["tabela"]." WHERE ST_within(ST_GeomFromText('POINT($x $y)',".$regiao["srid"]."),".$regiao["colunageo"].")"; | 1999 | $sql = "select ".$regiao["identificador"]." as identificador_regiao,".$regiao["colunanomeregiao"]." as nomeregiao from i3geo_metaestat.".$regiao["tabela"]." WHERE ST_within(ST_GeomFromText('POINT($x $y)',".$regiao["srid"]."),".$regiao["colunageo"].")"; |
1958 | $q = $dbh->query($sql,PDO::FETCH_ASSOC); | 2000 | $q = $dbh->query($sql,PDO::FETCH_ASSOC); |
@@ -1974,7 +2016,8 @@ class MetaestatInfo{ | @@ -1974,7 +2016,8 @@ class MetaestatInfo{ | ||
1974 | */ | 2016 | */ |
1975 | function listaAtributosMedidaVariavelRegiao ($identificador_regiao,$id_medida_variavel){ | 2017 | function listaAtributosMedidaVariavelRegiao ($identificador_regiao,$id_medida_variavel){ |
1976 | $medida = $this->listaMedidaVariavel("",$id_medida_variavel); | 2018 | $medida = $this->listaMedidaVariavel("",$id_medida_variavel); |
1977 | - $c = $this->listaConexao($medida["codigo_estat_conexao"],true); | 2019 | + //$c = $this->listaConexao($medida["codigo_estat_conexao"],true); |
2020 | + $c = $this->listaConexaoMetaestat(); | ||
1978 | if($medida["colunavalor"] == ""){ | 2021 | if($medida["colunavalor"] == ""){ |
1979 | return ""; | 2022 | return ""; |
1980 | } | 2023 | } |
classesphp/metaestat_controle.php
@@ -239,7 +239,8 @@ switch (strtoupper($funcao)) { | @@ -239,7 +239,8 @@ switch (strtoupper($funcao)) { | ||
239 | break; | 239 | break; |
240 | case "LISTACONEXAO": | 240 | case "LISTACONEXAO": |
241 | $m = new MetaestatInfo(); | 241 | $m = new MetaestatInfo(); |
242 | - retornaJSON($m->listaConexao($_pg["codigo_estat_conexao"])); | 242 | + //retornaJSON($m->listaConexao($_pg["codigo_estat_conexao"])); |
243 | + retornaJSON($m->listaConexaoMetaestat()); | ||
243 | exit(); | 244 | exit(); |
244 | break; | 245 | break; |
245 | case "ESQUEMASCONEXAO": | 246 | case "ESQUEMASCONEXAO": |
ferramentas/saiku/cartograma.php
@@ -62,7 +62,8 @@ else{ | @@ -62,7 +62,8 @@ else{ | ||
62 | exit; | 62 | exit; |
63 | } | 63 | } |
64 | $titulolayer = mb_convert_encoding($titulolayer,"ISO-8859-1",mb_detect_encoding($titulolayer)); | 64 | $titulolayer = mb_convert_encoding($titulolayer,"ISO-8859-1",mb_detect_encoding($titulolayer)); |
65 | - $conexao = $m->listaConexao($meta["codigo_estat_conexao"],true); | 65 | + //$conexao = $m->listaConexao($meta["codigo_estat_conexao"],true); |
66 | + $conexao = $m->listaConexaoMetaestat(); | ||
66 | $conexao = "user=".$conexao["usuario"]." password=".$conexao["senha"]." dbname=".$conexao["bancodedados"]." host=".$conexao["host"]." port=".$conexao["porta"].""; | 67 | $conexao = "user=".$conexao["usuario"]." password=".$conexao["senha"]." dbname=".$conexao["bancodedados"]." host=".$conexao["host"]." port=".$conexao["porta"].""; |
67 | $colunageo = $meta["colunageo"]; | 68 | $colunageo = $meta["colunageo"]; |
68 | $sqlColunaGeo = $meta["colunageo"]; | 69 | $sqlColunaGeo = $meta["colunageo"]; |
ms_configura.php
@@ -651,6 +651,10 @@ $postgis_mapa = array( | @@ -651,6 +651,10 @@ $postgis_mapa = array( | ||
651 | 651 | ||
652 | No exemplo, vc pode usar "teste" ou "conexao2" no seu mapfile veja em i3geo/temas/testesubstring.map | 652 | No exemplo, vc pode usar "teste" ou "conexao2" no seu mapfile veja em i3geo/temas/testesubstring.map |
653 | 653 | ||
654 | +A chave "metaestat" e utilizada pelo sistema de metadados estatisticos e indica o local onde as tabelas | ||
655 | +com os dados estatisticos estao armazenadas. Ate a versao 6.0, a definicao da conexao era feita por meio | ||
656 | +do banco de dados de administracao | ||
657 | + | ||
654 | Se vc não quiser usar essa substituição, deixe como está ou use | 658 | Se vc não quiser usar essa substituição, deixe como está ou use |
655 | 659 | ||
656 | $postgis_mapa = "" | 660 | $postgis_mapa = "" |
@@ -662,7 +666,7 @@ Tipo: | @@ -662,7 +666,7 @@ Tipo: | ||
662 | $postgis_mapa = array( | 666 | $postgis_mapa = array( |
663 | "teste"=>"user=postgres password=postgres dbname=teste host=localhost port=5432", | 667 | "teste"=>"user=postgres password=postgres dbname=teste host=localhost port=5432", |
664 | "postgres"=>"user=postgres password=postgres dbname=postgres host=localhost port=5432", | 668 | "postgres"=>"user=postgres password=postgres dbname=postgres host=localhost port=5432", |
665 | - "i3geosaude"=>"user=postgres password=postgres dbname=i3geosaude host=localhost port=5432 options='-c client_encoding=LATIN1'", | 669 | + "metaestat"=>"user=postgres password=postgres dbname=i3geosaude host=localhost port=5432 options='-c client_encoding=LATIN1'", |
666 | "i3geosaudeUtf"=>"user=postgres password=postgres dbname=i3geosaude host=localhost port=5432" | 670 | "i3geosaudeUtf"=>"user=postgres password=postgres dbname=i3geosaude host=localhost port=5432" |
667 | ); | 671 | ); |
668 | /* | 672 | /* |