Commit d7bdc5762b3f70a17383faddef1d7064101e6d15
1 parent
7b4f8c03
Exists in
master
Correção nas ferramentas de busca por atributos
Showing
3 changed files
with
27 additions
and
42 deletions
Show diff stats
classesphp/classe_atributos.php
| ... | ... | @@ -661,25 +661,22 @@ class Atributos |
| 661 | 661 | { |
| 662 | 662 | //error_reporting(0); |
| 663 | 663 | $resultado = array(); |
| 664 | - if ($onde == "mapa") | |
| 665 | - { | |
| 664 | + if ($onde == "mapa"){ | |
| 666 | 665 | $this->mapa = extPadrao($this->mapa); |
| 667 | 666 | } |
| 668 | - $ptvs = explode(",",$lista); | |
| 667 | + $ptvs = explode("|",$lista); | |
| 669 | 668 | //monta a lista de temas que serao utilizados |
| 670 | - foreach ($ptvs as $p) | |
| 671 | - { | |
| 672 | - $pp = explode(";",$p); | |
| 669 | + foreach ($ptvs as $p){ | |
| 670 | + $pp = explode(",",$p); | |
| 673 | 671 | $temas[] = $pp[1]; |
| 674 | 672 | } |
| 675 | 673 | $temas = array_unique($temas); |
| 676 | 674 | //monta a lista de itens por tema |
| 677 | - foreach ($temas as $tema) | |
| 678 | - { | |
| 675 | + foreach ($temas as $tema){ | |
| 679 | 676 | $temp = array(); |
| 680 | 677 | foreach ($ptvs as $p) |
| 681 | 678 | { |
| 682 | - $pp = explode(";",$p); | |
| 679 | + $pp = explode(",",$p); | |
| 683 | 680 | if ($pp[1] == $tema) |
| 684 | 681 | { |
| 685 | 682 | $temp[] = $pp[0]; |
| ... | ... | @@ -689,30 +686,26 @@ class Atributos |
| 689 | 686 | } |
| 690 | 687 | $encontrado = "nao"; |
| 691 | 688 | $palavra = trim($palavra); |
| 692 | - foreach ($temas as $tema) | |
| 693 | - { | |
| 689 | + foreach ($temas as $tema){ | |
| 694 | 690 | $registros = array(); |
| 695 | 691 | $items = $temasi[$tema]; |
| 696 | 692 | $l = $this->mapa->getlayerbyname($tema); |
| 697 | 693 | $this->layer = $l; |
| 698 | 694 | $l->set("template","none.htm"); |
| 699 | - if ($l->data == "") | |
| 700 | - { | |
| 695 | + if ($l->data == ""){ | |
| 701 | 696 | return "Erro. O tema não tem tabela"; |
| 702 | 697 | } |
| 703 | - if(strtoupper($l->getmetadata("convcaracter")) == "NAO") | |
| 704 | - { | |
| 698 | + if(strtoupper($l->getmetadata("convcaracter")) == "NAO"){ | |
| 705 | 699 | $convC = false; |
| 706 | 700 | } |
| 707 | - else | |
| 708 | - {$convC = true; | |
| 701 | + else{ | |
| 702 | + $convC = true; | |
| 709 | 703 | } |
| 710 | 704 | $filtro = $l->getfilterstring(); |
| 711 | 705 | if ($filtro != ""){ |
| 712 | 706 | $l->setfilter(""); |
| 713 | 707 | } |
| 714 | 708 | $b = "ÁÃÕÓÔáãâàóõôòúûíêéç"; |
| 715 | - | |
| 716 | 709 | $trocas = "AAOOOaaaaoooouuieecAAOOOaaaaoooouuieecAAOOOaaaaoooouuieec"; |
| 717 | 710 | $buscas = b.(html_entity_decode($b,ENT_NOQUOTES,'UTF8')).(html_entity_decode($b,ENT_NOQUOTES,'ISO8859-1')); |
| 718 | 711 | $sopen = $l->open(); |
| ... | ... | @@ -722,8 +715,7 @@ class Atributos |
| 722 | 715 | $prjMapa = $this->mapa->getProjection(); |
| 723 | 716 | $prjTema = $l->getProjection(); |
| 724 | 717 | $ret = $this->mapa->extent; |
| 725 | - if (($prjTema != "") && ($prjMapa != $prjTema)) | |
| 726 | - { | |
| 718 | + if (($prjTema != "") && ($prjMapa != $prjTema)) { | |
| 727 | 719 | $projInObj = ms_newprojectionobj($prjTema); |
| 728 | 720 | $projOutObj = ms_newprojectionobj($prjMapa); |
| 729 | 721 | $status = $ret->project($projInObj, $projOutObj); |
| ... | ... | @@ -731,12 +723,11 @@ class Atributos |
| 731 | 723 | $ret = $this->mapa->extent; |
| 732 | 724 | } |
| 733 | 725 | } |
| 726 | + | |
| 734 | 727 | $fr = array(); |
| 735 | - if (@$l->queryByrect($ret) == MS_SUCCESS) | |
| 736 | - { | |
| 728 | + if (@$l->queryByrect($ret) == MS_SUCCESS){ | |
| 737 | 729 | $res_count = $l->getNumresults(); |
| 738 | - for ($i = 0; $i < $res_count; ++$i) | |
| 739 | - { | |
| 730 | + for ($i = 0; $i < $res_count; ++$i) { | |
| 740 | 731 | $valitem = array(); |
| 741 | 732 | if($this->v == 6){ |
| 742 | 733 | $shape = $l->getShape($l->getResult($i)); |
| ... | ... | @@ -749,11 +740,9 @@ class Atributos |
| 749 | 740 | } |
| 750 | 741 | $novoreg = array(); |
| 751 | 742 | $r = array(); |
| 752 | - foreach ($items as $item) | |
| 753 | - { | |
| 743 | + foreach ($items as $item){ | |
| 754 | 744 | $v = trim($shape->values[$item]); |
| 755 | - if ($tipo == "exata") | |
| 756 | - { | |
| 745 | + if ($tipo == "exata"){ | |
| 757 | 746 | if ($v == $palavra || (strtr($v,$buscas,$trocas) == strtr($palavra,$buscas,$trocas))) |
| 758 | 747 | { |
| 759 | 748 | if($convC == true) |
| ... | ... | @@ -764,11 +753,8 @@ class Atributos |
| 764 | 753 | $encontrado = "sim"; |
| 765 | 754 | } |
| 766 | 755 | } |
| 767 | - else | |
| 768 | - { | |
| 769 | - | |
| 770 | - if (strtolower($v) == strtolower($palavra) || (stristr(strtr(strtolower($v),$buscas,$trocas),strtr(strtolower($palavra),$buscas,$trocas)))) | |
| 771 | - { | |
| 756 | + else{ | |
| 757 | + if (strtolower($v) == strtolower($palavra) || (stristr(strtr(strtolower($v),$buscas,$trocas),strtr(strtolower($palavra),$buscas,$trocas)))){ | |
| 772 | 758 | if($convC == true){ |
| 773 | 759 | $v = $this->converte($v); |
| 774 | 760 | } |
| ... | ... | @@ -777,11 +763,9 @@ class Atributos |
| 777 | 763 | } |
| 778 | 764 | } |
| 779 | 765 | } |
| 780 | - if ($encontrado == "sim") | |
| 781 | - { | |
| 766 | + if ($encontrado == "sim"){ | |
| 782 | 767 | $ret = $this->extensaoShape($shape,$l); |
| 783 | - if (($prjTema != "") && ($prjMapa != $prjTema)) | |
| 784 | - { | |
| 768 | + if (($prjTema != "") && ($prjMapa != $prjTema)){ | |
| 785 | 769 | $ret->project($projInObj, $projOutObj); |
| 786 | 770 | } |
| 787 | 771 | $novoreg["box"] = $ret; | ... | ... |
classesphp/classe_mapa.php
| ... | ... | @@ -145,10 +145,10 @@ class Mapa |
| 145 | 145 | { |
| 146 | 146 | $metadata = $l->getmetadata("itembuscarapida"); |
| 147 | 147 | if($metadata != ""){ |
| 148 | - $lista[] = $metadata.";".$l->name; | |
| 148 | + $lista[] = $metadata.",".$l->name; | |
| 149 | 149 | } |
| 150 | 150 | } |
| 151 | - return implode(",",$lista); | |
| 151 | + return implode("|",$lista); | |
| 152 | 152 | } |
| 153 | 153 | /* |
| 154 | 154 | Method: mudaoutputformat | ... | ... |
ferramentas/busca/index.js
| ... | ... | @@ -179,7 +179,7 @@ i3GEOF.busca = { |
| 179 | 179 | ins += ("<table class=lista >"); |
| 180 | 180 | n = retorno.data.valores.length; |
| 181 | 181 | for (i=0;i<n; i++){ |
| 182 | - ins += "<tr><td><input size=2 style='cursor:pointer;border:0px solid white;' name='"+retorno.data.valores[i].item+";"+retorno.data.valores[i].tema+"' type=checkbox /></td>"; | |
| 182 | + ins += "<tr><td><input size=2 style='cursor:pointer;border:0px solid white;' name='"+retorno.data.valores[i].item+","+retorno.data.valores[i].tema+"' type=checkbox /></td>"; | |
| 183 | 183 | ins += "<td> "+retorno.data.valores[i].item+" - "+retorno.data.valores[i].tema+"</td></tr>"; |
| 184 | 184 | } |
| 185 | 185 | ins += "</table>"; |
| ... | ... | @@ -229,10 +229,11 @@ i3GEOF.busca = { |
| 229 | 229 | if ($i("i3GEObuscaregiao").checked === true) |
| 230 | 230 | {onde = "regiao";} |
| 231 | 231 | palavra = i3GEO.util.removeAcentos(palavra); |
| 232 | - p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=listavaloresitens&palavra="+palavra+"&lista="+listai.toString()+"&tipo="+tipo+"&onde="+onde+"&ext="+i3GEO.parametros.mapexten; | |
| 232 | + p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid; | |
| 233 | 233 | cp = new cpaint(); |
| 234 | 234 | cp.set_response_type("json"); |
| 235 | - cp.call(p,"listavaloresitens",i3GEOF.busca.mostraBusca); | |
| 235 | + cp.set_transfer_mode('POST'); | |
| 236 | + cp.call(p,"listavaloresitens",i3GEOF.busca.mostraBusca,"funcao=listavaloresitens","palavra="+palavra,"lista="+listai.toString(),"tipo="+tipo,"onde="+onde,"ext="+i3GEO.parametros.mapexten); | |
| 236 | 237 | } |
| 237 | 238 | } |
| 238 | 239 | }, | ... | ... |