From c60682524473c8a9434eb11f908577619891e0d1 Mon Sep 17 00:00:00 2001 From: Edmar Moretti Date: Thu, 30 Jan 2014 18:55:51 +0000 Subject: [PATCH] $1 --- admin/php/classe_metaestat.php | 30 +++++++++++++++--------------- ferramentas/saiku/esquemaxml.php | 23 ++++++++++++++--------- 2 files changed, 29 insertions(+), 24 deletions(-) diff --git a/admin/php/classe_metaestat.php b/admin/php/classe_metaestat.php index 6f0e6ae..62201da 100755 --- a/admin/php/classe_metaestat.php +++ b/admin/php/classe_metaestat.php @@ -532,22 +532,22 @@ class Metaestat{ $query="select codigo_tipo_regiao_pai as parent from ".$this->esquemaadmin."i3geoestat_agregaregiao WHERE codigo_tipo_regiao = $node"; $result=$this->execSQL($query,"",false); $row = $result[0]; - // save the path in this array - $path = array(); - // only continue if this $node isn't the root node - // (that's the node with no parent) - if ($row['parent']!='') { - // the last part of the path to $node, is the name - // of the parent of $node - $path[] = $row['parent']; - // we should add the path to the parent of this node - // to the path - $path = array_merge($this->hierarquiaPath($row['parent']), $path); + // save the path in this array + $path = array(); + // only continue if this $node isn't the root node + // (that's the node with no parent) + if ($row['parent']!='') { + // the last part of the path to $node, is the name + // of the parent of $node + $path[] = $row['parent']; + // we should add the path to the parent of this node + // to the path + $path = array_merge($this->hierarquiaPath($row['parent']), $path); } // return the path sort($path); - return $path; - } + return $path; + } /** * Cria um arquivo mapfile para uma medida de variavel * Inclui no arquivo o layer de acesso aos dados @@ -799,7 +799,7 @@ class Metaestat{ $vis = str_replace(",,",",",$vis); $vis = explode(",",$vis); $itens = $vis;//array - $vis[] = "gid"; + $vis[] = $meta["identificador"]; $vis = array_unique($vis); $visiveis = array(); //verifica se as colunas existem mesmo @@ -825,7 +825,7 @@ class Metaestat{ $apelidos = array(); $vis = implode($colunastabela,","); } - $sqlf = $colunageo." from (select st_setsrid(".$colunageo.",".$srid.") as $colunageo,$vis from ".$meta["esquemadb"].".".$meta["tabela"]." /*FW*//*FW*/) as foo using unique gid using srid=".$srid; + $sqlf = $colunageo." from (select st_setsrid(".$colunageo.",".$srid.") as $colunageo,$vis from ".$meta["esquemadb"].".".$meta["tabela"]." /*FW*//*FW*/) as foo using unique ".$meta["identificador"]." using srid=".$srid; $sqlf = str_replace(",,",",",$sqlf); $outlinecolor = str_replace(","," ",$outlinecolor); $dados[] = "MAP"; diff --git a/ferramentas/saiku/esquemaxml.php b/ferramentas/saiku/esquemaxml.php index fbfcda7..20e7a80 100644 --- a/ferramentas/saiku/esquemaxml.php +++ b/ferramentas/saiku/esquemaxml.php @@ -87,14 +87,17 @@ for ($i=0;$i < $c;++$i){ } } if($codigo_tipo_regiao == ""){ - //echo "Nenhum tema com limites ou localidades foi encontrado"; - //exit; + $regioes = $m->listaTipoRegiao(); } +else{ + $regioes[] = $m->listaTipoRegiao($codigo_tipo_regiao); +} + $regiao = ""; $item = ""; $registros = ""; -$regioes = $m->listaTipoRegiao(); + $xml = ""; //cria as dimensoes de tipo temporal $sqlAno = "select nu_ano from ".$saikuConfigDataSource['tabelaDimensaoTempo']." group by nu_ano order by nu_ano"; @@ -239,12 +242,14 @@ $medidas = $m->listaMedidaVariavel(); $tbs = array(); foreach($medidas as $medida){ - $k = $medida["esquemadb"].$medida["tabela"]; - if(empty($tbs[$k])){ - $tbs[$k] = array($medida); - } - else{ - array_push($tbs[$k],$medida); + if($medida["codigo_tipo_regiao"] == $codigo_tipo_regiao){ + $k = $medida["esquemadb"].$medida["tabela"]; + if(empty($tbs[$k])){ + $tbs[$k] = array($medida); + } + else{ + array_push($tbs[$k],$medida); + } } } -- libgit2 0.21.2