Commit 009f17fd5094ba74630d6109a47f4edac7d043fa
1 parent
0acf966c
Exists in
master
and in
7 other branches
Adaptação para uso com múltiplos menus
Showing
1 changed file
with
36 additions
and
34 deletions
Show diff stats
kml.php
... | ... | @@ -116,49 +116,51 @@ if ($menutemas != "" || is_array($menutemas)) |
116 | 116 | // |
117 | 117 | if($menutemas == "") |
118 | 118 | { |
119 | - //include("admin/php/conexao.php"); | |
120 | 119 | include("admin/php/admin.php"); |
121 | - $grupos = pegaDados("SELECT * from i3geoadmin_grupos order by nome_grupo"); | |
122 | - foreach($grupos as $grupo) | |
120 | + $menus = pegaDados("SELECT * from i3geoadmin_menus where publicado_menu != 'NAO' order by nome_menu "); | |
121 | + foreach($menus as $menu) | |
123 | 122 | { |
124 | - kml_cabecalho($grupo["nome_grupo"],$grupo["desc_grupo"]); | |
125 | - $id_grupo = $grupo["id_grupo"]; | |
126 | - $sql = "select s.nome_subgrupo,n2.id_n2 from i3geoadmin_n2 as n2,i3geoadmin_n1 as n1, i3geoadmin_subgrupos as s "; | |
127 | - $sql .= "where n1.id_grupo = '$id_grupo' and n2.id_subgrupo = s.id_subgrupo "; | |
128 | - $sql .= "and n2.id_n1 = n1.id_n1 "; | |
129 | - $sql .= "and n1.n1_perfil = '' and n2.n2_perfil = '' "; | |
130 | - //$sql .= "and n1.publicado != 'nao' and n2.publicado != 'nao' "; | |
131 | - $sql .= "order by s.nome_subgrupo"; | |
132 | - //echo $sql;exit; | |
133 | - $subgrupos = pegaDados($sql); | |
134 | - foreach ($subgrupos as $subgrupo) | |
123 | + kml_cabecalho($menu["nome_menu"],$menu["desc_menu"]); | |
124 | + $id_menu = $menu["id_menu"]; | |
125 | + $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"); | |
126 | + foreach($grupos as $grupo) | |
135 | 127 | { |
136 | - kml_folder($subgrupo["nome_subgrupo"]); | |
137 | - $id_n2 = $subgrupo["id_n2"]; | |
138 | - $sql = "select t.codigo_tema,t.nome_tema,t.link_tema, t.desc_tema from i3geoadmin_n3 as n3,i3geoadmin_temas as t where "; | |
139 | - $sql .= "n3.id_n2='$id_n2' "; | |
140 | - $sql .= "and n3.id_tema = t.id_tema "; | |
141 | - $sql .= "and n3_perfil = '' "; | |
142 | - $sql .= "and t.kml_tema != 'nao' "; | |
143 | - $sql .= "and t.tipoa_tema = ''"; | |
144 | - //echo $sql;exit; | |
145 | - $temas = pegadados($sql); | |
146 | - foreach ($temas as $tema) | |
128 | + kml_cabecalho($grupo["nome_grupo"],$grupo["desc_grupo"]); | |
129 | + $id_grupo = $grupo["id_grupo"]; | |
130 | + $sql = "select s.nome_subgrupo,n2.id_n2 from i3geoadmin_n2 as n2,i3geoadmin_n1 as n1, i3geoadmin_subgrupos as s "; | |
131 | + $sql .= "where n1.id_grupo = '$id_grupo' and n2.id_subgrupo = s.id_subgrupo "; | |
132 | + $sql .= "and n2.id_n1 = n1.id_n1 "; | |
133 | + $sql .= "and n1.n1_perfil = '' and n2.n2_perfil = '' "; | |
134 | + $sql .= "order by s.nome_subgrupo"; | |
135 | + $subgrupos = pegaDados($sql); | |
136 | + foreach ($subgrupos as $subgrupo) | |
147 | 137 | { |
148 | - $fonte = $tema["link_tema"]; | |
149 | - $nome = $tema["nome_tema"]; | |
150 | - $id = $tema["codigo_tema"]; | |
151 | - $desc = $tema["desc_tema"]; | |
152 | - $fonte = "<a href='$fonte' >Fonte </a>"; | |
153 | - $legenda = "<a href='$urli3geo/ogc.php?tema=$id&layer=$id&request=getlegendgraphic&service=wms&format=image/jpeg' >Legenda </a>"; | |
154 | - $href = "$urli3geo/ogc.php?tema=$id&width=800&height=800&VERSION=1.1.1&REQUEST=GetMap&SRS=EPSG:4326&STYLES=&BGCOLOR=0xFFFFFF&FORMAT=image/png&TRANSPARENT=TRUE&layers=$id"; | |
155 | - kml_servico($nome,$fonte,$legenda,$desc,$href); | |
138 | + kml_folder($subgrupo["nome_subgrupo"]); | |
139 | + $id_n2 = $subgrupo["id_n2"]; | |
140 | + $sql = "select t.codigo_tema,t.nome_tema,t.link_tema, t.desc_tema from i3geoadmin_n3 as n3,i3geoadmin_temas as t where "; | |
141 | + $sql .= "n3.id_n2='$id_n2' "; | |
142 | + $sql .= "and n3.id_tema = t.id_tema "; | |
143 | + $sql .= "and n3_perfil = '' "; | |
144 | + $sql .= "and t.kml_tema != 'nao' "; | |
145 | + $sql .= "and t.tipoa_tema = ''"; | |
146 | + $temas = pegadados($sql); | |
147 | + foreach ($temas as $tema) | |
148 | + { | |
149 | + $fonte = $tema["link_tema"]; | |
150 | + $nome = $tema["nome_tema"]; | |
151 | + $id = $tema["codigo_tema"]; | |
152 | + $desc = $tema["desc_tema"]; | |
153 | + $fonte = "<a href='$fonte' >Fonte </a>"; | |
154 | + $legenda = "<a href='$urli3geo/ogc.php?tema=$id&layer=$id&request=getlegendgraphic&service=wms&format=image/jpeg' >Legenda </a>"; | |
155 | + $href = "$urli3geo/ogc.php?tema=$id&width=800&height=800&VERSION=1.1.1&REQUEST=GetMap&SRS=EPSG:4326&STYLES=&BGCOLOR=0xFFFFFF&FORMAT=image/png&TRANSPARENT=TRUE&layers=$id"; | |
156 | + kml_servico($nome,$fonte,$legenda,$desc,$href); | |
157 | + } | |
158 | + echo "</Folder>\n"; | |
156 | 159 | } |
157 | 160 | echo "</Folder>\n"; |
158 | 161 | } |
159 | 162 | echo "</Folder>\n"; |
160 | 163 | } |
161 | - | |
162 | 164 | } |
163 | 165 | echo "</Document></kml>\n"; |
164 | 166 | function kml_cabecalho($nome,$desc) | ... | ... |