Commit e514d4c1d453be0a9f4d09bfa887fd8637fb466b
1 parent
a112a114
Exists in
master
and in
7 other branches
Relatório do módulo de cadastro de variáveis
Showing
5 changed files
with
111 additions
and
3 deletions
Show diff stats
admin/html/estat_variavel.html
... | ... | @@ -13,6 +13,22 @@ body { |
13 | 13 | margin: 0; |
14 | 14 | padding: 0; |
15 | 15 | } |
16 | +.var_div_relatorio h1{ | |
17 | + font-size: 16px; | |
18 | +} | |
19 | +.var_div_relatorio h2{ | |
20 | + font-size: 12px; | |
21 | +} | |
22 | +.var_cor1 { | |
23 | + background-color: rgb(250,250,250); | |
24 | + width: 95%; | |
25 | + padding: 5px; | |
26 | +} | |
27 | +.var_cor2 { | |
28 | + background-color: rgb(220,220,220); | |
29 | + width: 95%; | |
30 | + padding: 5px; | |
31 | +} | |
16 | 32 | </style> |
17 | 33 | <script type="text/javascript" src="../js/core.js"></script> |
18 | 34 | <script type="text/javascript" src="../js/estat_variavel.js"></script> |
... | ... | @@ -37,7 +53,10 @@ body { |
37 | 53 | <div class="ft"></div> |
38 | 54 | </div> |
39 | 55 | <input onclick="adicionaLinha()" type=button id=adiciona |
40 | - value="Adicionar variável" /> <br> | |
56 | + value="Adicionar variável" /> | |
57 | + <input onclick="relatorioCompleto()" type=button id=relatorioCompleto | |
58 | + value="Relatório" /> | |
59 | + <br> | |
41 | 60 | <p>Variáveis cadastradas:</p> |
42 | 61 | <div id="tabela" style="left: -5px;"></div> |
43 | 62 | <div id=logajax style="display: block"></div> | ... | ... |
admin/js/estat_variavel.js
... | ... | @@ -40,6 +40,7 @@ Inicializa o editor |
40 | 40 | function initMenu(){ |
41 | 41 | listaDadosAuxiliares(); |
42 | 42 | ativaBotaoAdicionaVariavel("../php/metaestat.php?funcao=alteraVariavel","adiciona"); |
43 | + ativaBotaoRelatorioCompleto("../php/metaestat.php?funcao=relatorioCompleto","relatorioCompleto"); | |
43 | 44 | core_carregando("ativa"); |
44 | 45 | core_ativaPainelAjuda("ajuda","botaoAjuda"); |
45 | 46 | pegaVariaveis(); |
... | ... | @@ -66,6 +67,27 @@ function ativaBotaoAdicionaVariavel(sUrl,idBotao){ |
66 | 67 | //cria o botão de adição de um novo menu |
67 | 68 | new YAHOO.widget.Button(idBotao,{ onclick: { fn: adiciona } }); |
68 | 69 | } |
70 | +function ativaBotaoRelatorioCompleto(sUrl,idBotao){ | |
71 | + var adiciona = function(){ | |
72 | + core_carregando("ativa"); | |
73 | + core_carregando(" Aguarde"); | |
74 | + var callback = { | |
75 | + success:function(o){ | |
76 | + try { | |
77 | + core_carregando("desativa"); | |
78 | + var j = YAHOO.lang.JSON.parse(o.responseText); | |
79 | + core_montaEditor("","650px","500px","","Relatório"); | |
80 | + $i("editor_bd").innerHTML = j; | |
81 | + } | |
82 | + catch(e){core_handleFailure(e,o.responseText);} | |
83 | + }, | |
84 | + failure:core_handleFailure, | |
85 | + argument: { foo:"foo", bar:"bar" } | |
86 | + }; | |
87 | + core_makeRequest(sUrl,callback); | |
88 | + }; | |
89 | + new YAHOO.widget.Button(idBotao,{ onclick: { fn: adiciona } }); | |
90 | +} | |
69 | 91 | /* |
70 | 92 | Function: pegaVariaveis |
71 | 93 | ... | ... |
admin/php/admin.php
... | ... | @@ -39,6 +39,9 @@ if(!isset($locaplic)) |
39 | 39 | $locaplic = ""; |
40 | 40 | include(__DIR__."/../../ms_configura.php"); |
41 | 41 | } |
42 | +if(!file_exists($dir_tmp)){ | |
43 | + @mkdir ($dir_tmp,0777); | |
44 | +} | |
42 | 45 | include_once($locaplic."/classesphp/pega_variaveis.php"); |
43 | 46 | error_reporting(0); |
44 | 47 | // | ... | ... |
admin/php/classe_metaestat.php
... | ... | @@ -1020,5 +1020,61 @@ class Metaestat{ |
1020 | 1020 | $this->dbh = $dbhold; |
1021 | 1021 | return $res; |
1022 | 1022 | } |
1023 | + function relatorioCompleto(){ | |
1024 | + $dados = array(); | |
1025 | + $vs = $this->listaVariavel(); | |
1026 | + foreach($vs as $v){ | |
1027 | + $nivel1["id"] = $v["codigo_variavel"]; | |
1028 | + $nivel1["titulo"] = $v["nome"]; | |
1029 | + $nivel1["descricao"] = $v["descricao"]; | |
1030 | + $ms = $this->listaMedidaVariavel($v["codigo_variavel"]); | |
1031 | + foreach($ms as $m){ | |
1032 | + $nivel2["id"] = $m["id_medida_variavel"]; | |
1033 | + $nivel2["titulo"] = $m["nomemedida"]; | |
1034 | + $unidade = $this->listaUnidadeMedida($m["codigo_unidade_medida"]); | |
1035 | + $unidade = "Unidade de medida: ".$unidade["nome"]; | |
1036 | + $periodo = $this->listaTipoPeriodo($m["codigo_tipo_periodo"]); | |
1037 | + $periodo = "Período de tempo: ".$periodo["nome"]; | |
1038 | + $regiao = $this->listaTipoRegiao($m["codigo_tipo_regiao"]); | |
1039 | + $regiao = "Região: ".$regiao["nome_tipo_regiao"]; | |
1040 | + $nivel2["descricao"] = $unidade.", ".$periodo.", ".$regiao; | |
1041 | + $nivel2["fontes"] = $this->listaFonteinfoMedida($m["id_medida_variavel"]); | |
1042 | + $nivel2["links"] = $this->listaLinkMedida($m["id_medida_variavel"]); | |
1043 | + | |
1044 | + $nivel1["filho"] = $nivel2; | |
1045 | + } | |
1046 | + $dados[] = $nivel1; | |
1047 | + } | |
1048 | + return $dados; | |
1049 | + } | |
1050 | + function formataRelatorioHtml($dados){ | |
1051 | + $html = "<div class='var_div_relatorio'>"; | |
1052 | + $var_cor = "var_cor1"; | |
1053 | + foreach($dados as $variavel){ | |
1054 | + $html .= "<div class='".$var_cor."'>"; | |
1055 | + $html .= "<h1>".$variavel["titulo"]."</h1>"; | |
1056 | + $html .= "<p><i>".$variavel["descricao"]."</i></p>"; | |
1057 | + $f = $variavel["filho"]; | |
1058 | + $html .= "<h2>".$f["titulo"]."</h2>"; | |
1059 | + $html .= "<p><i>".$f["descricao"]."</i></p>"; | |
1060 | + $html .= "<p><b>Fontes:</b></p>"; | |
1061 | + foreach($f["fontes"] as $fonte){ | |
1062 | + $html .= "<p><a href='".$fonte["link"]."' >".$fonte["titulo"]."</a></p>"; | |
1063 | + } | |
1064 | + $html .= "<p><b>Links:</b></p>"; | |
1065 | + foreach($f["links"] as $link){ | |
1066 | + $html .= "<p><a href='".$link["link"]."' >".$link["nome"]."</a></p>"; | |
1067 | + } | |
1068 | + $html .= "</div>"; | |
1069 | + if($var_cor == "var_cor1"){ | |
1070 | + $var_cor = "var_cor2"; | |
1071 | + } | |
1072 | + else{ | |
1073 | + $var_cor = "var_cor1"; | |
1074 | + } | |
1075 | + } | |
1076 | + $html .= "</div>"; | |
1077 | + return $html; | |
1078 | + } | |
1023 | 1079 | } |
1024 | 1080 | ?> |
1025 | 1081 | \ No newline at end of file | ... | ... |
admin/php/metaestat.php
... | ... | @@ -740,7 +740,7 @@ switch (strtoupper($funcao)) |
740 | 740 | //$_REQUEST["service"] = "icon"; |
741 | 741 | include (__DIR__."/../../pacotes/kmlmapserver/classes/kmlserver.class.php"); |
742 | 742 | $server = new KmlServer(); |
743 | - }else{ | |
743 | + }else{//3d com tme | |
744 | 744 | if(!isset($dir_tmp)){ |
745 | 745 | include(__DIR__."/../../ms_configura.php"); |
746 | 746 | } |
... | ... | @@ -764,7 +764,8 @@ switch (strtoupper($funcao)) |
764 | 764 | 'classification' => 'equal', |
765 | 765 | 'mapTitle' => $r["titulolayer"], |
766 | 766 | 'timeType' => "slider", //para mais de um ano, escolha slider ou series |
767 | - 'dirtmp' => $dir_tmp | |
767 | + 'dirtmp' => $dir_tmp, | |
768 | + 'barSize'=> 5000 | |
768 | 769 | ); |
769 | 770 | include (__DIR__."/../../pacotes/tme/TME_i3geo.php"); |
770 | 771 | } |
... | ... | @@ -890,5 +891,12 @@ switch (strtoupper($funcao)) |
890 | 891 | } |
891 | 892 | exit; |
892 | 893 | break; |
894 | + case "RELATORIOCOMPLETO": | |
895 | + $m = new Metaestat(); | |
896 | + $dados = $m->relatorioCompleto(); | |
897 | + $dados = $m->formataRelatorioHtml($dados); | |
898 | + retornaJSON($dados); | |
899 | + exit; | |
900 | + break; | |
893 | 901 | } |
894 | 902 | ?> |
895 | 903 | \ No newline at end of file | ... | ... |