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