Commit d7f1591c7545b1caf85714a28ff78600da7f5376
1 parent
03629e2e
Exists in
master
and in
7 other branches
Cmplementação dos relatórios da lsita de variáveis no sistema METAESTAT
Showing
5 changed files
with
54 additions
and
29 deletions
Show diff stats
admin/admin.db
No preview for this file type
admin/js/core.js
| @@ -921,8 +921,12 @@ function core_menuCheckBox(valores,textos,selecionados,target,record,key,unico){ | @@ -921,8 +921,12 @@ function core_menuCheckBox(valores,textos,selecionados,target,record,key,unico){ | ||
| 921 | } | 921 | } |
| 922 | function on_menuCheckBoxChange(p_oEvent){ | 922 | function on_menuCheckBoxChange(p_oEvent){ |
| 923 | var cks,i, | 923 | var cks,i, |
| 924 | - ins = []; | ||
| 925 | - if(p_oEvent.newValue.get("value") == "OK") { | 924 | + ins = [], |
| 925 | + status = "OK"; | ||
| 926 | + if(p_oEvent && p_oEvent.newValue){ | ||
| 927 | + status = p_oEvent.newValue.get("value"); | ||
| 928 | + } | ||
| 929 | + if(status == "OK") { | ||
| 926 | cks = $i("core_menuCK_bd").getElementsByTagName("input"); | 930 | cks = $i("core_menuCK_bd").getElementsByTagName("input"); |
| 927 | ins = []; | 931 | ins = []; |
| 928 | for (i=0;i<cks.length;i++){ | 932 | for (i=0;i<cks.length;i++){ |
| @@ -949,6 +953,7 @@ function core_menuCheckBox(valores,textos,selecionados,target,record,key,unico){ | @@ -949,6 +953,7 @@ function core_menuCheckBox(valores,textos,selecionados,target,record,key,unico){ | ||
| 949 | ndiv.className= "yui-dt-editor"; | 953 | ndiv.className= "yui-dt-editor"; |
| 950 | ndiv.style.backgroundColor = "white"; | 954 | ndiv.style.backgroundColor = "white"; |
| 951 | ndiv.style.height = "144px"; | 955 | ndiv.style.height = "144px"; |
| 956 | + ndiv.style.width = "100%"; | ||
| 952 | ndiv.style.overflow = "auto"; | 957 | ndiv.style.overflow = "auto"; |
| 953 | ndiv.innerHTML = "<div id='core_botoesCabecalho' ></div><br>" + | 958 | ndiv.innerHTML = "<div id='core_botoesCabecalho' ></div><br>" + |
| 954 | "<div id='core_menuCK_bd' style='background:white;text-align:left;border:1px solid gray'></div>"; | 959 | "<div id='core_menuCK_bd' style='background:white;text-align:left;border:1px solid gray'></div>"; |
| @@ -960,7 +965,7 @@ function core_menuCheckBox(valores,textos,selecionados,target,record,key,unico){ | @@ -960,7 +965,7 @@ function core_menuCheckBox(valores,textos,selecionados,target,record,key,unico){ | ||
| 960 | { label: "Fecha", value: "CANCEL", checked: false } | 965 | { label: "Fecha", value: "CANCEL", checked: false } |
| 961 | ]); | 966 | ]); |
| 962 | og_core.on("checkedButtonChange", on_menuCheckBoxChange); | 967 | og_core.on("checkedButtonChange", on_menuCheckBoxChange); |
| 963 | - YAHOO.admin.container.panelCK = new YAHOO.widget.Panel("core_menuCK", { draggable:false,modal:true,zindex:"100",close:false,underlay:false,width:"168px", height:"158px",overflow:"auto", visible:false,constraintoviewport:false } ); | 968 | + YAHOO.admin.container.panelCK = new YAHOO.widget.Panel("core_menuCK", { draggable:false,modal:true,zindex:"100",close:false,underlay:false,width:"200px", height:"158px",overflow:"auto", visible:false,constraintoviewport:false } ); |
| 964 | YAHOO.admin.container.panelCK.render(); | 969 | YAHOO.admin.container.panelCK.render(); |
| 965 | } | 970 | } |
| 966 | onde = $i("core_menuCK_bd"); | 971 | onde = $i("core_menuCK_bd"); |
| @@ -968,20 +973,22 @@ function core_menuCheckBox(valores,textos,selecionados,target,record,key,unico){ | @@ -968,20 +973,22 @@ function core_menuCheckBox(valores,textos,selecionados,target,record,key,unico){ | ||
| 968 | onde.innerHTML = ""; | 973 | onde.innerHTML = ""; |
| 969 | for (i=0;i<valores.length;i++){ | 974 | for (i=0;i<valores.length;i++){ |
| 970 | novoCK = document.createElement("div"); | 975 | novoCK = document.createElement("div"); |
| 976 | + novoCK.onclick = on_menuCheckBoxChange; | ||
| 971 | ck = ""; | 977 | ck = ""; |
| 972 | for(j=0;j<selecionados.length;j++){ | 978 | for(j=0;j<selecionados.length;j++){ |
| 973 | if(selecionados[j] == valores[i]) | 979 | if(selecionados[j] == valores[i]) |
| 974 | ck = "CHECKED"; | 980 | ck = "CHECKED"; |
| 975 | } | 981 | } |
| 976 | if(unico === "nao"){ | 982 | if(unico === "nao"){ |
| 977 | - ins.push("<input type=checkbox id='CK_"+valores[i]+"' value='"+valores[i]+"' "+ck+" />"+textos[i]+"<br>"); | 983 | + ins.push("<input style='cursor:pointer;' type=checkbox id='CK_"+valores[i]+"' value='"+valores[i]+"' "+ck+" />"+textos[i]+"<br>"); |
| 978 | } | 984 | } |
| 979 | else{ | 985 | else{ |
| 980 | - ins.push("<input style='position:relative;top:2px;' type=radio name=escolha_core_menuCheckBox id='CK_"+valores[i]+"' value='"+valores[i]+"' "+ck+" />"+textos[i]+"<br>"); | 986 | + ins.push("<input style='position:relative;top:2px;cursor:pointer;' type=radio name=escolha_core_menuCheckBox id='CK_"+valores[i]+"' value='"+valores[i]+"' "+ck+" />"+textos[i]+"<br>"); |
| 981 | } | 987 | } |
| 982 | } | 988 | } |
| 983 | ins.push("<br>"); | 989 | ins.push("<br>"); |
| 984 | novoCK.innerHTML = ins.join(" "); | 990 | novoCK.innerHTML = ins.join(" "); |
| 991 | + novoCK.style.width = "100%"; | ||
| 985 | onde.appendChild(novoCK); | 992 | onde.appendChild(novoCK); |
| 986 | YAHOO.admin.container.panelCK.moveTo(YAHOO.util.Dom.getX(target),YAHOO.util.Dom.getY(target)); | 993 | YAHOO.admin.container.panelCK.moveTo(YAHOO.util.Dom.getX(target),YAHOO.util.Dom.getY(target)); |
| 987 | YAHOO.admin.container.panelCK.show(); | 994 | YAHOO.admin.container.panelCK.show(); |
admin/js/estat_variavel.js
| @@ -61,7 +61,7 @@ i3GEOadmin.variaveis = { | @@ -61,7 +61,7 @@ i3GEOadmin.variaveis = { | ||
| 61 | if(!$i(idBotao)){ | 61 | if(!$i(idBotao)){ |
| 62 | return; | 62 | return; |
| 63 | } | 63 | } |
| 64 | - var sUrl = i3GEO.configura.locaplic+"/admin/php/metaestat.php?funcao=relatorioCompleto", | 64 | + var sUrl = i3GEO.configura.locaplic+"/admin/php/metaestat.php?funcao=relatorioCompleto&dadosGerenciais=sim", |
| 65 | adiciona = function(){ | 65 | adiciona = function(){ |
| 66 | core_carregando("ativa"); | 66 | core_carregando("ativa"); |
| 67 | core_carregando(" Aguarde"); | 67 | core_carregando(" Aguarde"); |
admin/php/classe_metaestat.php
| @@ -1423,11 +1423,10 @@ class Metaestat{ | @@ -1423,11 +1423,10 @@ class Metaestat{ | ||
| 1423 | function descreveColunasTabela($codigo_estat_conexao,$nome_esquema,$nome_tabela){ | 1423 | function descreveColunasTabela($codigo_estat_conexao,$nome_esquema,$nome_tabela){ |
| 1424 | return $this->execSQLDB($codigo_estat_conexao,"SELECT a.attnum,a.attname AS field,t.typname AS type,a.attlen AS length,a.atttypmod AS lengthvar,a.attnotnull AS notnull,p.nspname as esquema FROM pg_class c,pg_attribute a,pg_type t,pg_namespace p WHERE c.relname = '$nome_tabela' and p.nspname = '$nome_esquema' and a.attnum > 0 and a.attrelid = c.oid and a.atttypid = t.oid and c.relnamespace = p.oid ORDER BY a.attname"); | 1424 | return $this->execSQLDB($codigo_estat_conexao,"SELECT a.attnum,a.attname AS field,t.typname AS type,a.attlen AS length,a.atttypmod AS lengthvar,a.attnotnull AS notnull,p.nspname as esquema FROM pg_class c,pg_attribute a,pg_type t,pg_namespace p WHERE c.relname = '$nome_tabela' and p.nspname = '$nome_esquema' and a.attnum > 0 and a.attrelid = c.oid and a.atttypid = t.oid and c.relnamespace = p.oid ORDER BY a.attname"); |
| 1425 | } | 1425 | } |
| 1426 | - function relatorioCompleto($codigo_variavel=""){ | 1426 | + function relatorioCompleto($codigo_variavel="",$dadosGerenciais="nao"){ |
| 1427 | $dados = array(); | 1427 | $dados = array(); |
| 1428 | - | ||
| 1429 | if($codigo_variavel != "" || !empty($codigo_variavel)){ | 1428 | if($codigo_variavel != "" || !empty($codigo_variavel)){ |
| 1430 | - $vs[] = $this->listaVariavel($codigo_variavel);; | 1429 | + $vs[] = $this->listaVariavel($codigo_variavel); |
| 1431 | } | 1430 | } |
| 1432 | else{ | 1431 | else{ |
| 1433 | $vs = $this->listaVariavel(); | 1432 | $vs = $this->listaVariavel(); |
| @@ -1437,6 +1436,7 @@ class Metaestat{ | @@ -1437,6 +1436,7 @@ class Metaestat{ | ||
| 1437 | $nivel1["titulo"] = $v["nome"]; | 1436 | $nivel1["titulo"] = $v["nome"]; |
| 1438 | $nivel1["descricao"] = $v["descricao"]; | 1437 | $nivel1["descricao"] = $v["descricao"]; |
| 1439 | $ms = $this->listaMedidaVariavel($v["codigo_variavel"]); | 1438 | $ms = $this->listaMedidaVariavel($v["codigo_variavel"]); |
| 1439 | + $nivel1["filhos"] = array(); | ||
| 1440 | foreach($ms as $m){ | 1440 | foreach($ms as $m){ |
| 1441 | $nivel2["id"] = $m["id_medida_variavel"]; | 1441 | $nivel2["id"] = $m["id_medida_variavel"]; |
| 1442 | $nivel2["titulo"] = $m["nomemedida"]; | 1442 | $nivel2["titulo"] = $m["nomemedida"]; |
| @@ -1449,7 +1449,11 @@ class Metaestat{ | @@ -1449,7 +1449,11 @@ class Metaestat{ | ||
| 1449 | $nivel2["descricao"] = $unidade.", ".$periodo.", ".$regiao; | 1449 | $nivel2["descricao"] = $unidade.", ".$periodo.", ".$regiao; |
| 1450 | $nivel2["fontes"] = $this->listaFonteinfoMedida($m["id_medida_variavel"]); | 1450 | $nivel2["fontes"] = $this->listaFonteinfoMedida($m["id_medida_variavel"]); |
| 1451 | $nivel2["links"] = $this->listaLinkMedida($m["id_medida_variavel"]); | 1451 | $nivel2["links"] = $this->listaLinkMedida($m["id_medida_variavel"]); |
| 1452 | - $nivel1["filho"] = $nivel2; | 1452 | + $nivel2["dadosgerenciais"] = ""; |
| 1453 | + if($dadosGerenciais == "sim"){ | ||
| 1454 | + $nivel2["dadosgerenciais"] = $m; | ||
| 1455 | + } | ||
| 1456 | + $nivel1["filhos"][] = $nivel2; | ||
| 1453 | } | 1457 | } |
| 1454 | $dados[] = $nivel1; | 1458 | $dados[] = $nivel1; |
| 1455 | } | 1459 | } |
| @@ -1457,24 +1461,38 @@ class Metaestat{ | @@ -1457,24 +1461,38 @@ class Metaestat{ | ||
| 1457 | } | 1461 | } |
| 1458 | //$dados vem de relatorioCompleto | 1462 | //$dados vem de relatorioCompleto |
| 1459 | function formataRelatorioHtml($dados){ | 1463 | function formataRelatorioHtml($dados){ |
| 1460 | - $html = "<div class='var_div_relatorio'>"; | 1464 | + $html[] = "<div class='var_div_relatorio'>"; |
| 1461 | $var_cor = "var_cor1"; | 1465 | $var_cor = "var_cor1"; |
| 1462 | foreach($dados as $variavel){ | 1466 | foreach($dados as $variavel){ |
| 1463 | - $html .= "<div class='".$var_cor."'>"; | ||
| 1464 | - $html .= "<h1>".$variavel["titulo"]."</h1>"; | ||
| 1465 | - $html .= "<p><i>".$variavel["descricao"]."</i></p>"; | ||
| 1466 | - $f = $variavel["filho"]; | ||
| 1467 | - $html .= "<h2>".$f["titulo"]."</h2>"; | ||
| 1468 | - $html .= "<p><i>".$f["descricao"]."</i></p>"; | ||
| 1469 | - $html .= "<p><b>Fontes:</b></p>"; | ||
| 1470 | - foreach($f["fontes"] as $fonte){ | ||
| 1471 | - $html .= "<p><a href='".$fonte["link"]."' >".$fonte["titulo"]."</a></p>"; | ||
| 1472 | - } | ||
| 1473 | - $html .= "<p><b>Links:</b></p>"; | ||
| 1474 | - foreach($f["links"] as $link){ | ||
| 1475 | - $html .= "<p><a href='".$link["link"]."' >".$link["nome"]."</a></p>"; | ||
| 1476 | - } | ||
| 1477 | - $html .= "</div>"; | 1467 | + $html[] = "<div class='".$var_cor."'>"; |
| 1468 | + $html[] = "<h1>".$variavel["titulo"]."</h1>"; | ||
| 1469 | + $html[] = "<p><i>".$variavel["descricao"]."</i></p>"; | ||
| 1470 | + $filhos = $variavel["filhos"]; | ||
| 1471 | + foreach($filhos as $f){ | ||
| 1472 | + $html[] = "<h2 style='position:relative;left:10px;'>".$f["titulo"]."</h2>"; | ||
| 1473 | + $html[] = "<div style='position:relative;left:20px;'>"; | ||
| 1474 | + $html[] = "<p><i>".$f["descricao"]."</i></p>"; | ||
| 1475 | + $html[] = "<p><b>Fontes:</b></p>"; | ||
| 1476 | + foreach($f["fontes"] as $fonte){ | ||
| 1477 | + $html[] = "<p><a href='".$fonte["link"]."' >".$fonte["titulo"]."</a></p>"; | ||
| 1478 | + } | ||
| 1479 | + $html[] = "<p><b>Links:</b></p>"; | ||
| 1480 | + foreach($f["links"] as $link){ | ||
| 1481 | + $html[] = "<p><a href='".$link["link"]."' >".$link["nome"]."</a></p>"; | ||
| 1482 | + } | ||
| 1483 | + if($f["dadosgerenciais"] != ""){ | ||
| 1484 | + $html[] = "<span style='color:gray'>"; | ||
| 1485 | + $html[] = "esquemadb = ".$f["dadosgerenciais"][esquemadb].", "; | ||
| 1486 | + $html[] = "tabela = ".$f["dadosgerenciais"][tabela].", "; | ||
| 1487 | + $html[] = "colunavalor = ".$f["dadosgerenciais"][colunavalor].", "; | ||
| 1488 | + $html[] = "colunaidgeo = ".$f["dadosgerenciais"][colunaidgeo].", "; | ||
| 1489 | + $html[] = "filtro = ".$f["dadosgerenciais"][filtro].", "; | ||
| 1490 | + $html[] = "colunaidunico = ".$f["dadosgerenciais"][colunaidunico]; | ||
| 1491 | + $html[] = "</span>"; | ||
| 1492 | + } | ||
| 1493 | + $html[] = "</div>"; | ||
| 1494 | + } | ||
| 1495 | + $html[] = "</div>"; | ||
| 1478 | if($var_cor == "var_cor1"){ | 1496 | if($var_cor == "var_cor1"){ |
| 1479 | $var_cor = "var_cor2"; | 1497 | $var_cor = "var_cor2"; |
| 1480 | } | 1498 | } |
| @@ -1482,8 +1500,8 @@ class Metaestat{ | @@ -1482,8 +1500,8 @@ class Metaestat{ | ||
| 1482 | $var_cor = "var_cor1"; | 1500 | $var_cor = "var_cor1"; |
| 1483 | } | 1501 | } |
| 1484 | } | 1502 | } |
| 1485 | - $html .= "</div>"; | ||
| 1486 | - return $html; | 1503 | + $html[] = "</div><br><br>"; |
| 1504 | + return implode("",$html); | ||
| 1487 | } | 1505 | } |
| 1488 | function formataXML($dados){ | 1506 | function formataXML($dados){ |
| 1489 | $chaves = array_keys($dados[0]); | 1507 | $chaves = array_keys($dados[0]); |
admin/php/metaestat.php
| @@ -1181,7 +1181,7 @@ switch (strtoupper($funcao)) | @@ -1181,7 +1181,7 @@ switch (strtoupper($funcao)) | ||
| 1181 | if(empty($codigo_variavel)){ | 1181 | if(empty($codigo_variavel)){ |
| 1182 | $codigo_variavel = ""; | 1182 | $codigo_variavel = ""; |
| 1183 | } | 1183 | } |
| 1184 | - $dados = $m->relatorioCompleto($codigo_variavel); | 1184 | + $dados = $m->relatorioCompleto($codigo_variavel,$dadosGerenciais); |
| 1185 | $dados = $m->formataRelatorioHtml($dados); | 1185 | $dados = $m->formataRelatorioHtml($dados); |
| 1186 | retornaJSON($dados); | 1186 | retornaJSON($dados); |
| 1187 | exit; | 1187 | exit; |