Commit 6485ca2a276cfccb411cf911b08f3f9d06b3350e
1 parent
1057f2b4
Exists in
master
and in
7 other branches
--no commit message
Showing
3 changed files
with
63 additions
and
6 deletions
Show diff stats
admin/js/estat_variavel.js
| ... | ... | @@ -559,7 +559,7 @@ function montaDivMedidaVariavel(i){ |
| 559 | 559 | } |
| 560 | 560 | } |
| 561 | 561 | function montaDivParametroMedida(i){ |
| 562 | - var temp,ins = "", | |
| 562 | + var ins = "", | |
| 563 | 563 | param = { |
| 564 | 564 | "linhas":[ |
| 565 | 565 | {titulo:"Nome:",id:"Enome",size:"50",value:i.nome,tipo:"text",div:""}, |
| ... | ... | @@ -840,10 +840,12 @@ function sql(tipo,id) { |
| 840 | 840 | ins +="<p>Codigo da classificação que será usada para mostrar o mapa<br>"; |
| 841 | 841 | ins += "<input type=text value='' id='classificacao' />"; |
| 842 | 842 | ins += ' <p><input type=button id="sqljson" value="JSON" />'; |
| 843 | + ins += ' <input type=button id="xmlestat" value="XML" />'; | |
| 843 | 844 | ins += ' <input type=button id="sumarioestat" value="Sumário" />'; |
| 845 | + ins += ' <input type=button id="sumarioxmlestat" value="Sumário XML" />'; | |
| 844 | 846 | ins += ' <input type=button id="graficoestat" value="Gráfico" />'; |
| 845 | - ins += ' <input type=button id="mapfileestat" value="Mapfile" />'; | |
| 846 | - ins += ' <input type=button id="i3geoestat" value="i3Geo" /><br><br>'; | |
| 847 | + ins += ' <input type=button id="mapfileestat" value="Mapfile" /><br><br>'; | |
| 848 | + ins += ' <input type=button id="i3geoestat" value="i3Geo" />'; | |
| 847 | 849 | ins += ' <input type=button id="kmzestat" value="Kmz (vetorial)" />'; |
| 848 | 850 | ins += ' <input type=button id="kmlestat" value="Kml (wms)" />'; |
| 849 | 851 | ins += ' <input type=button id="kml3destat" value="Kml 3d" />'; |
| ... | ... | @@ -859,12 +861,28 @@ function sql(tipo,id) { |
| 859 | 861 | $i("ultimaUrl").innerHTML = u; |
| 860 | 862 | window.open(u); |
| 861 | 863 | }; |
| 864 | + new YAHOO.widget.Button("xmlestat"); | |
| 865 | + document.getElementById("xmlestat-button").onclick = function(){ | |
| 866 | + var u,colunas = 0; | |
| 867 | + if($i("incluirtodascolunas").checked === true){ | |
| 868 | + colunas = 1; | |
| 869 | + } | |
| 870 | + u = i3GEO.configura.locaplic+'/admin/php/metaestat.php?funcao=dadosMedidaVariavel&formato=xml&id_medida_variavel='+id+"&filtro="+$i("filtrosql").value+"&todasascolunas="+colunas+"&agruparpor="+$i("agruparsql").value; | |
| 871 | + $i("ultimaUrl").innerHTML = u; | |
| 872 | + window.open(u); | |
| 873 | + }; | |
| 862 | 874 | new YAHOO.widget.Button("sumarioestat"); |
| 863 | 875 | $i("sumarioestat-button").onclick = function(){ |
| 864 | 876 | var u = i3GEO.configura.locaplic+'/admin/php/metaestat.php?funcao=sumarioMedidaVariavel&formato=json&id_medida_variavel='+id+"&agruparpor="+$i("agruparsql").value+"&filtro="+$i("filtrosql").value; |
| 865 | 877 | $i("ultimaUrl").innerHTML = u; |
| 866 | 878 | window.open(u); |
| 867 | 879 | }; |
| 880 | + new YAHOO.widget.Button("sumarioxmlestat"); | |
| 881 | + $i("sumarioxmlestat-button").onclick = function(){ | |
| 882 | + var u = i3GEO.configura.locaplic+'/admin/php/metaestat.php?funcao=sumarioMedidaVariavel&formato=xml&id_medida_variavel='+id+"&agruparpor="+$i("agruparsql").value+"&filtro="+$i("filtrosql").value; | |
| 883 | + $i("ultimaUrl").innerHTML = u; | |
| 884 | + window.open(u); | |
| 885 | + }; | |
| 868 | 886 | new YAHOO.widget.Button("mapfileestat"); |
| 869 | 887 | $i("mapfileestat-button").onclick = function(){ |
| 870 | 888 | var u,colunas = 0; | ... | ... |
admin/php/classe_metaestat.php
| ... | ... | @@ -1047,6 +1047,7 @@ class Metaestat{ |
| 1047 | 1047 | } |
| 1048 | 1048 | return $dados; |
| 1049 | 1049 | } |
| 1050 | + //$dados vem de relatorioCompleto | |
| 1050 | 1051 | function formataRelatorioHtml($dados){ |
| 1051 | 1052 | $html = "<div class='var_div_relatorio'>"; |
| 1052 | 1053 | $var_cor = "var_cor1"; |
| ... | ... | @@ -1076,5 +1077,32 @@ class Metaestat{ |
| 1076 | 1077 | $html .= "</div>"; |
| 1077 | 1078 | return $html; |
| 1078 | 1079 | } |
| 1080 | + function formataXML($dados){ | |
| 1081 | + $chaves = array_keys($dados[0]); | |
| 1082 | + if(count($chaves) == 0){ | |
| 1083 | + $chaves = false; | |
| 1084 | + } | |
| 1085 | + $xml = "<"."\x3F"."xml version='1.0' encoding='UTF-8' "."\x3F".">" . PHP_EOL; | |
| 1086 | + $xml .= '<result-set>' . PHP_EOL; | |
| 1087 | + if($chaves){ | |
| 1088 | + foreach($dados as $d){ | |
| 1089 | + $xml .= "<row>" . PHP_EOL; | |
| 1090 | + foreach($chaves as $c){ | |
| 1091 | + $xml .= "<".$c.">".$d[$c]."</".$c.">" . PHP_EOL; | |
| 1092 | + } | |
| 1093 | + $xml .= "</row>" . PHP_EOL; | |
| 1094 | + } | |
| 1095 | + } | |
| 1096 | + else{ | |
| 1097 | + while (list($key, $val) = each($dados)) { | |
| 1098 | + $xml .= "<row>" . PHP_EOL; | |
| 1099 | + $xml .= "<nome>".$key."</nome>" . PHP_EOL; | |
| 1100 | + $xml .= "<valor>".$val."</valor>" . PHP_EOL; | |
| 1101 | + $xml .= "</row>" . PHP_EOL; | |
| 1102 | + } | |
| 1103 | + } | |
| 1104 | + $xml .= '</result-set>' . PHP_EOL; | |
| 1105 | + return $xml; | |
| 1106 | + } | |
| 1079 | 1107 | } |
| 1080 | 1108 | ?> |
| 1081 | 1109 | \ No newline at end of file | ... | ... |
admin/php/metaestat.php
| ... | ... | @@ -665,7 +665,8 @@ switch (strtoupper($funcao)) |
| 665 | 665 | */ |
| 666 | 666 | case "SQLMEDIDAVARIAVEL": |
| 667 | 667 | $m = new Metaestat(); |
| 668 | - retornaJSON($m->sqlMedidaVariavel($id_medida_variavel)); | |
| 668 | + $dados = $m->sqlMedidaVariavel($id_medida_variavel); | |
| 669 | + retornaJSON($dados); | |
| 669 | 670 | exit; |
| 670 | 671 | break; |
| 671 | 672 | /* |
| ... | ... | @@ -689,8 +690,13 @@ switch (strtoupper($funcao)) |
| 689 | 690 | */ |
| 690 | 691 | case "DADOSMEDIDAVARIAVEL": |
| 691 | 692 | $m = new Metaestat(); |
| 693 | + $dados = $m->dadosMedidaVariavel($id_medida_variavel,$filtro,$todasascolunas,$agruparpor); | |
| 692 | 694 | if($formato == "json"){ |
| 693 | - retornaJSON($m->dadosMedidaVariavel($id_medida_variavel,$filtro,$todasascolunas,$agruparpor)); | |
| 695 | + retornaJSON($dados); | |
| 696 | + } | |
| 697 | + if($formato == "xml"){ | |
| 698 | + header("Content-type: application/xml"); | |
| 699 | + echo($m->formataXML($dados)); | |
| 694 | 700 | } |
| 695 | 701 | exit; |
| 696 | 702 | break; |
| ... | ... | @@ -789,8 +795,13 @@ switch (strtoupper($funcao)) |
| 789 | 795 | */ |
| 790 | 796 | case "SUMARIOMEDIDAVARIAVEL": |
| 791 | 797 | $m = new Metaestat(); |
| 798 | + $dados = $m->sumarioMedidaVariavel($id_medida_variavel,$filtro,$agruparpor); | |
| 792 | 799 | if($formato == "json"){ |
| 793 | - retornaJSON($m->sumarioMedidaVariavel($id_medida_variavel,$filtro,$agruparpor)); | |
| 800 | + retornaJSON($dados); | |
| 801 | + } | |
| 802 | + if($formato == "xml"){ | |
| 803 | + header("Content-type: application/xml"); | |
| 804 | + echo($m->formataXML($dados["grupos"])); | |
| 794 | 805 | } |
| 795 | 806 | exit; |
| 796 | 807 | break; | ... | ... |