Commit 20c93d27878d9d2299aaa477fe8edd1fabdd3b94

Authored by Edmar Moretti
1 parent 6dcad993

Correção na montagem das árvores de kml e download de temas

classesjs/i3geonaocompacto.js
@@ -1,77 +0,0 @@ @@ -1,77 +0,0 @@
1 -var mostradicasf = function(){};  
2 -var scriptLocation = "";  
3 -var scripts = document.getElementsByTagName('script');  
4 -for (var i = 0; i < scripts.length; i++) {  
5 - var src = scripts[i].getAttribute('src');  
6 - if (src) {  
7 - var index = src.lastIndexOf("i3geonaocompacto.js");  
8 - // is it found, at the end of the URL?  
9 - if ((index > -1) && (index + "i3geonaocompacto.js".length == src.length)) {  
10 - scriptLocation = src.slice(0, -"i3geonaocompacto.js".length);  
11 - break;  
12 - }  
13 - }  
14 -}  
15 -var allScriptTags = "";  
16 -var jsfiles = new Array(  
17 -"../pacotes/yui270/build/yahoo/yahoo-min.js",  
18 -"../pacotes/yui270/build/yahoo-dom-event/yahoo-dom-event.js",  
19 -"../pacotes/yui270/build/dom/dom-min.js",  
20 -"../pacotes/yui270/build/container/container_core-min.js",  
21 -"../pacotes/yui270/build/menu/menu-min.js",  
22 -"../pacotes/yui270/build/logger/logger-min.js",  
23 -"../pacotes/yui270/build/dragdrop/dragdrop-min.js",  
24 -"../pacotes/yui270/build/slider/slider-min.js",  
25 -"../pacotes/yui270/build/animation/animation-min.js",  
26 -"../pacotes/yui270/build/container/container-min.js",  
27 -"../pacotes/yui270/build/element/element-min.js",  
28 -"../pacotes/yui270/build/tabview/tabview-min.js",  
29 -"../pacotes/yui270/build/utilities/utilities.js",  
30 -"../pacotes/cpaint/cpaint2.inc.js",  
31 -"../pacotes/yui270/build/treeview/treeview.js",  
32 -"../pacotes/balloon-tooltips/htdocs/js/balloon.config.js",  
33 -"../pacotes/balloon-tooltips/htdocs/js/balloon.js",  
34 -"classe_i3geo.js",  
35 -"classe_util.js",  
36 -"dicionario.js",  
37 -"classe_idioma.js",  
38 -"classe_php.js",  
39 -"classe_configura.js",  
40 -"depreciados.js",  
41 -"classe_calculo.js",  
42 -"classe_desenho.js",  
43 -"classe_interface.js",  
44 -"classe_mapa.js",  
45 -"classe_tema.js",  
46 -"classe_analise.js",  
47 -"classe_maparef.js",  
48 -"classe_ajuda.js",  
49 -"classe_janela.js",  
50 -"classe_guias.js",  
51 -"classe_arvoredecamadas.js",  
52 -"classe_navega.js",  
53 -"classe_selecao.js",  
54 -"classe_eventos.js",  
55 -"classe_arvoredetemas.js",  
56 -"classe_barradebotoes.js",  
57 -"../pacotes/richdraw/richdraw_tudo_compacto.js",  
58 -"classe_gadgets.js"  
59 -);  
60 -for (i = 0; i < jsfiles.length; i++)  
61 -{  
62 - var currentScriptTag = "<script src='" + scriptLocation + jsfiles[i] + "'></script>";  
63 - allScriptTags += currentScriptTag;  
64 -}  
65 -//css  
66 -var allCssTags = "";  
67 -var cssfiles = new Array(  
68 -"../css/i3geo.css.php"  
69 -);  
70 -for (i = 0; i < cssfiles.length; i++)  
71 -{  
72 - var currentCssTag = "<link rel='stylesheet' type='text/css' href='" + scriptLocation + cssfiles[i] + "'/>";  
73 - allCssTags += currentCssTag;  
74 -}  
75 -  
76 -document.write(allCssTags);  
77 -document.write(allScriptTags);  
78 \ No newline at end of file 0 \ No newline at end of file
classesphp/classe_menutemas.php
@@ -200,11 +200,11 @@ array @@ -200,11 +200,11 @@ array
200 // 200 //
201 foreach($xml->TEMA as $temar) 201 foreach($xml->TEMA as $temar)
202 { 202 {
203 - $down = "nao"; 203 + $down = "sim";
204 $ogc = "sim"; 204 $ogc = "sim";
205 $temp = $this->ixml($temar,"DOWNLOAD"); 205 $temp = $this->ixml($temar,"DOWNLOAD");
206 - if (($temp == "sim") || ($temp == "SIM"))  
207 - {$down = "sim";} 206 + if (($temp == "nao") || ($temp == "NAO"))
  207 + {$down = "nao";}
208 $temp = $this->ixml($temar,"OGC"); 208 $temp = $this->ixml($temar,"OGC");
209 if (($temp == "nao") || ($temp == "NAO")) 209 if (($temp == "nao") || ($temp == "NAO"))
210 {$ogc = "nao";} 210 {$ogc = "nao";}
@@ -235,11 +235,11 @@ array @@ -235,11 +235,11 @@ array
235 $temas = array(); 235 $temas = array();
236 foreach($grupo->TEMA as $temar) 236 foreach($grupo->TEMA as $temar)
237 { 237 {
238 - $down = "nao"; 238 + $down = "sim";
239 $ogc = "sim"; 239 $ogc = "sim";
240 $temp = $this->ixml($temar,"DOWNLOAD"); 240 $temp = $this->ixml($temar,"DOWNLOAD");
241 - if (($temp == "sim") || ($temp == "SIM"))  
242 - {$down = "sim";} 241 + if (($temp == "nao") || ($temp == "NAO"))
  242 + {$down = "nao";}
243 $temp = $this->ixml($temar,"OGC"); 243 $temp = $this->ixml($temar,"OGC");
244 if (($temp == "nao") || ($temp == "NAO")) 244 if (($temp == "nao") || ($temp == "NAO"))
245 {$ogc = "nao";} 245 {$ogc = "nao";}
@@ -251,18 +251,22 @@ array @@ -251,18 +251,22 @@ array
251 $nome = $this->ixml($temar,"TNOME"); 251 $nome = $this->ixml($temar,"TNOME");
252 $temas[] = array("tid"=>$tid,"nome"=>$nome,"link"=>$link,"download"=>$down,"ogc"=>$ogc); 252 $temas[] = array("tid"=>$tid,"nome"=>$nome,"link"=>$link,"download"=>$down,"ogc"=>$ogc);
253 } 253 }
254 - $grupodown = "nao"; 254 + $grupodown = "sim";
255 $grupoogc = "sim"; 255 $grupoogc = "sim";
256 foreach($grupo->SGRUPO as $sgrupo) 256 foreach($grupo->SGRUPO as $sgrupo)
257 { 257 {
258 foreach($sgrupo->TEMA as $tema) 258 foreach($sgrupo->TEMA as $tema)
259 { 259 {
260 $temp = $this->ixml($tema,"DOWNLOAD"); 260 $temp = $this->ixml($tema,"DOWNLOAD");
261 - if (($temp == "sim") || ($temp == "SIM"))  
262 - {$grupodown = "sim";} 261 + if (($temp == "nao") || ($temp == "NAO"))
  262 + {$grupodown = "nao";}
  263 + else
  264 + {$grupodown = "sim";}
263 $temp = $this->ixml($tema,"OGC"); 265 $temp = $this->ixml($tema,"OGC");
264 if (($temp == "nao") || ($temp == "NAO")) 266 if (($temp == "nao") || ($temp == "NAO"))
265 - {$grupoogc = "nao";} 267 + {$grupoogc = "nao";}
  268 + else
  269 + {$grupoogc = "sim";}
266 } 270 }
267 } 271 }
268 $subgrupos = array(); 272 $subgrupos = array();
@@ -283,16 +287,20 @@ array @@ -283,16 +287,20 @@ array
283 if ($incluisgrupo == TRUE) 287 if ($incluisgrupo == TRUE)
284 { 288 {
285 //verifica se existem temas que podem receber download 289 //verifica se existem temas que podem receber download
286 - $down = "nao"; 290 + $down = "sim";
287 $ogc = "sim"; 291 $ogc = "sim";
288 foreach($sgrupo->TEMA as $tema) 292 foreach($sgrupo->TEMA as $tema)
289 { 293 {
290 $temp = $this->ixml($tema,"DOWNLOAD"); 294 $temp = $this->ixml($tema,"DOWNLOAD");
291 - if (($temp == "sim") || ($temp == "SIM")) 295 + if (($temp == "nao") || ($temp == "NAO"))
  296 + {$down = "nao";}
  297 + else
292 {$down = "sim";} 298 {$down = "sim";}
293 $temp = $this->ixml($tema,"OGC"); 299 $temp = $this->ixml($tema,"OGC");
294 if (($temp == "nao") || ($temp == "NAO")) 300 if (($temp == "nao") || ($temp == "NAO"))
295 {$ogc = "nao";} 301 {$ogc = "nao";}
  302 + else
  303 + {$ogc = "sim";}
296 } 304 }
297 $nome = $this->ixml($sgrupo,"SDTIPO"); 305 $nome = $this->ixml($sgrupo,"SDTIPO");
298 $subgrupos[] = array("nome"=>$nome,"download"=>$down,"ogc"=>$ogc); 306 $subgrupos[] = array("nome"=>$nome,"download"=>$down,"ogc"=>$ogc);
@@ -393,16 +401,20 @@ array @@ -393,16 +401,20 @@ array
393 } 401 }
394 if (($incluisgrupo == TRUE)) 402 if (($incluisgrupo == TRUE))
395 { 403 {
396 - $down = "nao"; 404 + $down = "sim";
397 $ogc = "sim"; 405 $ogc = "sim";
398 foreach($sgrupo->TEMA as $tema) 406 foreach($sgrupo->TEMA as $tema)
399 { 407 {
400 $temp = $this->ixml($tema,"DOWNLOAD"); 408 $temp = $this->ixml($tema,"DOWNLOAD");
401 - if (($temp == "sim") || ($temp == "SIM")) 409 + if (($temp == "nao") || ($temp == "NAO"))
  410 + {$down = "nao";}
  411 + else
402 {$down = "sim";} 412 {$down = "sim";}
403 $temp = $this->ixml($tema,"OGC"); 413 $temp = $this->ixml($tema,"OGC");
404 if (($temp == "nao") || ($temp == "NAO")) 414 if (($temp == "nao") || ($temp == "NAO"))
405 - {$ogc = "nao";} 415 + {$ogc = "nao";}
  416 + else
  417 + {$ogc = "sim";}
406 } 418 }
407 $nome = $this->ixml($sgrupo,"SDTIPO"); 419 $nome = $this->ixml($sgrupo,"SDTIPO");
408 $subgrupos[] = array("nome"=>$nome,"ogc"=>$ogc,"download"=>$down); 420 $subgrupos[] = array("nome"=>$nome,"ogc"=>$ogc,"download"=>$down);
@@ -412,11 +424,11 @@ array @@ -412,11 +424,11 @@ array
412 $temas = array(); 424 $temas = array();
413 foreach($grupo->TEMA as $temar) 425 foreach($grupo->TEMA as $temar)
414 { 426 {
415 - $down = "nao"; 427 + $down = "sim";
416 $ogc = "sim"; 428 $ogc = "sim";
417 $temp = $this->ixml($temar,"DOWNLOAD"); 429 $temp = $this->ixml($temar,"DOWNLOAD");
418 - if (($temp == "sim") || ($temp == "SIM"))  
419 - {$down = "sim";} 430 + if (($temp == "nao") || ($temp == "NAO"))
  431 + {$down = "nao";}
420 $temp = $this->ixml($temar,"OGC"); 432 $temp = $this->ixml($temar,"OGC");
421 if (($temp == "nao") || ($temp == "NAO")) 433 if (($temp == "nao") || ($temp == "NAO"))
422 {$ogc = "nao";} 434 {$ogc = "nao";}
@@ -510,8 +522,7 @@ array @@ -510,8 +522,7 @@ array
510 { 522 {
511 $inclui = TRUE; 523 $inclui = TRUE;
512 if ($this->ixml($tema,"PERFIL") != "") 524 if ($this->ixml($tema,"PERFIL") != "")
513 - {  
514 - 525 + {
515 $inclui = FALSE; 526 $inclui = FALSE;
516 $temp = $this->ixml($tema,"PERFIL"); 527 $temp = $this->ixml($tema,"PERFIL");
517 $perfis = str_replace(","," ",$temp); 528 $perfis = str_replace(","," ",$temp);
@@ -521,9 +532,9 @@ array @@ -521,9 +532,9 @@ array
521 } 532 }
522 if ($inclui == TRUE) 533 if ($inclui == TRUE)
523 { 534 {
524 - $down = "nao";  
525 - if (($tema->DOWNLOAD == "sim") || ($tema->DOWNLOAD == "SIM"))  
526 - {$down = "sim";} 535 + $down = "sim";
  536 + if (($tema->DOWNLOAD == "nao") || ($tema->DOWNLOAD == "NAO"))
  537 + {$down = "nao";}
527 $ogc = "sim"; 538 $ogc = "sim";
528 if (($tema->OGC == "nao") || ($tema->OGC == "NAO")) 539 if (($tema->OGC == "nao") || ($tema->OGC == "NAO"))
529 {$ogc = "nao";} 540 {$ogc = "nao";}
@@ -73,6 +73,9 @@ if ($menutemas != &quot;&quot; || is_array($menutemas)) @@ -73,6 +73,9 @@ if ($menutemas != &quot;&quot; || is_array($menutemas))
73 foreach ($menus as $menu) 73 foreach ($menus as $menu)
74 { 74 {
75 $xml = simplexml_load_file($menu); 75 $xml = simplexml_load_file($menu);
  76 + //raiz
  77 + foreach($xml->TEMA as $tema)
  78 + {kml_tema($tema);}
76 foreach($xml->GRUPO as $grupo) 79 foreach($xml->GRUPO as $grupo)
77 { 80 {
78 $nome = mb_convert_encoding($grupo->GTIPO,"auto","auto"); 81 $nome = mb_convert_encoding($grupo->GTIPO,"auto","auto");
@@ -95,50 +98,62 @@ if ($menutemas != &quot;&quot; || is_array($menutemas)) @@ -95,50 +98,62 @@ if ($menutemas != &quot;&quot; || is_array($menutemas))
95 // 98 //
96 //no caso do menu vir do sistema de administração 99 //no caso do menu vir do sistema de administração
97 // 100 //
  101 +//error_reporting(E_ALL);
98 if($menutemas == "") 102 if($menutemas == "")
99 { 103 {
100 include("admin/php/admin.php"); 104 include("admin/php/admin.php");
101 - $menus = pegaDados("SELECT * from i3geoadmin_menus where publicado_menu != 'NAO' or publicado_menu isnull order by nome_menu ");  
102 - echo $sql; 105 + $menus = pegaDados("SELECT * from i3geoadmin_menus where lower(publicado_menu) != 'nao' or publicado_menu isnull order by nome_menu ");
  106 + //echo $sql;
103 foreach($menus as $menu) 107 foreach($menus as $menu)
104 { 108 {
105 - echo $menu["nome_menu"];  
106 kml_cabecalho($menu["nome_menu"],$menu["desc_menu"]); 109 kml_cabecalho($menu["nome_menu"],$menu["desc_menu"]);
107 $id_menu = $menu["id_menu"]; 110 $id_menu = $menu["id_menu"];
108 - $grupos = pegaDados("SELECT nome_grupo,n1.id_grupo,gr.desc_grupo from i3geoadmin_n1 as n1,i3geoadmin_grupos as gr where n1.id_menu = '$id_menu' and n1.id_grupo = gr.id_grupo order by gr.nome_grupo"); 111 + //raiz
  112 + $sql = "select id_raiz,i3geoadmin_raiz.id_tema,nome_tema,tipoa_tema,codigo_tema FROM i3geoadmin_raiz LEFT JOIN i3geoadmin_temas ON i3geoadmin_temas.id_tema = i3geoadmin_raiz.id_tema where (lower(i3geoadmin_temas.tipoa_tema) != 'wms' or i3geoadmin_temas.tipoa_tema isnull) and (lower(i3geoadmin_temas.kml_tema) != 'nao' or i3geoadmin_temas.kml_tema isnull) and i3geoadmin_temas.tipoa_tema != 'WMS' and i3geoadmin_temas.kml_tema != 'nao' and i3geoadmin_raiz.id_menu='$id_menu' and i3geoadmin_raiz.nivel = 0 and i3geoadmin_raiz.id_nivel = 0 order by ordem";
  113 + $temas = pegaDados($sql);
  114 + if(count($temas) > 0)
  115 + {
  116 + foreach ($temas as $tema)
  117 + {kml_tema_bd($tema);}
  118 + }
  119 + $grupos = pegaDados("SELECT nome_grupo,n1.id_n1,n1.id_grupo,gr.desc_grupo from i3geoadmin_n1 as n1,i3geoadmin_grupos as gr where (lower(n1.publicado) != 'nao' or n1.publicado isnull) and n1.id_menu = '$id_menu' and n1.id_grupo = gr.id_grupo order by gr.nome_grupo");
109 foreach($grupos as $grupo) 120 foreach($grupos as $grupo)
110 { 121 {
111 kml_cabecalho($grupo["nome_grupo"],$grupo["desc_grupo"]); 122 kml_cabecalho($grupo["nome_grupo"],$grupo["desc_grupo"]);
112 $id_grupo = $grupo["id_grupo"]; 123 $id_grupo = $grupo["id_grupo"];
  124 + //raiz
  125 + $sql = "select id_raiz,i3geoadmin_raiz.id_tema,nome_tema,tipoa_tema,kml_tema,codigo_tema FROM i3geoadmin_raiz LEFT JOIN i3geoadmin_temas ON i3geoadmin_temas.id_tema = i3geoadmin_raiz.id_tema where lower(i3geoadmin_temas.tipoa_tema) != 'wms' and lower(i3geoadmin_temas.kml_tema) != 'nao' and i3geoadmin_temas.tipoa_tema != 'WMS' and i3geoadmin_temas.kml_tema != 'nao' and i3geoadmin_raiz.id_menu='$id_menu' and i3geoadmin_raiz.nivel = 1 and i3geoadmin_raiz.id_nivel = ".$grupo["id_n1"]." order by ordem";
  126 + $temas = pegaDados($sql);
  127 + if(count($temas) > 0)
  128 + {
  129 + foreach ($temas as $tema)
  130 + {kml_tema_bd($tema);}
  131 + }
113 $sql = "select s.nome_subgrupo,n2.id_n2 from i3geoadmin_n2 as n2,i3geoadmin_n1 as n1, i3geoadmin_subgrupos as s "; 132 $sql = "select s.nome_subgrupo,n2.id_n2 from i3geoadmin_n2 as n2,i3geoadmin_n1 as n1, i3geoadmin_subgrupos as s ";
114 $sql .= "where n1.id_grupo = '$id_grupo' and n2.id_subgrupo = s.id_subgrupo "; 133 $sql .= "where n1.id_grupo = '$id_grupo' and n2.id_subgrupo = s.id_subgrupo ";
115 $sql .= "and n2.id_n1 = n1.id_n1 "; 134 $sql .= "and n2.id_n1 = n1.id_n1 ";
116 $sql .= "and n1.n1_perfil = '' and n2.n2_perfil = '' "; 135 $sql .= "and n1.n1_perfil = '' and n2.n2_perfil = '' ";
  136 + $sql .= "and (lower(n2.publicado) != 'nao' or n2.publicado isnull) ";
117 $sql .= "order by s.nome_subgrupo"; 137 $sql .= "order by s.nome_subgrupo";
118 $subgrupos = pegaDados($sql); 138 $subgrupos = pegaDados($sql);
119 foreach ($subgrupos as $subgrupo) 139 foreach ($subgrupos as $subgrupo)
120 { 140 {
121 - kml_folder($subgrupo["nome_subgrupo"]);  
122 $id_n2 = $subgrupo["id_n2"]; 141 $id_n2 = $subgrupo["id_n2"];
123 $sql = "select t.codigo_tema,t.nome_tema,t.link_tema, t.desc_tema from i3geoadmin_n3 as n3,i3geoadmin_temas as t where "; 142 $sql = "select t.codigo_tema,t.nome_tema,t.link_tema, t.desc_tema from i3geoadmin_n3 as n3,i3geoadmin_temas as t where ";
124 $sql .= "n3.id_n2='$id_n2' "; 143 $sql .= "n3.id_n2='$id_n2' ";
125 $sql .= "and n3.id_tema = t.id_tema "; 144 $sql .= "and n3.id_tema = t.id_tema ";
126 $sql .= "and n3_perfil = '' "; 145 $sql .= "and n3_perfil = '' ";
127 - $sql .= "and t.kml_tema != 'nao' ";  
128 - $sql .= "and t.tipoa_tema = ''"; 146 + $sql .= "and lower(t.kml_tema) != 'nao' ";
  147 + $sql .= "and lower(t.tipoa_tema) != 'wms'";
  148 + $sql .= "and (lower(n3.publicado) != 'nao' or n3.publicado isnull) ";
129 $temas = pegadados($sql); 149 $temas = pegadados($sql);
130 - foreach ($temas as $tema) 150 + if(count($temas) > 0)
131 { 151 {
132 - $fonte = $tema["link_tema"];  
133 - $nome = $tema["nome_tema"];  
134 - $id = $tema["codigo_tema"];  
135 - $desc = $tema["desc_tema"];  
136 - $fonte = "<a href='$fonte' >Fonte </a>";  
137 - $legenda = "<a href='$urli3geo/ogc.php?tema=$id&layer=$id&request=getlegendgraphic&service=wms&format=image/jpeg' >Legenda </a>";  
138 - $href = "$urli3geo/ogc.php?tema=$id&amp;width=800&amp;height=800&amp;VERSION=1.1.1&amp;REQUEST=GetMap&amp;SRS=EPSG:4326&amp;STYLES=&amp;BGCOLOR=0xFFFFFF&amp;FORMAT=image/png&amp;TRANSPARENT=TRUE&amp;layers=$id";  
139 - kml_servico($nome,$fonte,$legenda,$desc,$href); 152 + kml_folder($subgrupo["nome_subgrupo"]);
  153 + foreach ($temas as $tema)
  154 + {kml_tema_bd($tema);}
  155 + echo "</Folder>\n";
140 } 156 }
141 - echo "</Folder>\n";  
142 } 157 }
143 echo "</Folder>\n"; 158 echo "</Folder>\n";
144 } 159 }
@@ -146,6 +161,18 @@ if($menutemas == &quot;&quot;) @@ -146,6 +161,18 @@ if($menutemas == &quot;&quot;)
146 } 161 }
147 } 162 }
148 echo "</Document></kml>\n"; 163 echo "</Document></kml>\n";
  164 +function kml_tema_bd($tema)
  165 +{
  166 + global $urli3geo;
  167 + $fonte = $tema["link_tema"];
  168 + $nome = $tema["nome_tema"];
  169 + $id = $tema["codigo_tema"];
  170 + $desc = $tema["desc_tema"];
  171 + $fonte = "<a href='$fonte' >Fonte </a>";
  172 + $legenda = "<a href='$urli3geo/ogc.php?tema=$id&layer=$id&request=getlegendgraphic&service=wms&format=image/jpeg' >Legenda </a>";
  173 + $href = "$urli3geo/ogc.php?tema=$id&amp;width=800&amp;height=800&amp;VERSION=1.1.1&amp;REQUEST=GetMap&amp;SRS=EPSG:4326&amp;STYLES=&amp;BGCOLOR=0xFFFFFF&amp;FORMAT=image/png&amp;TRANSPARENT=TRUE&amp;layers=$id";
  174 + kml_servico($nome,$fonte,$legenda,$desc,$href);
  175 +}
149 function kml_cabecalho($nome,$desc) 176 function kml_cabecalho($nome,$desc)
150 { 177 {
151 echo "<Folder>\n"; 178 echo "<Folder>\n";
menutemas/admin.db
No preview for this file type