Commit 5f1fc690154203b79e115dfce1a203f99f5d5e67
1 parent
b9409e99
Exists in
master
and in
7 other branches
Correção no indicador de região no mapa de referência. Remoção do programa admin…
…/php/classe_arvorede.php
Showing
18 changed files
with
2626 additions
and
1650 deletions
Show diff stats
admin/admin.db
No preview for this file type
admin/php/classe_arvore.php
| ... | ... | @@ -1,1274 +0,0 @@ |
| 1 | -<?php | |
| 2 | -/* | |
| 3 | -Title: classe_arvore.php | |
| 4 | - | |
| 5 | -Funções para montagem da árvore de temas | |
| 6 | - | |
| 7 | -Licenca: | |
| 8 | - | |
| 9 | -GPL2 | |
| 10 | - | |
| 11 | -i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet | |
| 12 | - | |
| 13 | -Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil | |
| 14 | -Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com | |
| 15 | - | |
| 16 | -Este programa é software livre; você pode redistribuí-lo | |
| 17 | -e/ou modificá-lo sob os termos da Licença Pública Geral | |
| 18 | -GNU conforme publicada pela Free Software Foundation; | |
| 19 | - | |
| 20 | -Este programa é distribuído na expectativa de que seja útil, | |
| 21 | -porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita | |
| 22 | -de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. | |
| 23 | -Consulte a Licença Pública Geral do GNU para mais detalhes. | |
| 24 | -Você deve ter recebido uma c�pia da Licença Pública Geral do | |
| 25 | - GNU junto com este programa; se não, escreva para a | |
| 26 | -Free Software Foundation, Inc., no endereço | |
| 27 | -59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 28 | - | |
| 29 | -Arquivo: | |
| 30 | - | |
| 31 | -i3geo/admin/php/classe_arvore.php | |
| 32 | -*/ | |
| 33 | -/* | |
| 34 | -Classe: Arvore | |
| 35 | - | |
| 36 | -Classe utilizada para compor a árvore de temas ou obter dados específicos da árvore. | |
| 37 | - | |
| 38 | -É utilizada por várias operações do i3Geo, principalmente pela <classe_menutemas> | |
| 39 | -*/ | |
| 40 | -class Arvore | |
| 41 | -{ | |
| 42 | - //temas com acesso restrito e que nao podem ser acessados pelo usuario que esta logado | |
| 43 | - public $temassindevidos; | |
| 44 | - protected $locaplic; | |
| 45 | - //subgrupos que tem pelo menos um tema | |
| 46 | - //public $sql_subgrupos = "select i3geoadmin_subgrupos.nome_subgrupo,i3geoadmin_n2.id_n2,i3geoadmin_n2.publicado,i3geoadmin_n2.n2_perfil from i3geoadmin_n2 LEFT JOIN i3geoadmin_subgrupos ON i3geoadmin_n2.id_subgrupo = i3geoadmin_subgrupos.id_subgrupo "; | |
| 47 | - //grupos que tem pelo menos um sub-grupo | |
| 48 | - //public $sql_grupos = "select i3geoadmin_grupos.nome_grupo,id_n1,id_menu,i3geoadmin_n1.publicado,n1_perfil from i3geoadmin_n1 LEFT JOIN i3geoadmin_grupos ON i3geoadmin_n1.id_grupo = i3geoadmin_grupos.id_grupo "; | |
| 49 | - //nomes de todos os grupos | |
| 50 | - public $sql_todosgrupos = "select * from i3geoadmin_grupos "; | |
| 51 | - //tipo de filtro | |
| 52 | - //ogc|download|"" | |
| 53 | - public $filtro; | |
| 54 | - //temas na raiz | |
| 55 | - //public $sql_temasraiz = "select id_raiz,i3geoadmin_raiz.id_tema,nome_tema,tipoa_tema FROM i3geoadmin_raiz LEFT JOIN i3geoadmin_temas ON i3geoadmin_temas.id_tema = i3geoadmin_raiz.id_tema "; | |
| 56 | - //todos os temas | |
| 57 | - //public $sql_temas = "select * from i3geoadmin_temas "; | |
| 58 | - //temas de um subgrupo | |
| 59 | - //public $sql_temasSubgrupo = "select i3geoadmin_temas.tipoa_tema, i3geoadmin_temas.codigo_tema,i3geoadmin_temas.tags_tema,i3geoadmin_n3.id_n3,i3geoadmin_temas.nome_tema,i3geoadmin_n3.publicado,i3geoadmin_n3.n3_perfil,i3geoadmin_n3.id_tema,i3geoadmin_temas.download_tema,i3geoadmin_temas.ogc_tema from i3geoadmin_n3 LEFT JOIN i3geoadmin_temas ON i3geoadmin_n3.id_tema = i3geoadmin_temas.id_tema "; | |
| 60 | - /* | |
| 61 | - Function: __construct | |
| 62 | - | |
| 63 | - Cria um objeto Arvore | |
| 64 | - | |
| 65 | - Parametros: | |
| 66 | - | |
| 67 | - locaplic {string} - localização do i3geo no sistema de arquivos | |
| 68 | - | |
| 69 | - idioma {string} - default = "pt" | |
| 70 | - */ | |
| 71 | - function __construct($locaplic,$idioma="pt",$filtro="") | |
| 72 | - { | |
| 73 | - $this->locaplic = $locaplic; | |
| 74 | - $this->filtro = $filtro; | |
| 75 | - $dbh = ""; | |
| 76 | - //error_reporting(0); | |
| 77 | - | |
| 78 | - include($locaplic."/admin/php/conexao.php"); | |
| 79 | - | |
| 80 | - $this->esquemaadmin = ""; | |
| 81 | - if(!empty($esquemaadmin)){ | |
| 82 | - $this->esquemaadmin = str_replace(".","",$esquemaadmin)."."; | |
| 83 | - } | |
| 84 | - if(!isset($convUTF)){ | |
| 85 | - $convUTF = true; | |
| 86 | - } | |
| 87 | - $this->convUTF = $convUTF; | |
| 88 | - $this->dbh = $dbh; | |
| 89 | - | |
| 90 | - $this->idioma = $idioma; | |
| 91 | - if($idioma == "pt"){ | |
| 92 | - $coluna = "nome_grupo"; | |
| 93 | - } | |
| 94 | - else{ | |
| 95 | - $coluna = $idioma; | |
| 96 | - } | |
| 97 | - $this->sql_grupos = "select CASE i3geoadmin_grupos.$coluna WHEN '' THEN nome_grupo ELSE i3geoadmin_grupos.$coluna END as nome_grupo,i3geoadmin_grupos.id_grupo, id_n1,id_menu,i3geoadmin_n1.publicado,n1_perfil,ordem from ".$this->esquemaadmin."i3geoadmin_n1 LEFT JOIN ".$this->esquemaadmin."i3geoadmin_grupos ON i3geoadmin_n1.id_grupo = i3geoadmin_grupos.id_grupo "; | |
| 98 | - if($filtro === "ogc" || $filtro === "download"){ | |
| 99 | - //esse sql retorna tambem os grupos dos temas que estao na raiz do grupo | |
| 100 | - $this->sql_grupos = "select DISTINCT * from (select CASE grupos.$coluna WHEN '' THEN nome_grupo ELSE grupos.$coluna END as nome_grupo,gr.id_n1,gr.id_menu,gr.publicado,gr.n1_perfil, 0 as ordem from ".$this->esquemaadmin."i3geoadmin_grupos as grupos, ".$this->esquemaadmin."i3geoadmin_n1 as gr, ".$this->esquemaadmin."i3geoadmin_n2 as sg, ".$this->esquemaadmin."i3geoadmin_n3 as t, ".$this->esquemaadmin."i3geoadmin_temas as temas where gr.id_grupo = grupos.id_grupo AND sg.id_n1 = gr.id_n1 AND t.id_n2 = sg.id_n2 AND t.id_tema = temas.id_tema AND (temas.ogc_tema NOT IN ('NAO','nao') OR temas.download_tema NOT IN ('NAO','nao') ) UNION select c.nome_grupo as nome_grupo,a.id_nivel as id_n1,a.id_menu,'SIM' as publicado,a.perfil as n1_perfil, 0 as ordem from ".$this->esquemaadmin."i3geoadmin_raiz as a, ".$this->esquemaadmin."i3geoadmin_temas as b, ".$this->esquemaadmin."i3geoadmin_grupos as c, ".$this->esquemaadmin."i3geoadmin_n1 as d where nivel = 1 AND a.id_tema = b.id_tema AND a.id_nivel = d.id_n1 AND d.id_grupo = c.id_grupo) as s "; | |
| 101 | - } | |
| 102 | - | |
| 103 | - if($idioma == "pt"){ | |
| 104 | - $coluna = "nome_subgrupo"; | |
| 105 | - } | |
| 106 | - else{ | |
| 107 | - $coluna = $idioma; | |
| 108 | - } | |
| 109 | - $this->sql_subgrupos = "select CASE i3geoadmin_subgrupos.$coluna WHEN '' THEN nome_subgrupo ELSE i3geoadmin_subgrupos.$coluna END as nome_subgrupo,i3geoadmin_subgrupos.id_subgrupo,i3geoadmin_n2.id_n2,i3geoadmin_n2.publicado,i3geoadmin_n2.n2_perfil from ".$this->esquemaadmin."i3geoadmin_n2 LEFT JOIN ".$this->esquemaadmin."i3geoadmin_subgrupos ON i3geoadmin_n2.id_subgrupo = i3geoadmin_subgrupos.id_subgrupo "; | |
| 110 | - | |
| 111 | - if($idioma == "pt"){ | |
| 112 | - $coluna = "nome_tema"; | |
| 113 | - } | |
| 114 | - else{ | |
| 115 | - $coluna = $idioma; | |
| 116 | - } | |
| 117 | - | |
| 118 | - $this->sql_temasraiz = "select id_nivel,ordem,codigo_tema,id_raiz,i3geoadmin_raiz.id_tema,CASE $coluna WHEN '' THEN nome_tema ELSE $coluna END as nome_tema,tipoa_tema,perfil, ogc_tema, download_tema, link_tema FROM ".$this->esquemaadmin."i3geoadmin_raiz LEFT JOIN ".$this->esquemaadmin."i3geoadmin_temas ON i3geoadmin_temas.id_tema = i3geoadmin_raiz.id_tema "; | |
| 119 | - $this->sql_temasSubgrupo = "select i3geoadmin_temas.tipoa_tema, i3geoadmin_temas.codigo_tema,i3geoadmin_temas.tags_tema,i3geoadmin_n3.id_n3,CASE i3geoadmin_temas.$coluna WHEN '' THEN nome_tema ELSE i3geoadmin_temas.$coluna END as nome_tema,i3geoadmin_n3.publicado,i3geoadmin_n3.n3_perfil,i3geoadmin_n3.id_tema,i3geoadmin_temas.download_tema,i3geoadmin_temas.ogc_tema from ".$this->esquemaadmin."i3geoadmin_n3 LEFT JOIN ".$this->esquemaadmin."i3geoadmin_temas ON i3geoadmin_n3.id_tema = i3geoadmin_temas.id_tema "; | |
| 120 | - | |
| 121 | - //$this->sql_temas = "select kmz_tema,nacessos,id_tema,kml_tema,ogc_tema,download_tema,tags_tema,tipoa_tema,link_tema,desc_tema,$coluna as nome_tema,codigo_tema from i3geoadmin_temas "; | |
| 122 | - | |
| 123 | - $this->sql_temas = "select kmz_tema,b.soma as nacessos,id_tema,kml_tema,ogc_tema,download_tema,tags_tema,tipoa_tema,link_tema,desc_tema,CASE $coluna WHEN '' THEN nome_tema ELSE $coluna END as nome_tema,codigo_tema from ".$this->esquemaadmin."i3geoadmin_temas as a,(SELECT c.codigo_tema codigo_soma,sum( r.nacessos) as soma FROM ".$this->esquemaadmin."i3geoadmin_temas c LEFT JOIN ".$this->esquemaadmin."i3geoadmin_acessostema r ON (c.codigo_tema = r.codigo_tema) group by c.codigo_tema) as b WHERE a.codigo_tema = b.codigo_soma "; | |
| 124 | - $this->sql_temas_combo = "select id_tema,CASE $coluna WHEN '' THEN nome_tema ELSE $coluna END as nome_tema,codigo_tema from ".$this->esquemaadmin."i3geoadmin_temas as a,(SELECT c.codigo_tema codigo_soma,sum( r.nacessos) as soma FROM ".$this->esquemaadmin."i3geoadmin_temas c LEFT JOIN ".$this->esquemaadmin."i3geoadmin_acessostema r ON (c.codigo_tema = r.codigo_tema) group by c.codigo_tema) as b WHERE a.codigo_tema = b.codigo_soma "; | |
| 125 | - // | |
| 126 | - //verifica se o ip atual está cadastrado como um dos editores | |
| 127 | - //editores podem ver as coisas marcadas como não publicado | |
| 128 | - //no sistema de administração | |
| 129 | - // | |
| 130 | - $this->editor = false; | |
| 131 | - $this->editor = $this->verificaOperacaoSessao("admin/php/classe_arvore/editor"); | |
| 132 | - $this->pubsql = " (publicado != 'NAO' or publicado is null) and "; | |
| 133 | - if($this->editor){ | |
| 134 | - $this->pubsql = ""; | |
| 135 | - } | |
| 136 | - if(!function_exists("listaTemasIndevidos")){ | |
| 137 | - include_once(dirname(__FILE__)."/../../classesphp/funcoes_gerais.php"); | |
| 138 | - } | |
| 139 | - $this->temasindevidos = listaTemasIndevidos(); | |
| 140 | - } | |
| 141 | - function __destruct() | |
| 142 | - { | |
| 143 | - $this->dbh = null; | |
| 144 | - $this->dbhw = null; | |
| 145 | - } | |
| 146 | - /* | |
| 147 | - Function: validaTemas | |
| 148 | - | |
| 149 | - Remove de um array os temas que nao sao permitidos ao usuario atualmente logado | |
| 150 | - */ | |
| 151 | - function validaTemas($linhas,$id){ | |
| 152 | - $res = array(); | |
| 153 | - foreach($linhas as $l){ | |
| 154 | - if(!in_array($l[$id],$this->temasindevidos)){ | |
| 155 | - array_push($res,$l); | |
| 156 | - } | |
| 157 | - } | |
| 158 | - return $res; | |
| 159 | - } | |
| 160 | - /* | |
| 161 | - Function: pegaListaDeMenus | |
| 162 | - | |
| 163 | - Retorna a lista de menus | |
| 164 | - | |
| 165 | - Parametros: | |
| 166 | - | |
| 167 | - perfil {string} - considera apenas esse perfil | |
| 168 | - | |
| 169 | - Return: | |
| 170 | - | |
| 171 | - {array} | |
| 172 | - */ | |
| 173 | - function pegaListaDeMenus($perfil="",$filtraOgc="nao",$filtraDown="nao") | |
| 174 | - { | |
| 175 | - if($this->idioma == "pt"){ | |
| 176 | - $coluna = "nome_menu"; | |
| 177 | - } | |
| 178 | - else{ | |
| 179 | - $coluna = $this->idioma; | |
| 180 | - } | |
| 181 | - if($this->editor == true) | |
| 182 | - { | |
| 183 | - $perfil = ""; | |
| 184 | - $sql = "SELECT publicado_menu,'' as perfil_menu,aberto,desc_menu,id_menu,CASE $coluna WHEN '' THEN nome_menu ELSE $coluna END as nome_menu from ".$this->esquemaadmin."i3geoadmin_menus order by nome_menu"; | |
| 185 | - } | |
| 186 | - else{ | |
| 187 | - $sql = "SELECT publicado_menu,perfil_menu,aberto,desc_menu,id_menu,CASE $coluna WHEN '' THEN nome_menu ELSE $coluna END as nome_menu from ".$this->esquemaadmin."i3geoadmin_menus where publicado_menu != 'NAO' or publicado_menu is null order by nome_menu"; | |
| 188 | - } | |
| 189 | - $regs = $this->execSQL($sql); | |
| 190 | - $resultado = array(); | |
| 191 | - foreach($regs as $reg){ | |
| 192 | - $a = $reg["perfil_menu"]; | |
| 193 | - $a = str_replace(" ",",",$a); | |
| 194 | - if ($this->verificaOcorrencia($perfil,explode(",",$a))) | |
| 195 | - { | |
| 196 | - $status = "fechado"; | |
| 197 | - if(strtolower($reg["aberto"]) == "sim") | |
| 198 | - $status = "aberto"; | |
| 199 | - $url = ""; | |
| 200 | - $resultado[] = array("desc"=>$this->converte($reg["desc_menu"]),"publicado"=>$reg["publicado_menu"],"nomemenu"=>$this->converte($reg["nome_menu"]),"idmenu"=>$reg["id_menu"],"arquivo"=>"","status"=>$status,"url"=>$url); | |
| 201 | - } | |
| 202 | - } | |
| 203 | - return $resultado; | |
| 204 | - } | |
| 205 | - /* | |
| 206 | - Function: pegaListaDeTiposGrupos | |
| 207 | - | |
| 208 | - Retorna a lista de grupos de um menu | |
| 209 | - | |
| 210 | - Parametros: | |
| 211 | - | |
| 212 | - id_menu {string} | |
| 213 | - | |
| 214 | - Return: | |
| 215 | - | |
| 216 | - {array} | |
| 217 | - */ | |
| 218 | - function pegaListaDeTiposGrupos(){ | |
| 219 | - if($this->idioma == "pt"){ | |
| 220 | - $coluna = "nome_grupo"; | |
| 221 | - } | |
| 222 | - else{ | |
| 223 | - $coluna = $this->idioma; | |
| 224 | - } | |
| 225 | - $sql = "select CASE i3geoadmin_grupos.$coluna WHEN '' THEN nome_grupo ELSE i3geoadmin_grupos.$coluna END as nome_grupo, id_grupo from ".$this->esquemaadmin."i3geoadmin_grupos ORDER by nome_grupo "; | |
| 226 | - $grupos = $this->execSQL($sql); | |
| 227 | - return $grupos; | |
| 228 | - } | |
| 229 | - /* | |
| 230 | - Function: pegaListaDeTiposSubGrupos | |
| 231 | - | |
| 232 | - Retorna a lista de grupos de um menu | |
| 233 | - | |
| 234 | - Parametros: | |
| 235 | - | |
| 236 | - id_menu {string} | |
| 237 | - | |
| 238 | - Return: | |
| 239 | - | |
| 240 | - {array} | |
| 241 | - */ | |
| 242 | - function pegaListaDeTiposSubGrupos(){ | |
| 243 | - if($this->idioma == "pt"){ | |
| 244 | - $coluna = "nome_subgrupo"; | |
| 245 | - } | |
| 246 | - else{ | |
| 247 | - $coluna = $this->idioma; | |
| 248 | - } | |
| 249 | - $sql = "select CASE i3geoadmin_subgrupos.$coluna WHEN '' THEN nome_subgrupo ELSE i3geoadmin_subgrupos.$coluna END as nome_subgrupo, id_subgrupo from ".$this->esquemaadmin."i3geoadmin_subgrupos ORDER by nome_subgrupo "; | |
| 250 | - $subgrupos = $this->execSQL($sql); | |
| 251 | - return $subgrupos; | |
| 252 | - } | |
| 253 | - /* | |
| 254 | - Function: procuraTemas | |
| 255 | - | |
| 256 | - Localiza temas conforme uma palavra de busca | |
| 257 | - | |
| 258 | - Parametros: | |
| 259 | - | |
| 260 | - procurar {string} - palavra de busca | |
| 261 | - | |
| 262 | - perfil {string} - considera apenas esse perfil | |
| 263 | - | |
| 264 | - Return: | |
| 265 | - | |
| 266 | - {array} | |
| 267 | - */ | |
| 268 | - function procuraTemas ($procurar,$perfil) | |
| 269 | - { | |
| 270 | - if($procurar != "") | |
| 271 | - { | |
| 272 | - $procurar = $this->removeAcentos($procurar); | |
| 273 | - } | |
| 274 | - $menus = $this->pegaListaDeMenus($perfil); | |
| 275 | - $resultado = array(); | |
| 276 | - $subgrupo = array(); | |
| 277 | - $final = array(); | |
| 278 | - foreach($menus as $menu) | |
| 279 | - { | |
| 280 | - $grupos = $this->pegaGruposMenu($menu["idmenu"]); | |
| 281 | - foreach($grupos["grupos"] as $grupo) | |
| 282 | - { | |
| 283 | - $a = $grupo["n1_perfil"]; | |
| 284 | - $a = str_replace(" ",",",$a); | |
| 285 | - if($this->verificaOcorrencia($perfil,explode(",",$a))) | |
| 286 | - { | |
| 287 | - $sgrupos = $this->pegaSubgruposGrupo($menu["idmenu"],$grupo["id_n1"]); | |
| 288 | - $temasRaizGrupo = array(); | |
| 289 | - $temasR = $this->pegaTemasRaizGrupo($menu["idmenu"],$grupo["id_n1"]); | |
| 290 | - foreach($temasR as $tema) | |
| 291 | - { | |
| 292 | - $a = $tema["perfil"]; | |
| 293 | - $a = str_replace(" ",",",$a); | |
| 294 | - if($this->verificaOcorrencia($perfil,explode(",",$a))) | |
| 295 | - { | |
| 296 | - $t = $this->pegaTema($tema["id_tema"]); | |
| 297 | - $t = $t[0]; | |
| 298 | - $nome = $this->removeAcentos($tema["nome_tema"]); | |
| 299 | - $tags = $this->removeAcentos($tema["tags_tema"]); | |
| 300 | - $tags1 = $this->removeAcentos(mb_convert_encoding($tema["tags_tema"],"ISO-8859-1","UTF-8")); | |
| 301 | - $nome1 = $this->removeAcentos(mb_convert_encoding($tema["nome_tema"],"ISO-8859-1","UTF-8")); | |
| 302 | - $miniatura = "nao"; | |
| 303 | - if(file_exists($this->locaplic."/temas/miniaturas/".$t["codigo_tema"].".map.mini.png")) | |
| 304 | - { | |
| 305 | - $miniatura = "sim"; | |
| 306 | - } | |
| 307 | - $down = "sim"; | |
| 308 | - if (strtolower($t["download_tema"]) == "nao") | |
| 309 | - { | |
| 310 | - $down = "nao"; | |
| 311 | - } | |
| 312 | - $texto = array("codigo_tema"=>$t["codigo_tema"],"miniatura"=>$miniatura,"tid"=>$t["codigo_tema"],"nome"=>$this->converte($tema["nome_tema"]),"link"=>$t["link_tema"],"download"=>$down); | |
| 313 | - if($procurar == "") | |
| 314 | - { | |
| 315 | - $temasRaizGrupo[] = $texto; | |
| 316 | - } | |
| 317 | - else | |
| 318 | - { | |
| 319 | - if (stristr($nome,$procurar) || stristr($nome1,$procurar)) | |
| 320 | - { | |
| 321 | - $temasRaizGrupo[] = $texto; | |
| 322 | - } | |
| 323 | - else | |
| 324 | - { | |
| 325 | - if (stristr($tags,$procurar) || stristr($tags1,$procurar)) | |
| 326 | - { | |
| 327 | - $temasRaizGrupo[] = $texto; | |
| 328 | - } | |
| 329 | - } | |
| 330 | - } | |
| 331 | - } | |
| 332 | - } | |
| 333 | - foreach($sgrupos["subgrupos"] as $sgrupo) | |
| 334 | - { | |
| 335 | - $a = $sgrupo["n2_perfil"]; | |
| 336 | - $a = str_replace(" ",",",$a); | |
| 337 | - if($this->verificaOcorrencia($perfil,explode(",",$a))) | |
| 338 | - { | |
| 339 | - $temas = $this->pegaTemasSubGrupo($sgrupo["id_n2"]); | |
| 340 | - foreach ($temas as $tema) | |
| 341 | - { | |
| 342 | - $a = $tema["n3_perfil"]; | |
| 343 | - $a = str_replace(" ",",",$a); | |
| 344 | - if($this->verificaOcorrencia($perfil,explode(",",$a))) | |
| 345 | - { | |
| 346 | - $t = $this->pegaTema($tema["id_tema"]); | |
| 347 | - $t = $t[0]; | |
| 348 | - $nome = $this->removeAcentos($tema["nome_tema"]); | |
| 349 | - $tags = $this->removeAcentos($tema["tags_tema"]); | |
| 350 | - $tags1 = $this->removeAcentos(mb_convert_encoding($tema["tags_tema"],"ISO-8859-1","UTF-8")); | |
| 351 | - $nome1 = $this->removeAcentos(mb_convert_encoding($tema["nome_tema"],"ISO-8859-1","UTF-8")); | |
| 352 | - $miniatura = "nao"; | |
| 353 | - if(file_exists($this->locaplic."/temas/miniaturas/".$tema["codigo_tema"].".map.mini.png")) | |
| 354 | - { | |
| 355 | - $miniatura = "sim"; | |
| 356 | - } | |
| 357 | - $down = "sim"; | |
| 358 | - if (strtolower($t["download_tema"]) == "nao") | |
| 359 | - { | |
| 360 | - $down = "nao"; | |
| 361 | - } | |
| 362 | - $texto = array("codigo_tema"=>$tema["codigo_tema"],"miniatura"=>$miniatura,"tid"=>$tema["codigo_tema"],"nome"=>$this->converte($tema["nome_tema"]),"link"=>$t["link_tema"],"download"=>$down); | |
| 363 | - if($procurar == "") | |
| 364 | - { | |
| 365 | - $resultado[] = $texto; | |
| 366 | - } | |
| 367 | - else | |
| 368 | - { | |
| 369 | - if (stristr($nome,$procurar) || stristr($nome1,$procurar)) | |
| 370 | - { | |
| 371 | - $resultado[] = $texto; | |
| 372 | - } | |
| 373 | - else | |
| 374 | - { | |
| 375 | - if (stristr($tags,$procurar) || stristr($tags1,$procurar)) | |
| 376 | - { | |
| 377 | - $resultado[] = $texto; | |
| 378 | - } | |
| 379 | - } | |
| 380 | - } | |
| 381 | - } | |
| 382 | - } | |
| 383 | - } | |
| 384 | - if (count($resultado) > 0) | |
| 385 | - { | |
| 386 | - $subgrupo[] = array("subgrupo"=>$this->converte($sgrupo["nome_subgrupo"]),"temas"=>$resultado); | |
| 387 | - } | |
| 388 | - $resultado = array(); | |
| 389 | - } | |
| 390 | - } | |
| 391 | - if (count($subgrupo) > 0 || count($temasRaizGrupo) > 0) | |
| 392 | - { | |
| 393 | - $final[] = array("grupo"=>$this->converte($grupo["nome_grupo"]),"temas"=>$temasRaizGrupo,"subgrupos"=>$subgrupo); | |
| 394 | - } | |
| 395 | - $subgrupo = array(); | |
| 396 | - } | |
| 397 | - } | |
| 398 | - return $final; | |
| 399 | - } | |
| 400 | - /* | |
| 401 | - Function: procuraTemasEstrela | |
| 402 | - | |
| 403 | - Localiza temas que têm um determinado número (nível) de estrelas | |
| 404 | - | |
| 405 | - Parametros: | |
| 406 | - | |
| 407 | - nivel {numeric} - número de estrelas | |
| 408 | - | |
| 409 | - perfil {string} - considera apenas esse perfil | |
| 410 | - | |
| 411 | - Return: | |
| 412 | - | |
| 413 | - {array} | |
| 414 | - */ | |
| 415 | - function procuraTemasEstrela($nivel,$fatorestrela,$perfil) | |
| 416 | - { | |
| 417 | - $menus = $this->pegaListaDeMenus($perfil); | |
| 418 | - | |
| 419 | - $resultado = array(); | |
| 420 | - $subgrupo = array(); | |
| 421 | - $final = array(); | |
| 422 | - foreach($menus as $menu) | |
| 423 | - { | |
| 424 | - $grupos = $this->pegaGruposMenu($menu["idmenu"]); | |
| 425 | - foreach($grupos["grupos"] as $grupo) | |
| 426 | - { | |
| 427 | - $a = $grupo["n1_perfil"]; | |
| 428 | - $a = str_replace(" ",",",$a); | |
| 429 | - if($this->verificaOcorrencia($perfil,explode(",",$a))) | |
| 430 | - { | |
| 431 | - $sgrupos = $this->pegaSubgruposGrupo($menu["idmenu"],$grupo["id_n1"]); | |
| 432 | - $temasRaizGrupo = array(); | |
| 433 | - $temasR = $this->pegaTemasRaizGrupo($menu["idmenu"],$grupo["id_n1"]); | |
| 434 | - foreach($temasR as $tema) | |
| 435 | - { | |
| 436 | - $a = $tema["perfil"]; | |
| 437 | - $a = str_replace(" ",",",$a); | |
| 438 | - if($this->verificaOcorrencia($perfil,explode(",",$a))) | |
| 439 | - { | |
| 440 | - $t = $this->pegaTema($tema["id_tema"]); | |
| 441 | - $t = $t[0]; | |
| 442 | - $nome = $this->removeAcentos($tema["nome_tema"]); | |
| 443 | - $tags = $this->removeAcentos($tema["tags_tema"]); | |
| 444 | - $tags1 = $this->removeAcentos(mb_convert_encoding($tema["tags_tema"],"ISO-8859-1","UTF-8")); | |
| 445 | - $nome1 = $this->removeAcentos(mb_convert_encoding($tema["nome_tema"],"ISO-8859-1","UTF-8")); | |
| 446 | - $miniatura = "nao"; | |
| 447 | - if(file_exists($this->locaplic."/temas/miniaturas/".$t["codigo_tema"].".map.mini.png")) | |
| 448 | - { | |
| 449 | - $miniatura = "sim"; | |
| 450 | - } | |
| 451 | - $down = "sim"; | |
| 452 | - if (strtolower($t["download_tema"]) == "nao") | |
| 453 | - { | |
| 454 | - $down = "nao"; | |
| 455 | - } | |
| 456 | - $texto = array("codigo_tema"=>$t["codigo_tema"],"miniatura"=>$miniatura,"tid"=>$t["codigo_tema"],"nome"=>$this->converte($tema["nome_tema"]),"link"=>$t["link_tema"],"download"=>$down); | |
| 457 | - $n = intval($t["nacessos"] / $fatorestrela); | |
| 458 | - if($n >= 5){ | |
| 459 | - $n = 5; | |
| 460 | - } | |
| 461 | - | |
| 462 | - if ($n == $nivel) | |
| 463 | - { | |
| 464 | - $temasRaizGrupo[] = $texto; | |
| 465 | - } | |
| 466 | - } | |
| 467 | - } | |
| 468 | - foreach($sgrupos["subgrupos"] as $sgrupo) | |
| 469 | - { | |
| 470 | - $a = $sgrupo["n2_perfil"]; | |
| 471 | - $a = str_replace(" ",",",$a); | |
| 472 | - if($this->verificaOcorrencia($perfil,explode(",",$a))) | |
| 473 | - { | |
| 474 | - $temas = $this->pegaTemasSubGrupo($sgrupo["id_n2"]); | |
| 475 | - foreach ($temas as $tema) | |
| 476 | - { | |
| 477 | - $a = $tema["n3_perfil"]; | |
| 478 | - $a = str_replace(" ",",",$a); | |
| 479 | - if($this->verificaOcorrencia($perfil,explode(",",$a))) | |
| 480 | - { | |
| 481 | - $t = $this->pegaTema($tema["id_tema"]); | |
| 482 | - $t = $t[0]; | |
| 483 | - $nome = $this->removeAcentos($tema["nome_tema"]); | |
| 484 | - $tags = $this->removeAcentos($tema["tags_tema"]); | |
| 485 | - $tags1 = $this->removeAcentos(mb_convert_encoding($tema["tags_tema"],"ISO-8859-1","UTF-8")); | |
| 486 | - $nome1 = $this->removeAcentos(mb_convert_encoding($tema["nome_tema"],"ISO-8859-1","UTF-8")); | |
| 487 | - $miniatura = "nao"; | |
| 488 | - if(file_exists($this->locaplic."/temas/miniaturas/".$tema["codigo_tema"].".map.mini.png")) | |
| 489 | - { | |
| 490 | - $miniatura = "sim"; | |
| 491 | - } | |
| 492 | - $down = "sim"; | |
| 493 | - if (strtolower($t["download_tema"]) == "nao") | |
| 494 | - { | |
| 495 | - $down = "nao"; | |
| 496 | - } | |
| 497 | - $texto = array("codigo_tema"=>$tema["codigo_tema"],"miniatura"=>$miniatura,"tid"=>$tema["codigo_tema"],"nome"=>$this->converte($tema["nome_tema"]),"link"=>$t["link_tema"],"download"=>$down); | |
| 498 | - $n = abs($t["nacessos"] / $fatorestrela); | |
| 499 | - if($n >= 5){ | |
| 500 | - $n = 5; | |
| 501 | - } | |
| 502 | - if ($n == $nivel) | |
| 503 | - { | |
| 504 | - $resultado[] = $texto; | |
| 505 | - } | |
| 506 | - } | |
| 507 | - } | |
| 508 | - } | |
| 509 | - if (count($resultado) > 0) | |
| 510 | - { | |
| 511 | - $subgrupo[] = array("subgrupo"=>$this->converte($sgrupo["nome_subgrupo"]),"temas"=>$resultado); | |
| 512 | - } | |
| 513 | - $resultado = array(); | |
| 514 | - } | |
| 515 | - } | |
| 516 | - if (count($subgrupo) > 0 || count($temasRaizGrupo) > 0) | |
| 517 | - { | |
| 518 | - $final[] = array("grupo"=>$this->converte($grupo["nome_grupo"]),"temas"=>$temasRaizGrupo,"subgrupos"=>$subgrupo); | |
| 519 | - } | |
| 520 | - $subgrupo = array(); | |
| 521 | - } | |
| 522 | - } | |
| 523 | - return $final; | |
| 524 | - } | |
| 525 | - /* | |
| 526 | - Function: pegaGruposMenu | |
| 527 | - | |
| 528 | - Retorna a lista de grupos de um menu | |
| 529 | - | |
| 530 | - Parametros: | |
| 531 | - | |
| 532 | - id_menu {string} | |
| 533 | - | |
| 534 | - Return: | |
| 535 | - | |
| 536 | - {array} | |
| 537 | - */ | |
| 538 | - function pegaGruposMenu($id_menu,$ordenaNome="nao"){ | |
| 539 | - if($ordenaNome == "sim"){ | |
| 540 | - $ordem = "nome_grupo"; | |
| 541 | - } | |
| 542 | - else{ | |
| 543 | - $ordem = "ordem"; | |
| 544 | - } | |
| 545 | - $sqlgrupos = $this->sql_grupos."where ".$this->pubsql." id_menu='$id_menu' order by $ordem"; | |
| 546 | - $sqlraiz = $this->sql_temasraiz."where i3geoadmin_raiz.id_menu='$id_menu' and i3geoadmin_raiz.nivel = 0 order by ordem"; | |
| 547 | - $grupos = $this->execSQL($sqlgrupos); | |
| 548 | - $raiz = $this->execSQL($sqlraiz); | |
| 549 | - $raiz = $this->validaTemas($raiz,"codigo_tema"); | |
| 550 | - return array("raiz"=>$raiz,"grupos"=>$grupos); | |
| 551 | - } | |
| 552 | - /* | |
| 553 | - Function: pegaSubgruposGrupo | |
| 554 | - | |
| 555 | - Retorna a lista de subgrupos de um grupo | |
| 556 | - | |
| 557 | - Parametros: | |
| 558 | - | |
| 559 | - id_menu {string} | |
| 560 | - | |
| 561 | - id_n1 {string} - id do grupo | |
| 562 | - | |
| 563 | - Return: | |
| 564 | - | |
| 565 | - {array} | |
| 566 | - */ | |
| 567 | - function pegaSubgruposGrupo($id_menu,$id_n1,$ordenaNome="nao",$filtraOgc="nao",$filtraDown="nao") | |
| 568 | - { | |
| 569 | - if($ordenaNome == "sim"){ | |
| 570 | - $ordem = "nome_subgrupo"; | |
| 571 | - } | |
| 572 | - else{ | |
| 573 | - $ordem = "ordem"; | |
| 574 | - } | |
| 575 | - $f = ""; | |
| 576 | - if($filtraOgc == "sim" || $filtraDown == "sim"){ | |
| 577 | - $ff = array(); | |
| 578 | - if($filtraOgc == "sim"){ | |
| 579 | - $ff[] = " i3geoadmin_temas.ogc_tema = 'SIM' "; | |
| 580 | - } | |
| 581 | - if($filtraDown == "sim"){ | |
| 582 | - $ff[] = " i3geoadmin_temas.download_tema = 'SIM' "; | |
| 583 | - } | |
| 584 | - $f = implode(" AND ",$ff) . " AND "; | |
| 585 | - } | |
| 586 | - $subgrupos = $this->execSQL($this->sql_subgrupos."where ".$this->pubsql." i3geoadmin_n2.id_n1='$id_n1' order by $ordem"); | |
| 587 | - $raiz = $this->execSQL($this->sql_temasraiz."where $f i3geoadmin_raiz.nivel = 1 and i3geoadmin_raiz.id_nivel = $id_n1 order by ordem"); | |
| 588 | - $raiz = $this->validaTemas($raiz,"codigo_tema"); | |
| 589 | - return array("raiz"=>$raiz,"subgrupos"=>$subgrupos); | |
| 590 | - } | |
| 591 | - /* | |
| 592 | - Function: pegaTemasRaizMenu | |
| 593 | - | |
| 594 | - Retorna a lista de temas da raiz de um menu | |
| 595 | - | |
| 596 | - Parametros: | |
| 597 | - | |
| 598 | - id_menu {string} | |
| 599 | - | |
| 600 | - Return: | |
| 601 | - | |
| 602 | - {array} | |
| 603 | - */ | |
| 604 | - function pegaTemasRaizMenu($id_menu) | |
| 605 | - { | |
| 606 | - $raiz = $this->execSQL($this->sql_temasraiz."where i3geoadmin_raiz.id_menu='$id_menu' and i3geoadmin_raiz.nivel = 0 order by ordem"); | |
| 607 | - $raiz = $this->validaTemas($raiz,"codigo_tema"); | |
| 608 | - return $raiz; | |
| 609 | - } | |
| 610 | - /* | |
| 611 | - Function: pegaTemasRaizGrupo | |
| 612 | - | |
| 613 | - Retorna a lista de temas da raiz de um grupo | |
| 614 | - | |
| 615 | - Parametros: | |
| 616 | - | |
| 617 | - id_menu {string} | |
| 618 | - | |
| 619 | - id_n1 {string} - id do grupo | |
| 620 | - | |
| 621 | - Return: | |
| 622 | - | |
| 623 | - {array} | |
| 624 | - */ | |
| 625 | - function pegaTemasRaizGrupo($id_menu,$id_n1,$filtraOgc="nao",$filtraDown="nao") | |
| 626 | - { | |
| 627 | - $f = ""; | |
| 628 | - if($filtraOgc == "sim" || $filtraDown == "sim"){ | |
| 629 | - $ff = array(); | |
| 630 | - if($filtraOgc == "sim"){ | |
| 631 | - $ff[] = " i3geoadmin_temas.ogc_tema = 'SIM' "; | |
| 632 | - } | |
| 633 | - if($filtraDown == "sim"){ | |
| 634 | - $ff[] = " i3geoadmin_temas.download_tema = 'SIM' "; | |
| 635 | - } | |
| 636 | - $f = implode(" AND ",$ff) . " AND "; | |
| 637 | - } | |
| 638 | - if($id_n1 == ""){ | |
| 639 | - $raiz = $this->execSQL($this->sql_temasraiz."where $f i3geoadmin_raiz.nivel = 1 and i3geoadmin_raiz.id_nivel > 0 order by ordem"); | |
| 640 | - } | |
| 641 | - else { | |
| 642 | - $raiz = $this->execSQL($this->sql_temasraiz."where $f i3geoadmin_raiz.nivel = 1 and i3geoadmin_raiz.id_nivel = $id_n1 order by ordem"); | |
| 643 | - } | |
| 644 | - $raiz = $this->validaTemas($raiz,"codigo_tema"); | |
| 645 | - return $raiz; | |
| 646 | - } | |
| 647 | - /* | |
| 648 | - Function: pegaTodosTemas | |
| 649 | - | |
| 650 | - Retorna os dados de todos os temas | |
| 651 | - | |
| 652 | - Return: | |
| 653 | - | |
| 654 | - {array} | |
| 655 | - */ | |
| 656 | - function pegaTodosTemas($combo=false) | |
| 657 | - { | |
| 658 | - if($combo == true){ | |
| 659 | - $q = $this->execSQL($this->sql_temas_combo." ORDER BY nome_tema ASC"); | |
| 660 | - } | |
| 661 | - else{ | |
| 662 | - $q = $this->execSQL($this->sql_temas." ORDER BY nome_tema ASC"); | |
| 663 | - } | |
| 664 | - if($q){ | |
| 665 | - $q = $this->validaTemas($q,"codigo_tema"); | |
| 666 | - return $q; | |
| 667 | - } | |
| 668 | - } | |
| 669 | - /* | |
| 670 | - Function: pegaTema | |
| 671 | - | |
| 672 | - Retorna os dados de um tema | |
| 673 | - | |
| 674 | - Parametros: | |
| 675 | - | |
| 676 | - id_tema {string} | |
| 677 | - | |
| 678 | - Return: | |
| 679 | - | |
| 680 | - {array} | |
| 681 | - */ | |
| 682 | - function pegaTema($id_tema) | |
| 683 | - { | |
| 684 | - $q = $this->execSQL($this->sql_temas." and id_tema = '$id_tema' "); | |
| 685 | - if($q){ | |
| 686 | - return $q; | |
| 687 | - } | |
| 688 | - else{ | |
| 689 | - //caso de banco de dados antigo | |
| 690 | - $sql = "select kmz_tema,'0' as nacessos,id_tema,kml_tema,ogc_tema,download_tema,tags_tema,tipoa_tema,link_tema,desc_tema,nome_tema,codigo_tema from ".$this->esquemaadmin."i3geoadmin_temas "; | |
| 691 | - $q = $this->execSQL($sql." where id_tema = '$id_tema' "); | |
| 692 | - return $q; | |
| 693 | - } | |
| 694 | - } | |
| 695 | - /* | |
| 696 | - Function: pegaTemaPorCodigo | |
| 697 | - | |
| 698 | - Retorna os dados de um tema buscando por codigo | |
| 699 | - | |
| 700 | - Parametros: | |
| 701 | - | |
| 702 | - codigo_tema {string} | |
| 703 | - | |
| 704 | - Return: | |
| 705 | - | |
| 706 | - {array} | |
| 707 | - */ | |
| 708 | - function pegaTemaPorCodigo($codigo_tema) | |
| 709 | - { | |
| 710 | - $q = $this->execSQL($this->sql_temas." and codigo_tema = '$codigo_tema' "); | |
| 711 | - if($q){ | |
| 712 | - return $q; | |
| 713 | - } | |
| 714 | - else{ | |
| 715 | - //caso de banco de dados antigo | |
| 716 | - $sql = "select kmz_tema,'0' as nacessos,id_tema,kml_tema,ogc_tema,download_tema,tags_tema,tipoa_tema,link_tema,desc_tema,nome_tema,codigo_tema from ".$this->esquemaadmin."i3geoadmin_temas "; | |
| 717 | - $q = $this->execSQL($sql." where codigo_tema = '$codigo_tema' "); | |
| 718 | - return $q; | |
| 719 | - } | |
| 720 | - } | |
| 721 | - /* | |
| 722 | - Function: pegaTemasSubGrupo | |
| 723 | - | |
| 724 | - Retorna os temas de um subgrupo | |
| 725 | - | |
| 726 | - Parametros: | |
| 727 | - | |
| 728 | - id_n2 {string} - id do subgrupo | |
| 729 | - | |
| 730 | - Return: | |
| 731 | - | |
| 732 | - {array} | |
| 733 | - */ | |
| 734 | - function pegaTemasSubGrupo($id_n2,$filtraOgc="nao",$filtraDown="nao") | |
| 735 | - { | |
| 736 | - $f = ""; | |
| 737 | - if($filtraOgc == "sim" || $filtraDown == "sim"){ | |
| 738 | - $ff = array(); | |
| 739 | - if($filtraOgc == "sim"){ | |
| 740 | - $ff[] = " i3geoadmin_temas.ogc_tema = 'SIM' "; | |
| 741 | - } | |
| 742 | - if($filtraDown == "sim"){ | |
| 743 | - $ff[] = " i3geoadmin_temas.download_tema = 'SIM' "; | |
| 744 | - } | |
| 745 | - $f = implode(" AND ",$ff) . " AND "; | |
| 746 | - } | |
| 747 | - $temas = $this->execSQL($this->sql_temasSubgrupo."where $f ".$this->pubsql." i3geoadmin_n3.id_n2='$id_n2' order by ordem"); | |
| 748 | - $temas = $this->validaTemas($temas,"codigo_tema"); | |
| 749 | - return $temas; | |
| 750 | - } | |
| 751 | - /* | |
| 752 | - Function: formataMenus | |
| 753 | - | |
| 754 | - Retorna os menus e temas na raiz de um menu, formatados no padrão da árvore | |
| 755 | - | |
| 756 | - Return: | |
| 757 | - | |
| 758 | - {array} | |
| 759 | - */ | |
| 760 | - function formataMenus(){ | |
| 761 | - } | |
| 762 | - /* | |
| 763 | - Function: formataGruposMenu | |
| 764 | - | |
| 765 | - Retorna os grupos e temas na raiz de um menu, formatados no padrão da árvore | |
| 766 | - | |
| 767 | - Parametros: | |
| 768 | - | |
| 769 | - id_menu {string} | |
| 770 | - | |
| 771 | - perfil {string} | |
| 772 | - | |
| 773 | - listasgrupos {string} - sim|nao | |
| 774 | - | |
| 775 | - Return: | |
| 776 | - | |
| 777 | - {array} | |
| 778 | - */ | |
| 779 | - function formataGruposMenu ($id_menu,$perfil,$listasgrupos,$ordenaNome="nao",$filtraOgc="nao",$filtraDown="nao") | |
| 780 | - { | |
| 781 | - //error_reporting(0); | |
| 782 | - $dados = $this->pegaGruposMenu($id_menu,$ordenaNome); | |
| 783 | - $resultado = array(); | |
| 784 | - $temasraiz = array(); | |
| 785 | - foreach($dados["raiz"] as $temar){ | |
| 786 | - $temasraiz[] = $this->formataTema($temar["id_tema"]); | |
| 787 | - } | |
| 788 | - if(count($dados["grupos"]) == 0){ | |
| 789 | - $grupos[] = array(); | |
| 790 | - } | |
| 791 | - $raizgrupos = $this->pegaTemasRaizGrupo($id_menu,"",$filtraOgc,$filtraDown); | |
| 792 | - //var_dump($raizgrupos);exit; | |
| 793 | - foreach($dados["grupos"] as $grupo) { | |
| 794 | - $a = $grupo["n1_perfil"]; | |
| 795 | - $a = str_replace(" ",",",$a); | |
| 796 | - if($this->verificaOcorrencia($perfil,explode(",",$a)) == true) | |
| 797 | - { | |
| 798 | - $temas = array(); | |
| 799 | - //$raizgrupo = $this->pegaTemasRaizGrupo($id_menu,$grupo["id_n1"],$filtraOgc,$filtraDown); | |
| 800 | - $grupodown = "nao"; | |
| 801 | - $grupoogc = "nao"; | |
| 802 | - foreach($raizgrupos as $tema){ | |
| 803 | - if($tema["id_nivel"] == $grupo["id_n1"]){ | |
| 804 | - $temas[] = $this->formataTema($tema["id_tema"]); | |
| 805 | - } | |
| 806 | - } | |
| 807 | - if($temas > 0){ | |
| 808 | - $grupodown = "sim"; | |
| 809 | - $grupoogc = "sim"; | |
| 810 | - } | |
| 811 | - $subgrupos = array(); | |
| 812 | - if($listasgrupos=="sim"){ | |
| 813 | - $dadossubgrupos = $this->pegaSubgruposGrupo($id_menu,$grupo["id_n1"],$ordenaNome,$filtraOgc,$filtraDown); | |
| 814 | - foreach($dadossubgrupos["subgrupos"] as $sgrupo){ | |
| 815 | - $a = $sgrupo["n2_perfil"]; | |
| 816 | - $a = str_replace(" ",",",$a); | |
| 817 | - if($this->verificaOcorrencia($perfil,explode(",",$a))){ | |
| 818 | - //verifica se existem temas que podem receber download | |
| 819 | - $down = "nao"; | |
| 820 | - $ogc = "nao"; | |
| 821 | - $listaT = $this->pegaTemasSubGrupo($sgrupo["id_n2"],$filtraOgc,$filtraDown); | |
| 822 | - foreach($listaT as $tema){ | |
| 823 | - if(strtolower($tema["tipoa_tema"]) != "wms") | |
| 824 | - { | |
| 825 | - if (strtolower($tema["download_tema"]) != "nao") | |
| 826 | - { | |
| 827 | - $down = "sim";$grupodown = "sim"; | |
| 828 | - } | |
| 829 | - | |
| 830 | - if (strtolower($tema["ogc_tema"]) != "nao") | |
| 831 | - { | |
| 832 | - $ogc = "sim";$grupoogc = "sim"; | |
| 833 | - } | |
| 834 | - } | |
| 835 | - } | |
| 836 | - if(count($listaT) > 0){ | |
| 837 | - $subgrupos[] = array("id_n2"=>$sgrupo["id_n2"],"publicado"=>($sgrupo["publicado"]),"nome"=>$this->converte($sgrupo["nome_subgrupo"]),"download"=>$down,"ogc"=>$ogc); | |
| 838 | - } | |
| 839 | - } | |
| 840 | - } | |
| 841 | - } | |
| 842 | - //evita ocorrencias vazias quando for aplicado um filtro | |
| 843 | - if($filtraOgc == "sim" || $filtraDown == "sim"){ | |
| 844 | - if(count($subgrupos) > 0 || count($temas) > 0){ | |
| 845 | - $grupos[] = array("publicado"=>($grupo["publicado"]),"id_n1"=>($grupo["id_n1"]),"nome"=>$this->converte($grupo["nome_grupo"]),"ogc"=>$grupoogc,"download"=>$grupodown,"subgrupos"=>$subgrupos,"temasgrupo"=>$temas); | |
| 846 | - } | |
| 847 | - } | |
| 848 | - else{ | |
| 849 | - $grupos[] = array("publicado"=>($grupo["publicado"]),"id_n1"=>($grupo["id_n1"]),"nome"=>$this->converte($grupo["nome_grupo"]),"ogc"=>$grupoogc,"download"=>$grupodown,"subgrupos"=>$subgrupos,"temasgrupo"=>$temas); | |
| 850 | - } | |
| 851 | - } | |
| 852 | - } | |
| 853 | - $grupos[] = array("temasraiz"=>$temasraiz); | |
| 854 | - //pega os sistemas checando os perfis | |
| 855 | - $sistemas = array(); | |
| 856 | - $grupos[] = array("idmenu"=>$id_menu); | |
| 857 | - $grupos[] = array("sistemas"=>""); | |
| 858 | - return($grupos); | |
| 859 | - } | |
| 860 | - /* | |
| 861 | - Function: formataSubgruposGrupo | |
| 862 | - | |
| 863 | - Retorna os subgrupos e temas na raiz de um grupo, formatados no padrão da árvore | |
| 864 | - | |
| 865 | - Parametros: | |
| 866 | - | |
| 867 | - id_menu {string} | |
| 868 | - | |
| 869 | - id_n1 {string} - id do grupo | |
| 870 | - | |
| 871 | - perfil {string} | |
| 872 | - | |
| 873 | - Return: | |
| 874 | - | |
| 875 | - {array} | |
| 876 | - */ | |
| 877 | - function formataSubgruposGrupo ($id_menu,$id_n1,$perfil) | |
| 878 | - { | |
| 879 | - $dados = $this->pegaSubgruposGrupo($id_menu,$id_n1); | |
| 880 | - $resultado = array(); | |
| 881 | - $temasraiz = array(); | |
| 882 | - foreach($dados["raiz"] as $temar) | |
| 883 | - { | |
| 884 | - $temasraiz[] = $this->formataTema($temar["id_tema"]); | |
| 885 | - } | |
| 886 | - if(count($dados["subgrupos"]) == 0) | |
| 887 | - { | |
| 888 | - $sgrupos[] = array(); | |
| 889 | - } | |
| 890 | - $subgrupos = array(); | |
| 891 | - foreach($dados["subgrupos"] as $sgrupo) | |
| 892 | - { | |
| 893 | - $a = $sgrupo["n2_perfil"]; | |
| 894 | - $a = str_replace(" ",",",$a); | |
| 895 | - if ($this->verificaOcorrencia($perfil,explode(",",$a))) | |
| 896 | - { | |
| 897 | - $listaT = $this->pegaTemasSubGrupo($sgrupo["id_n2"]); | |
| 898 | - $down = "nao"; | |
| 899 | - $ogc = "nao"; | |
| 900 | - foreach($listaT as $tema) | |
| 901 | - { | |
| 902 | - if(strtolower($tema["tipoa_tema"]) != "wms") | |
| 903 | - { | |
| 904 | - if (strtolower($tema["download_tema"]) != "nao") | |
| 905 | - { | |
| 906 | - $down = "sim"; | |
| 907 | - } | |
| 908 | - if (strtolower($tema["ogc_tema"]) != "nao") | |
| 909 | - { | |
| 910 | - $ogc = "sim"; | |
| 911 | - } | |
| 912 | - } | |
| 913 | - } | |
| 914 | - if(count($listaT) > 0) | |
| 915 | - { | |
| 916 | - $subgrupos[] = array("publicado"=>($sgrupo["publicado"]),"id_n2"=>($sgrupo["id_n2"]),"nome"=>$this->converte($sgrupo["nome_subgrupo"]),"download"=>$down,"ogc"=>$ogc,"temas"=>$listaT); | |
| 917 | - } | |
| 918 | - } | |
| 919 | - } | |
| 920 | - return (array("subgrupo"=>$subgrupos,"temasgrupo"=>$temasraiz)); | |
| 921 | - } | |
| 922 | - /* | |
| 923 | - Function: formataTemasSubgrupo | |
| 924 | - | |
| 925 | - Retorna os temas de um subgrupo, formatados no padrão da árvore | |
| 926 | - | |
| 927 | - Parametros: | |
| 928 | - | |
| 929 | - id_n2 {string} - id do subgrupo | |
| 930 | - | |
| 931 | - perfil {string} | |
| 932 | - | |
| 933 | - Return: | |
| 934 | - | |
| 935 | - {array} | |
| 936 | - */ | |
| 937 | - function formataTemasSubgrupo($id_n2,$perfil) | |
| 938 | - { | |
| 939 | - $dados = $this->pegaTemasSubGrupo($id_n2); | |
| 940 | - $temas = array(); | |
| 941 | - foreach($dados as $tema) | |
| 942 | - { | |
| 943 | - $a = $tema["n3_perfil"]; | |
| 944 | - $a = str_replace(" ",",",$a); | |
| 945 | - if($this->verificaOcorrencia($perfil,explode(",",$a))) | |
| 946 | - { | |
| 947 | - $temas[] = $this->formataTema($tema["id_tema"],$tema["publicado"]); | |
| 948 | - } | |
| 949 | - } | |
| 950 | - return $temas; | |
| 951 | - } | |
| 952 | - /* | |
| 953 | - Function: formataTema | |
| 954 | - | |
| 955 | - Retorna os dados de um tema, formatados no padrão da árvore | |
| 956 | - | |
| 957 | - Parametros: | |
| 958 | - | |
| 959 | - id_tema {string} | |
| 960 | - | |
| 961 | - publicado {string} - SIM|NAO valor do índice "publicado" que será incluído no array de retorno | |
| 962 | - | |
| 963 | - Return: | |
| 964 | - | |
| 965 | - {array} | |
| 966 | - */ | |
| 967 | - function formataTema($id_tema,$publicado="SIM") | |
| 968 | - { | |
| 969 | - $recordset = $this->pegaTema($id_tema); | |
| 970 | - $recordset = $recordset[0]; | |
| 971 | - $down = "sim"; | |
| 972 | - $ogc = "sim"; | |
| 973 | - $link = " "; | |
| 974 | - $kmz = "nao"; | |
| 975 | - if (strtolower($recordset["download_tema"]) == "nao") | |
| 976 | - { | |
| 977 | - $down = "nao"; | |
| 978 | - } | |
| 979 | - if (strtolower($recordset["ogc_tema"]) == "nao") | |
| 980 | - { | |
| 981 | - $ogc = "nao"; | |
| 982 | - } | |
| 983 | - if(strtolower($recordset["tipoa_tema"]) == "wms") | |
| 984 | - { | |
| 985 | - $down = "nao"; | |
| 986 | - $ogc = "nao"; | |
| 987 | - } | |
| 988 | - if ($recordset["link_tema"] != "") | |
| 989 | - { | |
| 990 | - $link = $recordset["link_tema"]; | |
| 991 | - } | |
| 992 | - if (strtolower($recordset["kmz_tema"]) == "sim") | |
| 993 | - { | |
| 994 | - $kmz = "sim"; | |
| 995 | - } | |
| 996 | - //codigo_tema para fins de compatibilidade | |
| 997 | - return array("codigo_tema"=>($recordset["codigo_tema"]),"tipoa_tema"=>$recordset["tipoa_tema"],"publicado"=>$publicado,"nacessos"=>($recordset["nacessos"]),"tid"=>($recordset["codigo_tema"]),"nome"=>$this->converte($recordset["nome_tema"]),"link"=>$link,"download"=>$down,"ogc"=>$ogc,"kmz"=>$kmz); | |
| 998 | - } | |
| 999 | - /* | |
| 1000 | - Function: execSQL | |
| 1001 | - | |
| 1002 | - Executa um SQL no banco de administração | |
| 1003 | - | |
| 1004 | - Parametros: | |
| 1005 | - | |
| 1006 | - sql {string} | |
| 1007 | - | |
| 1008 | - Return: | |
| 1009 | - | |
| 1010 | - {array} | |
| 1011 | - */ | |
| 1012 | - function execSQL($sql) | |
| 1013 | - { | |
| 1014 | - //echo "<br>".$sql; | |
| 1015 | - //error_reporting(0); | |
| 1016 | - $sql = str_ireplace(array("update","delete","insert","--","drop",";"),"",$sql); | |
| 1017 | - $q = $this->dbh->query($sql,PDO::FETCH_ASSOC); | |
| 1018 | - if($q) | |
| 1019 | - { | |
| 1020 | - return $q->fetchAll(); | |
| 1021 | - } | |
| 1022 | - else | |
| 1023 | - {return false; | |
| 1024 | - } | |
| 1025 | - } | |
| 1026 | - /* | |
| 1027 | - Verifica se uma string ocorre em um array | |
| 1028 | - */ | |
| 1029 | - function verificaOcorrencia($procurar,$em) | |
| 1030 | - { | |
| 1031 | - if(count($em) == 1 && $em[0] == "") | |
| 1032 | - { | |
| 1033 | - $em = ""; | |
| 1034 | - } | |
| 1035 | - if($procurar == "" && $em == "") | |
| 1036 | - { | |
| 1037 | - return true; | |
| 1038 | - } | |
| 1039 | - if($em == "") | |
| 1040 | - { | |
| 1041 | - return true; | |
| 1042 | - } | |
| 1043 | - $resultado = false; | |
| 1044 | - if($procurar != "" && $em != "") | |
| 1045 | - { | |
| 1046 | - foreach($em as $e) | |
| 1047 | - { | |
| 1048 | - $e = trim($e); | |
| 1049 | - foreach($procurar as $p) | |
| 1050 | - { | |
| 1051 | - $p = trim($p); | |
| 1052 | - if($p == $e) | |
| 1053 | - { | |
| 1054 | - $resultado = true; | |
| 1055 | - } | |
| 1056 | - } | |
| 1057 | - } | |
| 1058 | - } | |
| 1059 | - return $resultado; | |
| 1060 | - } | |
| 1061 | - function seems_utf8($Str) { # by bmorel at ssi dot fr | |
| 1062 | - $length = strlen($Str); | |
| 1063 | - for ($i = 0; $i < $length; $i++) { | |
| 1064 | - if (ord($Str[$i]) < 0x80) continue; # 0bbbbbbb | |
| 1065 | - elseif ((ord($Str[$i]) & 0xE0) == 0xC0) $n = 1; # 110bbbbb | |
| 1066 | - elseif ((ord($Str[$i]) & 0xF0) == 0xE0) $n = 2; # 1110bbbb | |
| 1067 | - elseif ((ord($Str[$i]) & 0xF8) == 0xF0) $n = 3; # 11110bbb | |
| 1068 | - elseif ((ord($Str[$i]) & 0xFC) == 0xF8) $n = 4; # 111110bb | |
| 1069 | - elseif ((ord($Str[$i]) & 0xFE) == 0xFC) $n = 5; # 1111110b | |
| 1070 | - else return false; # Does not match any model | |
| 1071 | - for ($j = 0; $j < $n; $j++) { # n bytes matching 10bbbbbb follow ? | |
| 1072 | - if ((++$i == $length) || ((ord($Str[$i]) & 0xC0) != 0x80)) | |
| 1073 | - return false; | |
| 1074 | - } | |
| 1075 | - } | |
| 1076 | - return true; | |
| 1077 | - } | |
| 1078 | - /** | |
| 1079 | - * | |
| 1080 | - * TODO Verificar ao fechar versao - verificar a acentuacao das palavras nessa funcao | |
| 1081 | - */ | |
| 1082 | - function removeAcentos($s) | |
| 1083 | - { | |
| 1084 | - $s = ereg_replace("[áàâã]","a",$s); | |
| 1085 | - $s = ereg_replace("[ÁÀÂÃ]","A",$s); | |
| 1086 | - $s = ereg_replace("[éèê]","e",$s); | |
| 1087 | - $s = ereg_replace("[í]","i",$s); | |
| 1088 | - $s = ereg_replace("[Í]","I",$s); | |
| 1089 | - $s = ereg_replace("[ÉÈÊ]","E",$s); | |
| 1090 | - $s = ereg_replace("[óòôõ]","o",$s); | |
| 1091 | - $s = ereg_replace("[ÓÒÔÕ]","O",$s); | |
| 1092 | - $s = ereg_replace("[úùû]","u",$s); | |
| 1093 | - $s = ereg_replace("[ÚÙÛ]","U",$s); | |
| 1094 | - $s = str_replace("ç","c",$s); | |
| 1095 | - $s = str_replace("Ç","C",$s); | |
| 1096 | - //$str = htmlentities($s); | |
| 1097 | - $str = preg_replace("/(&)([a-z])([a-z]+;)/i", '$2', $s); | |
| 1098 | - $str = preg_replace("/[^A-Z0-9]/i", ' ', $str); | |
| 1099 | - $string = preg_replace("/\s+/i", ' ', $str); | |
| 1100 | - | |
| 1101 | - if (!preg_match('/[\x80-\xff]/', $string)){ | |
| 1102 | - return $string; | |
| 1103 | - } | |
| 1104 | - if ($this->seems_utf8($string)) { | |
| 1105 | - $chars = array( | |
| 1106 | - // Decompositions for Latin-1 Supplement | |
| 1107 | - chr(195).chr(128) => 'A', chr(195).chr(129) => 'A', | |
| 1108 | - chr(195).chr(130) => 'A', chr(195).chr(131) => 'A', | |
| 1109 | - chr(195).chr(132) => 'A', chr(195).chr(133) => 'A', | |
| 1110 | - chr(195).chr(135) => 'C', chr(195).chr(136) => 'E', | |
| 1111 | - chr(195).chr(137) => 'E', chr(195).chr(138) => 'E', | |
| 1112 | - chr(195).chr(139) => 'E', chr(195).chr(140) => 'I', | |
| 1113 | - chr(195).chr(141) => 'I', chr(195).chr(142) => 'I', | |
| 1114 | - chr(195).chr(143) => 'I', chr(195).chr(145) => 'N', | |
| 1115 | - chr(195).chr(146) => 'O', chr(195).chr(147) => 'O', | |
| 1116 | - chr(195).chr(148) => 'O', chr(195).chr(149) => 'O', | |
| 1117 | - chr(195).chr(150) => 'O', chr(195).chr(153) => 'U', | |
| 1118 | - chr(195).chr(154) => 'U', chr(195).chr(155) => 'U', | |
| 1119 | - chr(195).chr(156) => 'U', chr(195).chr(157) => 'Y', | |
| 1120 | - chr(195).chr(159) => 's', chr(195).chr(160) => 'a', | |
| 1121 | - chr(195).chr(161) => 'a', chr(195).chr(162) => 'a', | |
| 1122 | - chr(195).chr(163) => 'a', chr(195).chr(164) => 'a', | |
| 1123 | - chr(195).chr(165) => 'a', chr(195).chr(167) => 'c', | |
| 1124 | - chr(195).chr(168) => 'e', chr(195).chr(169) => 'e', | |
| 1125 | - chr(195).chr(170) => 'e', chr(195).chr(171) => 'e', | |
| 1126 | - chr(195).chr(172) => 'i', chr(195).chr(173) => 'i', | |
| 1127 | - chr(195).chr(174) => 'i', chr(195).chr(175) => 'i', | |
| 1128 | - chr(195).chr(177) => 'n', chr(195).chr(178) => 'o', | |
| 1129 | - chr(195).chr(179) => 'o', chr(195).chr(180) => 'o', | |
| 1130 | - chr(195).chr(181) => 'o', chr(195).chr(182) => 'o', | |
| 1131 | - chr(195).chr(182) => 'o', chr(195).chr(185) => 'u', | |
| 1132 | - chr(195).chr(186) => 'u', chr(195).chr(187) => 'u', | |
| 1133 | - chr(195).chr(188) => 'u', chr(195).chr(189) => 'y', | |
| 1134 | - chr(195).chr(191) => 'y', | |
| 1135 | - // Decompositions for Latin Extended-A | |
| 1136 | - chr(196).chr(128) => 'A', chr(196).chr(129) => 'a', | |
| 1137 | - chr(196).chr(130) => 'A', chr(196).chr(131) => 'a', | |
| 1138 | - chr(196).chr(132) => 'A', chr(196).chr(133) => 'a', | |
| 1139 | - chr(196).chr(134) => 'C', chr(196).chr(135) => 'c', | |
| 1140 | - chr(196).chr(136) => 'C', chr(196).chr(137) => 'c', | |
| 1141 | - chr(196).chr(138) => 'C', chr(196).chr(139) => 'c', | |
| 1142 | - chr(196).chr(140) => 'C', chr(196).chr(141) => 'c', | |
| 1143 | - chr(196).chr(142) => 'D', chr(196).chr(143) => 'd', | |
| 1144 | - chr(196).chr(144) => 'D', chr(196).chr(145) => 'd', | |
| 1145 | - chr(196).chr(146) => 'E', chr(196).chr(147) => 'e', | |
| 1146 | - chr(196).chr(148) => 'E', chr(196).chr(149) => 'e', | |
| 1147 | - chr(196).chr(150) => 'E', chr(196).chr(151) => 'e', | |
| 1148 | - chr(196).chr(152) => 'E', chr(196).chr(153) => 'e', | |
| 1149 | - chr(196).chr(154) => 'E', chr(196).chr(155) => 'e', | |
| 1150 | - chr(196).chr(156) => 'G', chr(196).chr(157) => 'g', | |
| 1151 | - chr(196).chr(158) => 'G', chr(196).chr(159) => 'g', | |
| 1152 | - chr(196).chr(160) => 'G', chr(196).chr(161) => 'g', | |
| 1153 | - chr(196).chr(162) => 'G', chr(196).chr(163) => 'g', | |
| 1154 | - chr(196).chr(164) => 'H', chr(196).chr(165) => 'h', | |
| 1155 | - chr(196).chr(166) => 'H', chr(196).chr(167) => 'h', | |
| 1156 | - chr(196).chr(168) => 'I', chr(196).chr(169) => 'i', | |
| 1157 | - chr(196).chr(170) => 'I', chr(196).chr(171) => 'i', | |
| 1158 | - chr(196).chr(172) => 'I', chr(196).chr(173) => 'i', | |
| 1159 | - chr(196).chr(174) => 'I', chr(196).chr(175) => 'i', | |
| 1160 | - chr(196).chr(176) => 'I', chr(196).chr(177) => 'i', | |
| 1161 | - chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij', | |
| 1162 | - chr(196).chr(180) => 'J', chr(196).chr(181) => 'j', | |
| 1163 | - chr(196).chr(182) => 'K', chr(196).chr(183) => 'k', | |
| 1164 | - chr(196).chr(184) => 'k', chr(196).chr(185) => 'L', | |
| 1165 | - chr(196).chr(186) => 'l', chr(196).chr(187) => 'L', | |
| 1166 | - chr(196).chr(188) => 'l', chr(196).chr(189) => 'L', | |
| 1167 | - chr(196).chr(190) => 'l', chr(196).chr(191) => 'L', | |
| 1168 | - chr(197).chr(128) => 'l', chr(197).chr(129) => 'L', | |
| 1169 | - chr(197).chr(130) => 'l', chr(197).chr(131) => 'N', | |
| 1170 | - chr(197).chr(132) => 'n', chr(197).chr(133) => 'N', | |
| 1171 | - chr(197).chr(134) => 'n', chr(197).chr(135) => 'N', | |
| 1172 | - chr(197).chr(136) => 'n', chr(197).chr(137) => 'N', | |
| 1173 | - chr(197).chr(138) => 'n', chr(197).chr(139) => 'N', | |
| 1174 | - chr(197).chr(140) => 'O', chr(197).chr(141) => 'o', | |
| 1175 | - chr(197).chr(142) => 'O', chr(197).chr(143) => 'o', | |
| 1176 | - chr(197).chr(144) => 'O', chr(197).chr(145) => 'o', | |
| 1177 | - chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe', | |
| 1178 | - chr(197).chr(148) => 'R',chr(197).chr(149) => 'r', | |
| 1179 | - chr(197).chr(150) => 'R',chr(197).chr(151) => 'r', | |
| 1180 | - chr(197).chr(152) => 'R',chr(197).chr(153) => 'r', | |
| 1181 | - chr(197).chr(154) => 'S',chr(197).chr(155) => 's', | |
| 1182 | - chr(197).chr(156) => 'S',chr(197).chr(157) => 's', | |
| 1183 | - chr(197).chr(158) => 'S',chr(197).chr(159) => 's', | |
| 1184 | - chr(197).chr(160) => 'S', chr(197).chr(161) => 's', | |
| 1185 | - chr(197).chr(162) => 'T', chr(197).chr(163) => 't', | |
| 1186 | - chr(197).chr(164) => 'T', chr(197).chr(165) => 't', | |
| 1187 | - chr(197).chr(166) => 'T', chr(197).chr(167) => 't', | |
| 1188 | - chr(197).chr(168) => 'U', chr(197).chr(169) => 'u', | |
| 1189 | - chr(197).chr(170) => 'U', chr(197).chr(171) => 'u', | |
| 1190 | - chr(197).chr(172) => 'U', chr(197).chr(173) => 'u', | |
| 1191 | - chr(197).chr(174) => 'U', chr(197).chr(175) => 'u', | |
| 1192 | - chr(197).chr(176) => 'U', chr(197).chr(177) => 'u', | |
| 1193 | - chr(197).chr(178) => 'U', chr(197).chr(179) => 'u', | |
| 1194 | - chr(197).chr(180) => 'W', chr(197).chr(181) => 'w', | |
| 1195 | - chr(197).chr(182) => 'Y', chr(197).chr(183) => 'y', | |
| 1196 | - chr(197).chr(184) => 'Y', chr(197).chr(185) => 'Z', | |
| 1197 | - chr(197).chr(186) => 'z', chr(197).chr(187) => 'Z', | |
| 1198 | - chr(197).chr(188) => 'z', chr(197).chr(189) => 'Z', | |
| 1199 | - chr(197).chr(190) => 'z', chr(197).chr(191) => 's', | |
| 1200 | - // Euro Sign | |
| 1201 | - chr(226).chr(130).chr(172) => 'E', | |
| 1202 | - // GBP (Pound) Sign | |
| 1203 | - chr(194).chr(163) => ''); | |
| 1204 | - $string = strtr($string, $chars); | |
| 1205 | - } else { | |
| 1206 | - // Assume ISO-8859-1 if not UTF-8 | |
| 1207 | - $chars['in'] = chr(128).chr(131).chr(138).chr(142).chr(154).chr(158) | |
| 1208 | - .chr(159).chr(162).chr(165).chr(181).chr(192).chr(193).chr(194) | |
| 1209 | - .chr(195).chr(196).chr(197).chr(199).chr(200).chr(201).chr(202) | |
| 1210 | - .chr(203).chr(204).chr(205).chr(206).chr(207).chr(209).chr(210) | |
| 1211 | - .chr(211).chr(212).chr(213).chr(214).chr(216).chr(217).chr(218) | |
| 1212 | - .chr(219).chr(220).chr(221).chr(224).chr(225).chr(226).chr(227) | |
| 1213 | - .chr(228).chr(229).chr(231).chr(232).chr(233).chr(234).chr(235) | |
| 1214 | - .chr(236).chr(237).chr(238).chr(239).chr(241).chr(242).chr(243) | |
| 1215 | - .chr(244).chr(245).chr(246).chr(248).chr(249).chr(250).chr(251) | |
| 1216 | - .chr(252).chr(253).chr(255); | |
| 1217 | - $chars['out'] = "EfSZszYcYuAAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiinoooooouuuuyy"; | |
| 1218 | - $string = strtr($string, $chars['in'], $chars['out']); | |
| 1219 | - $double_chars['in'] = array(chr(140), chr(156), chr(198), chr(208), chr(222), chr(223), chr(230), chr(240), chr(254)); | |
| 1220 | - $double_chars['out'] = array('OE', 'oe', 'AE', 'DH', 'TH', 'ss', 'ae', 'dh', 'th'); | |
| 1221 | - $string = str_replace($double_chars['in'], $double_chars['out'], $string); | |
| 1222 | - } | |
| 1223 | - return $string; | |
| 1224 | - } | |
| 1225 | - function converte($texto){ | |
| 1226 | - if($this->convUTF == true) | |
| 1227 | - $texto = mb_convert_encoding($texto,mb_detect_encoding($texto),"UTF-8"); | |
| 1228 | - else | |
| 1229 | - $texto = mb_convert_encoding($texto,mb_detect_encoding($texto),"ISO-8859-1"); | |
| 1230 | - return $texto; | |
| 1231 | - } | |
| 1232 | - function verificaPapelSessao($id_papel){ | |
| 1233 | - if(!empty($_COOKIE["i3geocodigologin"])){ | |
| 1234 | - session_write_close(); | |
| 1235 | - session_name("i3GeoLogin"); | |
| 1236 | - session_id($_COOKIE["i3geocodigologin"]); | |
| 1237 | - session_start(); | |
| 1238 | - //var_dump($_SESSION);exit; | |
| 1239 | - if($_SESSION["usuario"] != $_COOKIE["i3geousuariologin"]){ | |
| 1240 | - return false; | |
| 1241 | - } | |
| 1242 | - foreach($_SESSION["papeis"] as $p){ | |
| 1243 | - if($p == 1 || $p == $id_papel){ | |
| 1244 | - return true; | |
| 1245 | - } | |
| 1246 | - } | |
| 1247 | - } | |
| 1248 | - else{//caso nao exista, retorna um erro | |
| 1249 | - return false; | |
| 1250 | - } | |
| 1251 | - } | |
| 1252 | - function verificaOperacaoSessao($operacao){ | |
| 1253 | - if($_COOKIE["i3geocodigologin"] != ""){ | |
| 1254 | - session_write_close(); | |
| 1255 | - session_name("i3GeoLogin"); | |
| 1256 | - session_id($_COOKIE["i3geocodigologin"]); | |
| 1257 | - session_start(); | |
| 1258 | - $resultado = false; | |
| 1259 | - //verifica se e administrador | |
| 1260 | - foreach($_SESSION["papeis"] as $p){ | |
| 1261 | - if($p == 1){ | |
| 1262 | - return true; | |
| 1263 | - } | |
| 1264 | - } | |
| 1265 | - if(!empty($_SESSION["operacoes"][$operacao])){ | |
| 1266 | - $resultado = true; | |
| 1267 | - } | |
| 1268 | - return $resultado; | |
| 1269 | - } else { | |
| 1270 | - return false; | |
| 1271 | - } | |
| 1272 | - } | |
| 1273 | -} | |
| 1274 | -?> | |
| 1275 | 0 | \ No newline at end of file |
| ... | ... | @@ -0,0 +1,1268 @@ |
| 1 | +<?php | |
| 2 | +/* | |
| 3 | +Title: classe_arvore.php | |
| 4 | + | |
| 5 | +Funções para montagem da árvore de temas | |
| 6 | + | |
| 7 | +Licenca: | |
| 8 | + | |
| 9 | +GPL2 | |
| 10 | + | |
| 11 | +i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet | |
| 12 | + | |
| 13 | +Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil | |
| 14 | +Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com | |
| 15 | + | |
| 16 | +Este programa é software livre; você pode redistribuí-lo | |
| 17 | +e/ou modificá-lo sob os termos da Licença Pública Geral | |
| 18 | +GNU conforme publicada pela Free Software Foundation; | |
| 19 | + | |
| 20 | +Este programa é distribuído na expectativa de que seja útil, | |
| 21 | +porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita | |
| 22 | +de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. | |
| 23 | +Consulte a Licença Pública Geral do GNU para mais detalhes. | |
| 24 | +Você deve ter recebido uma c�pia da Licença Pública Geral do | |
| 25 | + GNU junto com este programa; se não, escreva para a | |
| 26 | +Free Software Foundation, Inc., no endereço | |
| 27 | +59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 28 | + | |
| 29 | +Arquivo: | |
| 30 | + | |
| 31 | +i3geo/classesphp/classe_arvore.php | |
| 32 | +*/ | |
| 33 | +/* | |
| 34 | +Classe: Arvore | |
| 35 | + | |
| 36 | +Classe utilizada para compor a árvore de temas ou obter dados específicos da árvore. | |
| 37 | + | |
| 38 | +É utilizada por várias operações do i3Geo, principalmente pela <classe_menutemas> | |
| 39 | +*/ | |
| 40 | +class Arvore | |
| 41 | +{ | |
| 42 | + //temas com acesso restrito e que nao podem ser acessados pelo usuario que esta logado | |
| 43 | + public $temassindevidos; | |
| 44 | + protected $locaplic; | |
| 45 | + //subgrupos que tem pelo menos um tema | |
| 46 | + //public $sql_subgrupos = "select i3geoadmin_subgrupos.nome_subgrupo,i3geoadmin_n2.id_n2,i3geoadmin_n2.publicado,i3geoadmin_n2.n2_perfil from i3geoadmin_n2 LEFT JOIN i3geoadmin_subgrupos ON i3geoadmin_n2.id_subgrupo = i3geoadmin_subgrupos.id_subgrupo "; | |
| 47 | + //grupos que tem pelo menos um sub-grupo | |
| 48 | + //public $sql_grupos = "select i3geoadmin_grupos.nome_grupo,id_n1,id_menu,i3geoadmin_n1.publicado,n1_perfil from i3geoadmin_n1 LEFT JOIN i3geoadmin_grupos ON i3geoadmin_n1.id_grupo = i3geoadmin_grupos.id_grupo "; | |
| 49 | + //nomes de todos os grupos | |
| 50 | + public $sql_todosgrupos = "select * from i3geoadmin_grupos "; | |
| 51 | + //tipo de filtro | |
| 52 | + //ogc|download|"" | |
| 53 | + public $filtro; | |
| 54 | + //temas na raiz | |
| 55 | + //public $sql_temasraiz = "select id_raiz,i3geoadmin_raiz.id_tema,nome_tema,tipoa_tema FROM i3geoadmin_raiz LEFT JOIN i3geoadmin_temas ON i3geoadmin_temas.id_tema = i3geoadmin_raiz.id_tema "; | |
| 56 | + //todos os temas | |
| 57 | + //public $sql_temas = "select * from i3geoadmin_temas "; | |
| 58 | + //temas de um subgrupo | |
| 59 | + //public $sql_temasSubgrupo = "select i3geoadmin_temas.tipoa_tema, i3geoadmin_temas.codigo_tema,i3geoadmin_temas.tags_tema,i3geoadmin_n3.id_n3,i3geoadmin_temas.nome_tema,i3geoadmin_n3.publicado,i3geoadmin_n3.n3_perfil,i3geoadmin_n3.id_tema,i3geoadmin_temas.download_tema,i3geoadmin_temas.ogc_tema from i3geoadmin_n3 LEFT JOIN i3geoadmin_temas ON i3geoadmin_n3.id_tema = i3geoadmin_temas.id_tema "; | |
| 60 | + /* | |
| 61 | + Function: __construct | |
| 62 | + | |
| 63 | + Cria um objeto Arvore | |
| 64 | + | |
| 65 | + Parametros: | |
| 66 | + | |
| 67 | + locaplic {string} - localização do i3geo no sistema de arquivos | |
| 68 | + | |
| 69 | + idioma {string} - default = "pt" | |
| 70 | + */ | |
| 71 | + function __construct($locaplic,$idioma="pt",$filtro="") | |
| 72 | + { | |
| 73 | + $this->locaplic = $locaplic; | |
| 74 | + $this->filtro = $filtro; | |
| 75 | + $dbh = ""; | |
| 76 | + //error_reporting(0); | |
| 77 | + | |
| 78 | + include($locaplic."/classesphp/conexao.php"); | |
| 79 | + | |
| 80 | + $this->esquemaadmin = $esquemaadmin; | |
| 81 | + $this->convUTF = $convUTF; | |
| 82 | + $this->dbh = $dbh; | |
| 83 | + | |
| 84 | + $this->idioma = $idioma; | |
| 85 | + if($idioma == "pt"){ | |
| 86 | + $coluna = "nome_grupo"; | |
| 87 | + } | |
| 88 | + else{ | |
| 89 | + $coluna = $idioma; | |
| 90 | + } | |
| 91 | + $this->sql_grupos = "select CASE i3geoadmin_grupos.$coluna WHEN '' THEN nome_grupo ELSE i3geoadmin_grupos.$coluna END as nome_grupo,i3geoadmin_grupos.id_grupo, id_n1,id_menu,i3geoadmin_n1.publicado,n1_perfil,ordem from ".$this->esquemaadmin."i3geoadmin_n1 LEFT JOIN ".$this->esquemaadmin."i3geoadmin_grupos ON i3geoadmin_n1.id_grupo = i3geoadmin_grupos.id_grupo "; | |
| 92 | + if($filtro === "ogc" || $filtro === "download"){ | |
| 93 | + //esse sql retorna tambem os grupos dos temas que estao na raiz do grupo | |
| 94 | + $this->sql_grupos = "select DISTINCT * from (select CASE grupos.$coluna WHEN '' THEN nome_grupo ELSE grupos.$coluna END as nome_grupo,gr.id_n1,gr.id_menu,gr.publicado,gr.n1_perfil, 0 as ordem from ".$this->esquemaadmin."i3geoadmin_grupos as grupos, ".$this->esquemaadmin."i3geoadmin_n1 as gr, ".$this->esquemaadmin."i3geoadmin_n2 as sg, ".$this->esquemaadmin."i3geoadmin_n3 as t, ".$this->esquemaadmin."i3geoadmin_temas as temas where gr.id_grupo = grupos.id_grupo AND sg.id_n1 = gr.id_n1 AND t.id_n2 = sg.id_n2 AND t.id_tema = temas.id_tema AND (temas.ogc_tema NOT IN ('NAO','nao') OR temas.download_tema NOT IN ('NAO','nao') ) UNION select c.nome_grupo as nome_grupo,a.id_nivel as id_n1,a.id_menu,'SIM' as publicado,a.perfil as n1_perfil, 0 as ordem from ".$this->esquemaadmin."i3geoadmin_raiz as a, ".$this->esquemaadmin."i3geoadmin_temas as b, ".$this->esquemaadmin."i3geoadmin_grupos as c, ".$this->esquemaadmin."i3geoadmin_n1 as d where nivel = 1 AND a.id_tema = b.id_tema AND a.id_nivel = d.id_n1 AND d.id_grupo = c.id_grupo) as s "; | |
| 95 | + } | |
| 96 | + | |
| 97 | + if($idioma == "pt"){ | |
| 98 | + $coluna = "nome_subgrupo"; | |
| 99 | + } | |
| 100 | + else{ | |
| 101 | + $coluna = $idioma; | |
| 102 | + } | |
| 103 | + $this->sql_subgrupos = "select CASE i3geoadmin_subgrupos.$coluna WHEN '' THEN nome_subgrupo ELSE i3geoadmin_subgrupos.$coluna END as nome_subgrupo,i3geoadmin_subgrupos.id_subgrupo,i3geoadmin_n2.id_n2,i3geoadmin_n2.publicado,i3geoadmin_n2.n2_perfil from ".$this->esquemaadmin."i3geoadmin_n2 LEFT JOIN ".$this->esquemaadmin."i3geoadmin_subgrupos ON i3geoadmin_n2.id_subgrupo = i3geoadmin_subgrupos.id_subgrupo "; | |
| 104 | + | |
| 105 | + if($idioma == "pt"){ | |
| 106 | + $coluna = "nome_tema"; | |
| 107 | + } | |
| 108 | + else{ | |
| 109 | + $coluna = $idioma; | |
| 110 | + } | |
| 111 | + | |
| 112 | + $this->sql_temasraiz = "select id_nivel,ordem,codigo_tema,id_raiz,i3geoadmin_raiz.id_tema,CASE $coluna WHEN '' THEN nome_tema ELSE $coluna END as nome_tema,tipoa_tema,perfil, ogc_tema, download_tema, link_tema FROM ".$this->esquemaadmin."i3geoadmin_raiz LEFT JOIN ".$this->esquemaadmin."i3geoadmin_temas ON i3geoadmin_temas.id_tema = i3geoadmin_raiz.id_tema "; | |
| 113 | + $this->sql_temasSubgrupo = "select i3geoadmin_temas.tipoa_tema, i3geoadmin_temas.codigo_tema,i3geoadmin_temas.tags_tema,i3geoadmin_n3.id_n3,CASE i3geoadmin_temas.$coluna WHEN '' THEN nome_tema ELSE i3geoadmin_temas.$coluna END as nome_tema,i3geoadmin_n3.publicado,i3geoadmin_n3.n3_perfil,i3geoadmin_n3.id_tema,i3geoadmin_temas.download_tema,i3geoadmin_temas.ogc_tema from ".$this->esquemaadmin."i3geoadmin_n3 LEFT JOIN ".$this->esquemaadmin."i3geoadmin_temas ON i3geoadmin_n3.id_tema = i3geoadmin_temas.id_tema "; | |
| 114 | + | |
| 115 | + //$this->sql_temas = "select kmz_tema,nacessos,id_tema,kml_tema,ogc_tema,download_tema,tags_tema,tipoa_tema,link_tema,desc_tema,$coluna as nome_tema,codigo_tema from i3geoadmin_temas "; | |
| 116 | + | |
| 117 | + $this->sql_temas = "select kmz_tema,b.soma as nacessos,id_tema,kml_tema,ogc_tema,download_tema,tags_tema,tipoa_tema,link_tema,desc_tema,CASE $coluna WHEN '' THEN nome_tema ELSE $coluna END as nome_tema,codigo_tema from ".$this->esquemaadmin."i3geoadmin_temas as a,(SELECT c.codigo_tema codigo_soma,sum( r.nacessos) as soma FROM ".$this->esquemaadmin."i3geoadmin_temas c LEFT JOIN ".$this->esquemaadmin."i3geoadmin_acessostema r ON (c.codigo_tema = r.codigo_tema) group by c.codigo_tema) as b WHERE a.codigo_tema = b.codigo_soma "; | |
| 118 | + $this->sql_temas_combo = "select id_tema,CASE $coluna WHEN '' THEN nome_tema ELSE $coluna END as nome_tema,codigo_tema from ".$this->esquemaadmin."i3geoadmin_temas as a,(SELECT c.codigo_tema codigo_soma,sum( r.nacessos) as soma FROM ".$this->esquemaadmin."i3geoadmin_temas c LEFT JOIN ".$this->esquemaadmin."i3geoadmin_acessostema r ON (c.codigo_tema = r.codigo_tema) group by c.codigo_tema) as b WHERE a.codigo_tema = b.codigo_soma "; | |
| 119 | + // | |
| 120 | + //verifica se o ip atual está cadastrado como um dos editores | |
| 121 | + //editores podem ver as coisas marcadas como não publicado | |
| 122 | + //no sistema de administração | |
| 123 | + // | |
| 124 | + $this->editor = false; | |
| 125 | + $this->editor = $this->verificaOperacaoSessao("admin/php/classe_arvore/editor"); | |
| 126 | + $this->pubsql = " (publicado != 'NAO' or publicado is null) and "; | |
| 127 | + if($this->editor){ | |
| 128 | + $this->pubsql = ""; | |
| 129 | + } | |
| 130 | + if(!function_exists("listaTemasIndevidos")){ | |
| 131 | + include_once(dirname(__FILE__)."/../../classesphp/funcoes_gerais.php"); | |
| 132 | + } | |
| 133 | + $this->temasindevidos = listaTemasIndevidos(); | |
| 134 | + } | |
| 135 | + function __destruct() | |
| 136 | + { | |
| 137 | + $this->dbh = null; | |
| 138 | + $this->dbhw = null; | |
| 139 | + } | |
| 140 | + /* | |
| 141 | + Function: validaTemas | |
| 142 | + | |
| 143 | + Remove de um array os temas que nao sao permitidos ao usuario atualmente logado | |
| 144 | + */ | |
| 145 | + function validaTemas($linhas,$id){ | |
| 146 | + $res = array(); | |
| 147 | + foreach($linhas as $l){ | |
| 148 | + if(!in_array($l[$id],$this->temasindevidos)){ | |
| 149 | + array_push($res,$l); | |
| 150 | + } | |
| 151 | + } | |
| 152 | + return $res; | |
| 153 | + } | |
| 154 | + /* | |
| 155 | + Function: pegaListaDeMenus | |
| 156 | + | |
| 157 | + Retorna a lista de menus | |
| 158 | + | |
| 159 | + Parametros: | |
| 160 | + | |
| 161 | + perfil {string} - considera apenas esse perfil | |
| 162 | + | |
| 163 | + Return: | |
| 164 | + | |
| 165 | + {array} | |
| 166 | + */ | |
| 167 | + function pegaListaDeMenus($perfil="",$filtraOgc="nao",$filtraDown="nao") | |
| 168 | + { | |
| 169 | + if($this->idioma == "pt"){ | |
| 170 | + $coluna = "nome_menu"; | |
| 171 | + } | |
| 172 | + else{ | |
| 173 | + $coluna = $this->idioma; | |
| 174 | + } | |
| 175 | + if($this->editor == true) | |
| 176 | + { | |
| 177 | + $perfil = ""; | |
| 178 | + $sql = "SELECT publicado_menu,'' as perfil_menu,aberto,desc_menu,id_menu,CASE $coluna WHEN '' THEN nome_menu ELSE $coluna END as nome_menu from ".$this->esquemaadmin."i3geoadmin_menus order by nome_menu"; | |
| 179 | + } | |
| 180 | + else{ | |
| 181 | + $sql = "SELECT publicado_menu,perfil_menu,aberto,desc_menu,id_menu,CASE $coluna WHEN '' THEN nome_menu ELSE $coluna END as nome_menu from ".$this->esquemaadmin."i3geoadmin_menus where publicado_menu != 'NAO' or publicado_menu is null order by nome_menu"; | |
| 182 | + } | |
| 183 | + $regs = $this->execSQL($sql); | |
| 184 | + $resultado = array(); | |
| 185 | + foreach($regs as $reg){ | |
| 186 | + $a = $reg["perfil_menu"]; | |
| 187 | + $a = str_replace(" ",",",$a); | |
| 188 | + if ($this->verificaOcorrencia($perfil,explode(",",$a))) | |
| 189 | + { | |
| 190 | + $status = "fechado"; | |
| 191 | + if(strtolower($reg["aberto"]) == "sim") | |
| 192 | + $status = "aberto"; | |
| 193 | + $url = ""; | |
| 194 | + $resultado[] = array("desc"=>$this->converte($reg["desc_menu"]),"publicado"=>$reg["publicado_menu"],"nomemenu"=>$this->converte($reg["nome_menu"]),"idmenu"=>$reg["id_menu"],"arquivo"=>"","status"=>$status,"url"=>$url); | |
| 195 | + } | |
| 196 | + } | |
| 197 | + return $resultado; | |
| 198 | + } | |
| 199 | + /* | |
| 200 | + Function: pegaListaDeTiposGrupos | |
| 201 | + | |
| 202 | + Retorna a lista de grupos de um menu | |
| 203 | + | |
| 204 | + Parametros: | |
| 205 | + | |
| 206 | + id_menu {string} | |
| 207 | + | |
| 208 | + Return: | |
| 209 | + | |
| 210 | + {array} | |
| 211 | + */ | |
| 212 | + function pegaListaDeTiposGrupos(){ | |
| 213 | + if($this->idioma == "pt"){ | |
| 214 | + $coluna = "nome_grupo"; | |
| 215 | + } | |
| 216 | + else{ | |
| 217 | + $coluna = $this->idioma; | |
| 218 | + } | |
| 219 | + $sql = "select CASE i3geoadmin_grupos.$coluna WHEN '' THEN nome_grupo ELSE i3geoadmin_grupos.$coluna END as nome_grupo, id_grupo from ".$this->esquemaadmin."i3geoadmin_grupos ORDER by nome_grupo "; | |
| 220 | + $grupos = $this->execSQL($sql); | |
| 221 | + return $grupos; | |
| 222 | + } | |
| 223 | + /* | |
| 224 | + Function: pegaListaDeTiposSubGrupos | |
| 225 | + | |
| 226 | + Retorna a lista de grupos de um menu | |
| 227 | + | |
| 228 | + Parametros: | |
| 229 | + | |
| 230 | + id_menu {string} | |
| 231 | + | |
| 232 | + Return: | |
| 233 | + | |
| 234 | + {array} | |
| 235 | + */ | |
| 236 | + function pegaListaDeTiposSubGrupos(){ | |
| 237 | + if($this->idioma == "pt"){ | |
| 238 | + $coluna = "nome_subgrupo"; | |
| 239 | + } | |
| 240 | + else{ | |
| 241 | + $coluna = $this->idioma; | |
| 242 | + } | |
| 243 | + $sql = "select CASE i3geoadmin_subgrupos.$coluna WHEN '' THEN nome_subgrupo ELSE i3geoadmin_subgrupos.$coluna END as nome_subgrupo, id_subgrupo from ".$this->esquemaadmin."i3geoadmin_subgrupos ORDER by nome_subgrupo "; | |
| 244 | + $subgrupos = $this->execSQL($sql); | |
| 245 | + return $subgrupos; | |
| 246 | + } | |
| 247 | + /* | |
| 248 | + Function: procuraTemas | |
| 249 | + | |
| 250 | + Localiza temas conforme uma palavra de busca | |
| 251 | + | |
| 252 | + Parametros: | |
| 253 | + | |
| 254 | + procurar {string} - palavra de busca | |
| 255 | + | |
| 256 | + perfil {string} - considera apenas esse perfil | |
| 257 | + | |
| 258 | + Return: | |
| 259 | + | |
| 260 | + {array} | |
| 261 | + */ | |
| 262 | + function procuraTemas ($procurar,$perfil) | |
| 263 | + { | |
| 264 | + if($procurar != "") | |
| 265 | + { | |
| 266 | + $procurar = $this->removeAcentos($procurar); | |
| 267 | + } | |
| 268 | + $menus = $this->pegaListaDeMenus($perfil); | |
| 269 | + $resultado = array(); | |
| 270 | + $subgrupo = array(); | |
| 271 | + $final = array(); | |
| 272 | + foreach($menus as $menu) | |
| 273 | + { | |
| 274 | + $grupos = $this->pegaGruposMenu($menu["idmenu"]); | |
| 275 | + foreach($grupos["grupos"] as $grupo) | |
| 276 | + { | |
| 277 | + $a = $grupo["n1_perfil"]; | |
| 278 | + $a = str_replace(" ",",",$a); | |
| 279 | + if($this->verificaOcorrencia($perfil,explode(",",$a))) | |
| 280 | + { | |
| 281 | + $sgrupos = $this->pegaSubgruposGrupo($menu["idmenu"],$grupo["id_n1"]); | |
| 282 | + $temasRaizGrupo = array(); | |
| 283 | + $temasR = $this->pegaTemasRaizGrupo($menu["idmenu"],$grupo["id_n1"]); | |
| 284 | + foreach($temasR as $tema) | |
| 285 | + { | |
| 286 | + $a = $tema["perfil"]; | |
| 287 | + $a = str_replace(" ",",",$a); | |
| 288 | + if($this->verificaOcorrencia($perfil,explode(",",$a))) | |
| 289 | + { | |
| 290 | + $t = $this->pegaTema($tema["id_tema"]); | |
| 291 | + $t = $t[0]; | |
| 292 | + $nome = $this->removeAcentos($tema["nome_tema"]); | |
| 293 | + $tags = $this->removeAcentos($tema["tags_tema"]); | |
| 294 | + $tags1 = $this->removeAcentos(mb_convert_encoding($tema["tags_tema"],"ISO-8859-1","UTF-8")); | |
| 295 | + $nome1 = $this->removeAcentos(mb_convert_encoding($tema["nome_tema"],"ISO-8859-1","UTF-8")); | |
| 296 | + $miniatura = "nao"; | |
| 297 | + if(file_exists($this->locaplic."/temas/miniaturas/".$t["codigo_tema"].".map.mini.png")) | |
| 298 | + { | |
| 299 | + $miniatura = "sim"; | |
| 300 | + } | |
| 301 | + $down = "sim"; | |
| 302 | + if (strtolower($t["download_tema"]) == "nao") | |
| 303 | + { | |
| 304 | + $down = "nao"; | |
| 305 | + } | |
| 306 | + $texto = array("codigo_tema"=>$t["codigo_tema"],"miniatura"=>$miniatura,"tid"=>$t["codigo_tema"],"nome"=>$this->converte($tema["nome_tema"]),"link"=>$t["link_tema"],"download"=>$down); | |
| 307 | + if($procurar == "") | |
| 308 | + { | |
| 309 | + $temasRaizGrupo[] = $texto; | |
| 310 | + } | |
| 311 | + else | |
| 312 | + { | |
| 313 | + if (stristr($nome,$procurar) || stristr($nome1,$procurar)) | |
| 314 | + { | |
| 315 | + $temasRaizGrupo[] = $texto; | |
| 316 | + } | |
| 317 | + else | |
| 318 | + { | |
| 319 | + if (stristr($tags,$procurar) || stristr($tags1,$procurar)) | |
| 320 | + { | |
| 321 | + $temasRaizGrupo[] = $texto; | |
| 322 | + } | |
| 323 | + } | |
| 324 | + } | |
| 325 | + } | |
| 326 | + } | |
| 327 | + foreach($sgrupos["subgrupos"] as $sgrupo) | |
| 328 | + { | |
| 329 | + $a = $sgrupo["n2_perfil"]; | |
| 330 | + $a = str_replace(" ",",",$a); | |
| 331 | + if($this->verificaOcorrencia($perfil,explode(",",$a))) | |
| 332 | + { | |
| 333 | + $temas = $this->pegaTemasSubGrupo($sgrupo["id_n2"]); | |
| 334 | + foreach ($temas as $tema) | |
| 335 | + { | |
| 336 | + $a = $tema["n3_perfil"]; | |
| 337 | + $a = str_replace(" ",",",$a); | |
| 338 | + if($this->verificaOcorrencia($perfil,explode(",",$a))) | |
| 339 | + { | |
| 340 | + $t = $this->pegaTema($tema["id_tema"]); | |
| 341 | + $t = $t[0]; | |
| 342 | + $nome = $this->removeAcentos($tema["nome_tema"]); | |
| 343 | + $tags = $this->removeAcentos($tema["tags_tema"]); | |
| 344 | + $tags1 = $this->removeAcentos(mb_convert_encoding($tema["tags_tema"],"ISO-8859-1","UTF-8")); | |
| 345 | + $nome1 = $this->removeAcentos(mb_convert_encoding($tema["nome_tema"],"ISO-8859-1","UTF-8")); | |
| 346 | + $miniatura = "nao"; | |
| 347 | + if(file_exists($this->locaplic."/temas/miniaturas/".$tema["codigo_tema"].".map.mini.png")) | |
| 348 | + { | |
| 349 | + $miniatura = "sim"; | |
| 350 | + } | |
| 351 | + $down = "sim"; | |
| 352 | + if (strtolower($t["download_tema"]) == "nao") | |
| 353 | + { | |
| 354 | + $down = "nao"; | |
| 355 | + } | |
| 356 | + $texto = array("codigo_tema"=>$tema["codigo_tema"],"miniatura"=>$miniatura,"tid"=>$tema["codigo_tema"],"nome"=>$this->converte($tema["nome_tema"]),"link"=>$t["link_tema"],"download"=>$down); | |
| 357 | + if($procurar == "") | |
| 358 | + { | |
| 359 | + $resultado[] = $texto; | |
| 360 | + } | |
| 361 | + else | |
| 362 | + { | |
| 363 | + if (stristr($nome,$procurar) || stristr($nome1,$procurar)) | |
| 364 | + { | |
| 365 | + $resultado[] = $texto; | |
| 366 | + } | |
| 367 | + else | |
| 368 | + { | |
| 369 | + if (stristr($tags,$procurar) || stristr($tags1,$procurar)) | |
| 370 | + { | |
| 371 | + $resultado[] = $texto; | |
| 372 | + } | |
| 373 | + } | |
| 374 | + } | |
| 375 | + } | |
| 376 | + } | |
| 377 | + } | |
| 378 | + if (count($resultado) > 0) | |
| 379 | + { | |
| 380 | + $subgrupo[] = array("subgrupo"=>$this->converte($sgrupo["nome_subgrupo"]),"temas"=>$resultado); | |
| 381 | + } | |
| 382 | + $resultado = array(); | |
| 383 | + } | |
| 384 | + } | |
| 385 | + if (count($subgrupo) > 0 || count($temasRaizGrupo) > 0) | |
| 386 | + { | |
| 387 | + $final[] = array("grupo"=>$this->converte($grupo["nome_grupo"]),"temas"=>$temasRaizGrupo,"subgrupos"=>$subgrupo); | |
| 388 | + } | |
| 389 | + $subgrupo = array(); | |
| 390 | + } | |
| 391 | + } | |
| 392 | + return $final; | |
| 393 | + } | |
| 394 | + /* | |
| 395 | + Function: procuraTemasEstrela | |
| 396 | + | |
| 397 | + Localiza temas que têm um determinado número (nível) de estrelas | |
| 398 | + | |
| 399 | + Parametros: | |
| 400 | + | |
| 401 | + nivel {numeric} - número de estrelas | |
| 402 | + | |
| 403 | + perfil {string} - considera apenas esse perfil | |
| 404 | + | |
| 405 | + Return: | |
| 406 | + | |
| 407 | + {array} | |
| 408 | + */ | |
| 409 | + function procuraTemasEstrela($nivel,$fatorestrela,$perfil) | |
| 410 | + { | |
| 411 | + $menus = $this->pegaListaDeMenus($perfil); | |
| 412 | + | |
| 413 | + $resultado = array(); | |
| 414 | + $subgrupo = array(); | |
| 415 | + $final = array(); | |
| 416 | + foreach($menus as $menu) | |
| 417 | + { | |
| 418 | + $grupos = $this->pegaGruposMenu($menu["idmenu"]); | |
| 419 | + foreach($grupos["grupos"] as $grupo) | |
| 420 | + { | |
| 421 | + $a = $grupo["n1_perfil"]; | |
| 422 | + $a = str_replace(" ",",",$a); | |
| 423 | + if($this->verificaOcorrencia($perfil,explode(",",$a))) | |
| 424 | + { | |
| 425 | + $sgrupos = $this->pegaSubgruposGrupo($menu["idmenu"],$grupo["id_n1"]); | |
| 426 | + $temasRaizGrupo = array(); | |
| 427 | + $temasR = $this->pegaTemasRaizGrupo($menu["idmenu"],$grupo["id_n1"]); | |
| 428 | + foreach($temasR as $tema) | |
| 429 | + { | |
| 430 | + $a = $tema["perfil"]; | |
| 431 | + $a = str_replace(" ",",",$a); | |
| 432 | + if($this->verificaOcorrencia($perfil,explode(",",$a))) | |
| 433 | + { | |
| 434 | + $t = $this->pegaTema($tema["id_tema"]); | |
| 435 | + $t = $t[0]; | |
| 436 | + $nome = $this->removeAcentos($tema["nome_tema"]); | |
| 437 | + $tags = $this->removeAcentos($tema["tags_tema"]); | |
| 438 | + $tags1 = $this->removeAcentos(mb_convert_encoding($tema["tags_tema"],"ISO-8859-1","UTF-8")); | |
| 439 | + $nome1 = $this->removeAcentos(mb_convert_encoding($tema["nome_tema"],"ISO-8859-1","UTF-8")); | |
| 440 | + $miniatura = "nao"; | |
| 441 | + if(file_exists($this->locaplic."/temas/miniaturas/".$t["codigo_tema"].".map.mini.png")) | |
| 442 | + { | |
| 443 | + $miniatura = "sim"; | |
| 444 | + } | |
| 445 | + $down = "sim"; | |
| 446 | + if (strtolower($t["download_tema"]) == "nao") | |
| 447 | + { | |
| 448 | + $down = "nao"; | |
| 449 | + } | |
| 450 | + $texto = array("codigo_tema"=>$t["codigo_tema"],"miniatura"=>$miniatura,"tid"=>$t["codigo_tema"],"nome"=>$this->converte($tema["nome_tema"]),"link"=>$t["link_tema"],"download"=>$down); | |
| 451 | + $n = intval($t["nacessos"] / $fatorestrela); | |
| 452 | + if($n >= 5){ | |
| 453 | + $n = 5; | |
| 454 | + } | |
| 455 | + | |
| 456 | + if ($n == $nivel) | |
| 457 | + { | |
| 458 | + $temasRaizGrupo[] = $texto; | |
| 459 | + } | |
| 460 | + } | |
| 461 | + } | |
| 462 | + foreach($sgrupos["subgrupos"] as $sgrupo) | |
| 463 | + { | |
| 464 | + $a = $sgrupo["n2_perfil"]; | |
| 465 | + $a = str_replace(" ",",",$a); | |
| 466 | + if($this->verificaOcorrencia($perfil,explode(",",$a))) | |
| 467 | + { | |
| 468 | + $temas = $this->pegaTemasSubGrupo($sgrupo["id_n2"]); | |
| 469 | + foreach ($temas as $tema) | |
| 470 | + { | |
| 471 | + $a = $tema["n3_perfil"]; | |
| 472 | + $a = str_replace(" ",",",$a); | |
| 473 | + if($this->verificaOcorrencia($perfil,explode(",",$a))) | |
| 474 | + { | |
| 475 | + $t = $this->pegaTema($tema["id_tema"]); | |
| 476 | + $t = $t[0]; | |
| 477 | + $nome = $this->removeAcentos($tema["nome_tema"]); | |
| 478 | + $tags = $this->removeAcentos($tema["tags_tema"]); | |
| 479 | + $tags1 = $this->removeAcentos(mb_convert_encoding($tema["tags_tema"],"ISO-8859-1","UTF-8")); | |
| 480 | + $nome1 = $this->removeAcentos(mb_convert_encoding($tema["nome_tema"],"ISO-8859-1","UTF-8")); | |
| 481 | + $miniatura = "nao"; | |
| 482 | + if(file_exists($this->locaplic."/temas/miniaturas/".$tema["codigo_tema"].".map.mini.png")) | |
| 483 | + { | |
| 484 | + $miniatura = "sim"; | |
| 485 | + } | |
| 486 | + $down = "sim"; | |
| 487 | + if (strtolower($t["download_tema"]) == "nao") | |
| 488 | + { | |
| 489 | + $down = "nao"; | |
| 490 | + } | |
| 491 | + $texto = array("codigo_tema"=>$tema["codigo_tema"],"miniatura"=>$miniatura,"tid"=>$tema["codigo_tema"],"nome"=>$this->converte($tema["nome_tema"]),"link"=>$t["link_tema"],"download"=>$down); | |
| 492 | + $n = abs($t["nacessos"] / $fatorestrela); | |
| 493 | + if($n >= 5){ | |
| 494 | + $n = 5; | |
| 495 | + } | |
| 496 | + if ($n == $nivel) | |
| 497 | + { | |
| 498 | + $resultado[] = $texto; | |
| 499 | + } | |
| 500 | + } | |
| 501 | + } | |
| 502 | + } | |
| 503 | + if (count($resultado) > 0) | |
| 504 | + { | |
| 505 | + $subgrupo[] = array("subgrupo"=>$this->converte($sgrupo["nome_subgrupo"]),"temas"=>$resultado); | |
| 506 | + } | |
| 507 | + $resultado = array(); | |
| 508 | + } | |
| 509 | + } | |
| 510 | + if (count($subgrupo) > 0 || count($temasRaizGrupo) > 0) | |
| 511 | + { | |
| 512 | + $final[] = array("grupo"=>$this->converte($grupo["nome_grupo"]),"temas"=>$temasRaizGrupo,"subgrupos"=>$subgrupo); | |
| 513 | + } | |
| 514 | + $subgrupo = array(); | |
| 515 | + } | |
| 516 | + } | |
| 517 | + return $final; | |
| 518 | + } | |
| 519 | + /* | |
| 520 | + Function: pegaGruposMenu | |
| 521 | + | |
| 522 | + Retorna a lista de grupos de um menu | |
| 523 | + | |
| 524 | + Parametros: | |
| 525 | + | |
| 526 | + id_menu {string} | |
| 527 | + | |
| 528 | + Return: | |
| 529 | + | |
| 530 | + {array} | |
| 531 | + */ | |
| 532 | + function pegaGruposMenu($id_menu,$ordenaNome="nao"){ | |
| 533 | + if($ordenaNome == "sim"){ | |
| 534 | + $ordem = "nome_grupo"; | |
| 535 | + } | |
| 536 | + else{ | |
| 537 | + $ordem = "ordem"; | |
| 538 | + } | |
| 539 | + $sqlgrupos = $this->sql_grupos."where ".$this->pubsql." id_menu='$id_menu' order by $ordem"; | |
| 540 | + $sqlraiz = $this->sql_temasraiz."where i3geoadmin_raiz.id_menu='$id_menu' and i3geoadmin_raiz.nivel = 0 order by ordem"; | |
| 541 | + $grupos = $this->execSQL($sqlgrupos); | |
| 542 | + $raiz = $this->execSQL($sqlraiz); | |
| 543 | + $raiz = $this->validaTemas($raiz,"codigo_tema"); | |
| 544 | + return array("raiz"=>$raiz,"grupos"=>$grupos); | |
| 545 | + } | |
| 546 | + /* | |
| 547 | + Function: pegaSubgruposGrupo | |
| 548 | + | |
| 549 | + Retorna a lista de subgrupos de um grupo | |
| 550 | + | |
| 551 | + Parametros: | |
| 552 | + | |
| 553 | + id_menu {string} | |
| 554 | + | |
| 555 | + id_n1 {string} - id do grupo | |
| 556 | + | |
| 557 | + Return: | |
| 558 | + | |
| 559 | + {array} | |
| 560 | + */ | |
| 561 | + function pegaSubgruposGrupo($id_menu,$id_n1,$ordenaNome="nao",$filtraOgc="nao",$filtraDown="nao") | |
| 562 | + { | |
| 563 | + if($ordenaNome == "sim"){ | |
| 564 | + $ordem = "nome_subgrupo"; | |
| 565 | + } | |
| 566 | + else{ | |
| 567 | + $ordem = "ordem"; | |
| 568 | + } | |
| 569 | + $f = ""; | |
| 570 | + if($filtraOgc == "sim" || $filtraDown == "sim"){ | |
| 571 | + $ff = array(); | |
| 572 | + if($filtraOgc == "sim"){ | |
| 573 | + $ff[] = " i3geoadmin_temas.ogc_tema = 'SIM' "; | |
| 574 | + } | |
| 575 | + if($filtraDown == "sim"){ | |
| 576 | + $ff[] = " i3geoadmin_temas.download_tema = 'SIM' "; | |
| 577 | + } | |
| 578 | + $f = implode(" AND ",$ff) . " AND "; | |
| 579 | + } | |
| 580 | + $subgrupos = $this->execSQL($this->sql_subgrupos."where ".$this->pubsql." i3geoadmin_n2.id_n1='$id_n1' order by $ordem"); | |
| 581 | + $raiz = $this->execSQL($this->sql_temasraiz."where $f i3geoadmin_raiz.nivel = 1 and i3geoadmin_raiz.id_nivel = $id_n1 order by ordem"); | |
| 582 | + $raiz = $this->validaTemas($raiz,"codigo_tema"); | |
| 583 | + return array("raiz"=>$raiz,"subgrupos"=>$subgrupos); | |
| 584 | + } | |
| 585 | + /* | |
| 586 | + Function: pegaTemasRaizMenu | |
| 587 | + | |
| 588 | + Retorna a lista de temas da raiz de um menu | |
| 589 | + | |
| 590 | + Parametros: | |
| 591 | + | |
| 592 | + id_menu {string} | |
| 593 | + | |
| 594 | + Return: | |
| 595 | + | |
| 596 | + {array} | |
| 597 | + */ | |
| 598 | + function pegaTemasRaizMenu($id_menu) | |
| 599 | + { | |
| 600 | + $raiz = $this->execSQL($this->sql_temasraiz."where i3geoadmin_raiz.id_menu='$id_menu' and i3geoadmin_raiz.nivel = 0 order by ordem"); | |
| 601 | + $raiz = $this->validaTemas($raiz,"codigo_tema"); | |
| 602 | + return $raiz; | |
| 603 | + } | |
| 604 | + /* | |
| 605 | + Function: pegaTemasRaizGrupo | |
| 606 | + | |
| 607 | + Retorna a lista de temas da raiz de um grupo | |
| 608 | + | |
| 609 | + Parametros: | |
| 610 | + | |
| 611 | + id_menu {string} | |
| 612 | + | |
| 613 | + id_n1 {string} - id do grupo | |
| 614 | + | |
| 615 | + Return: | |
| 616 | + | |
| 617 | + {array} | |
| 618 | + */ | |
| 619 | + function pegaTemasRaizGrupo($id_menu,$id_n1,$filtraOgc="nao",$filtraDown="nao") | |
| 620 | + { | |
| 621 | + $f = ""; | |
| 622 | + if($filtraOgc == "sim" || $filtraDown == "sim"){ | |
| 623 | + $ff = array(); | |
| 624 | + if($filtraOgc == "sim"){ | |
| 625 | + $ff[] = " i3geoadmin_temas.ogc_tema = 'SIM' "; | |
| 626 | + } | |
| 627 | + if($filtraDown == "sim"){ | |
| 628 | + $ff[] = " i3geoadmin_temas.download_tema = 'SIM' "; | |
| 629 | + } | |
| 630 | + $f = implode(" AND ",$ff) . " AND "; | |
| 631 | + } | |
| 632 | + if($id_n1 == ""){ | |
| 633 | + $raiz = $this->execSQL($this->sql_temasraiz."where $f i3geoadmin_raiz.nivel = 1 and i3geoadmin_raiz.id_nivel > 0 order by ordem"); | |
| 634 | + } | |
| 635 | + else { | |
| 636 | + $raiz = $this->execSQL($this->sql_temasraiz."where $f i3geoadmin_raiz.nivel = 1 and i3geoadmin_raiz.id_nivel = $id_n1 order by ordem"); | |
| 637 | + } | |
| 638 | + $raiz = $this->validaTemas($raiz,"codigo_tema"); | |
| 639 | + return $raiz; | |
| 640 | + } | |
| 641 | + /* | |
| 642 | + Function: pegaTodosTemas | |
| 643 | + | |
| 644 | + Retorna os dados de todos os temas | |
| 645 | + | |
| 646 | + Return: | |
| 647 | + | |
| 648 | + {array} | |
| 649 | + */ | |
| 650 | + function pegaTodosTemas($combo=false) | |
| 651 | + { | |
| 652 | + if($combo == true){ | |
| 653 | + $q = $this->execSQL($this->sql_temas_combo." ORDER BY nome_tema ASC"); | |
| 654 | + } | |
| 655 | + else{ | |
| 656 | + $q = $this->execSQL($this->sql_temas." ORDER BY nome_tema ASC"); | |
| 657 | + } | |
| 658 | + if($q){ | |
| 659 | + $q = $this->validaTemas($q,"codigo_tema"); | |
| 660 | + return $q; | |
| 661 | + } | |
| 662 | + } | |
| 663 | + /* | |
| 664 | + Function: pegaTema | |
| 665 | + | |
| 666 | + Retorna os dados de um tema | |
| 667 | + | |
| 668 | + Parametros: | |
| 669 | + | |
| 670 | + id_tema {string} | |
| 671 | + | |
| 672 | + Return: | |
| 673 | + | |
| 674 | + {array} | |
| 675 | + */ | |
| 676 | + function pegaTema($id_tema) | |
| 677 | + { | |
| 678 | + $q = $this->execSQL($this->sql_temas." and id_tema = '$id_tema' "); | |
| 679 | + if($q){ | |
| 680 | + return $q; | |
| 681 | + } | |
| 682 | + else{ | |
| 683 | + //caso de banco de dados antigo | |
| 684 | + $sql = "select kmz_tema,'0' as nacessos,id_tema,kml_tema,ogc_tema,download_tema,tags_tema,tipoa_tema,link_tema,desc_tema,nome_tema,codigo_tema from ".$this->esquemaadmin."i3geoadmin_temas "; | |
| 685 | + $q = $this->execSQL($sql." where id_tema = '$id_tema' "); | |
| 686 | + return $q; | |
| 687 | + } | |
| 688 | + } | |
| 689 | + /* | |
| 690 | + Function: pegaTemaPorCodigo | |
| 691 | + | |
| 692 | + Retorna os dados de um tema buscando por codigo | |
| 693 | + | |
| 694 | + Parametros: | |
| 695 | + | |
| 696 | + codigo_tema {string} | |
| 697 | + | |
| 698 | + Return: | |
| 699 | + | |
| 700 | + {array} | |
| 701 | + */ | |
| 702 | + function pegaTemaPorCodigo($codigo_tema) | |
| 703 | + { | |
| 704 | + $q = $this->execSQL($this->sql_temas." and codigo_tema = '$codigo_tema' "); | |
| 705 | + if($q){ | |
| 706 | + return $q; | |
| 707 | + } | |
| 708 | + else{ | |
| 709 | + //caso de banco de dados antigo | |
| 710 | + $sql = "select kmz_tema,'0' as nacessos,id_tema,kml_tema,ogc_tema,download_tema,tags_tema,tipoa_tema,link_tema,desc_tema,nome_tema,codigo_tema from ".$this->esquemaadmin."i3geoadmin_temas "; | |
| 711 | + $q = $this->execSQL($sql." where codigo_tema = '$codigo_tema' "); | |
| 712 | + return $q; | |
| 713 | + } | |
| 714 | + } | |
| 715 | + /* | |
| 716 | + Function: pegaTemasSubGrupo | |
| 717 | + | |
| 718 | + Retorna os temas de um subgrupo | |
| 719 | + | |
| 720 | + Parametros: | |
| 721 | + | |
| 722 | + id_n2 {string} - id do subgrupo | |
| 723 | + | |
| 724 | + Return: | |
| 725 | + | |
| 726 | + {array} | |
| 727 | + */ | |
| 728 | + function pegaTemasSubGrupo($id_n2,$filtraOgc="nao",$filtraDown="nao") | |
| 729 | + { | |
| 730 | + $f = ""; | |
| 731 | + if($filtraOgc == "sim" || $filtraDown == "sim"){ | |
| 732 | + $ff = array(); | |
| 733 | + if($filtraOgc == "sim"){ | |
| 734 | + $ff[] = " i3geoadmin_temas.ogc_tema = 'SIM' "; | |
| 735 | + } | |
| 736 | + if($filtraDown == "sim"){ | |
| 737 | + $ff[] = " i3geoadmin_temas.download_tema = 'SIM' "; | |
| 738 | + } | |
| 739 | + $f = implode(" AND ",$ff) . " AND "; | |
| 740 | + } | |
| 741 | + $temas = $this->execSQL($this->sql_temasSubgrupo."where $f ".$this->pubsql." i3geoadmin_n3.id_n2='$id_n2' order by ordem"); | |
| 742 | + $temas = $this->validaTemas($temas,"codigo_tema"); | |
| 743 | + return $temas; | |
| 744 | + } | |
| 745 | + /* | |
| 746 | + Function: formataMenus | |
| 747 | + | |
| 748 | + Retorna os menus e temas na raiz de um menu, formatados no padrão da árvore | |
| 749 | + | |
| 750 | + Return: | |
| 751 | + | |
| 752 | + {array} | |
| 753 | + */ | |
| 754 | + function formataMenus(){ | |
| 755 | + } | |
| 756 | + /* | |
| 757 | + Function: formataGruposMenu | |
| 758 | + | |
| 759 | + Retorna os grupos e temas na raiz de um menu, formatados no padrão da árvore | |
| 760 | + | |
| 761 | + Parametros: | |
| 762 | + | |
| 763 | + id_menu {string} | |
| 764 | + | |
| 765 | + perfil {string} | |
| 766 | + | |
| 767 | + listasgrupos {string} - sim|nao | |
| 768 | + | |
| 769 | + Return: | |
| 770 | + | |
| 771 | + {array} | |
| 772 | + */ | |
| 773 | + function formataGruposMenu ($id_menu,$perfil,$listasgrupos,$ordenaNome="nao",$filtraOgc="nao",$filtraDown="nao") | |
| 774 | + { | |
| 775 | + //error_reporting(0); | |
| 776 | + $dados = $this->pegaGruposMenu($id_menu,$ordenaNome); | |
| 777 | + $resultado = array(); | |
| 778 | + $temasraiz = array(); | |
| 779 | + foreach($dados["raiz"] as $temar){ | |
| 780 | + $temasraiz[] = $this->formataTema($temar["id_tema"]); | |
| 781 | + } | |
| 782 | + if(count($dados["grupos"]) == 0){ | |
| 783 | + $grupos[] = array(); | |
| 784 | + } | |
| 785 | + $raizgrupos = $this->pegaTemasRaizGrupo($id_menu,"",$filtraOgc,$filtraDown); | |
| 786 | + //var_dump($raizgrupos);exit; | |
| 787 | + foreach($dados["grupos"] as $grupo) { | |
| 788 | + $a = $grupo["n1_perfil"]; | |
| 789 | + $a = str_replace(" ",",",$a); | |
| 790 | + if($this->verificaOcorrencia($perfil,explode(",",$a)) == true) | |
| 791 | + { | |
| 792 | + $temas = array(); | |
| 793 | + //$raizgrupo = $this->pegaTemasRaizGrupo($id_menu,$grupo["id_n1"],$filtraOgc,$filtraDown); | |
| 794 | + $grupodown = "nao"; | |
| 795 | + $grupoogc = "nao"; | |
| 796 | + foreach($raizgrupos as $tema){ | |
| 797 | + if($tema["id_nivel"] == $grupo["id_n1"]){ | |
| 798 | + $temas[] = $this->formataTema($tema["id_tema"]); | |
| 799 | + } | |
| 800 | + } | |
| 801 | + if($temas > 0){ | |
| 802 | + $grupodown = "sim"; | |
| 803 | + $grupoogc = "sim"; | |
| 804 | + } | |
| 805 | + $subgrupos = array(); | |
| 806 | + if($listasgrupos=="sim"){ | |
| 807 | + $dadossubgrupos = $this->pegaSubgruposGrupo($id_menu,$grupo["id_n1"],$ordenaNome,$filtraOgc,$filtraDown); | |
| 808 | + foreach($dadossubgrupos["subgrupos"] as $sgrupo){ | |
| 809 | + $a = $sgrupo["n2_perfil"]; | |
| 810 | + $a = str_replace(" ",",",$a); | |
| 811 | + if($this->verificaOcorrencia($perfil,explode(",",$a))){ | |
| 812 | + //verifica se existem temas que podem receber download | |
| 813 | + $down = "nao"; | |
| 814 | + $ogc = "nao"; | |
| 815 | + $listaT = $this->pegaTemasSubGrupo($sgrupo["id_n2"],$filtraOgc,$filtraDown); | |
| 816 | + foreach($listaT as $tema){ | |
| 817 | + if(strtolower($tema["tipoa_tema"]) != "wms") | |
| 818 | + { | |
| 819 | + if (strtolower($tema["download_tema"]) != "nao") | |
| 820 | + { | |
| 821 | + $down = "sim";$grupodown = "sim"; | |
| 822 | + } | |
| 823 | + | |
| 824 | + if (strtolower($tema["ogc_tema"]) != "nao") | |
| 825 | + { | |
| 826 | + $ogc = "sim";$grupoogc = "sim"; | |
| 827 | + } | |
| 828 | + } | |
| 829 | + } | |
| 830 | + if(count($listaT) > 0){ | |
| 831 | + $subgrupos[] = array("id_n2"=>$sgrupo["id_n2"],"publicado"=>($sgrupo["publicado"]),"nome"=>$this->converte($sgrupo["nome_subgrupo"]),"download"=>$down,"ogc"=>$ogc); | |
| 832 | + } | |
| 833 | + } | |
| 834 | + } | |
| 835 | + } | |
| 836 | + //evita ocorrencias vazias quando for aplicado um filtro | |
| 837 | + if($filtraOgc == "sim" || $filtraDown == "sim"){ | |
| 838 | + if(count($subgrupos) > 0 || count($temas) > 0){ | |
| 839 | + $grupos[] = array("publicado"=>($grupo["publicado"]),"id_n1"=>($grupo["id_n1"]),"nome"=>$this->converte($grupo["nome_grupo"]),"ogc"=>$grupoogc,"download"=>$grupodown,"subgrupos"=>$subgrupos,"temasgrupo"=>$temas); | |
| 840 | + } | |
| 841 | + } | |
| 842 | + else{ | |
| 843 | + $grupos[] = array("publicado"=>($grupo["publicado"]),"id_n1"=>($grupo["id_n1"]),"nome"=>$this->converte($grupo["nome_grupo"]),"ogc"=>$grupoogc,"download"=>$grupodown,"subgrupos"=>$subgrupos,"temasgrupo"=>$temas); | |
| 844 | + } | |
| 845 | + } | |
| 846 | + } | |
| 847 | + $grupos[] = array("temasraiz"=>$temasraiz); | |
| 848 | + //pega os sistemas checando os perfis | |
| 849 | + $sistemas = array(); | |
| 850 | + $grupos[] = array("idmenu"=>$id_menu); | |
| 851 | + $grupos[] = array("sistemas"=>""); | |
| 852 | + return($grupos); | |
| 853 | + } | |
| 854 | + /* | |
| 855 | + Function: formataSubgruposGrupo | |
| 856 | + | |
| 857 | + Retorna os subgrupos e temas na raiz de um grupo, formatados no padrão da árvore | |
| 858 | + | |
| 859 | + Parametros: | |
| 860 | + | |
| 861 | + id_menu {string} | |
| 862 | + | |
| 863 | + id_n1 {string} - id do grupo | |
| 864 | + | |
| 865 | + perfil {string} | |
| 866 | + | |
| 867 | + Return: | |
| 868 | + | |
| 869 | + {array} | |
| 870 | + */ | |
| 871 | + function formataSubgruposGrupo ($id_menu,$id_n1,$perfil) | |
| 872 | + { | |
| 873 | + $dados = $this->pegaSubgruposGrupo($id_menu,$id_n1); | |
| 874 | + $resultado = array(); | |
| 875 | + $temasraiz = array(); | |
| 876 | + foreach($dados["raiz"] as $temar) | |
| 877 | + { | |
| 878 | + $temasraiz[] = $this->formataTema($temar["id_tema"]); | |
| 879 | + } | |
| 880 | + if(count($dados["subgrupos"]) == 0) | |
| 881 | + { | |
| 882 | + $sgrupos[] = array(); | |
| 883 | + } | |
| 884 | + $subgrupos = array(); | |
| 885 | + foreach($dados["subgrupos"] as $sgrupo) | |
| 886 | + { | |
| 887 | + $a = $sgrupo["n2_perfil"]; | |
| 888 | + $a = str_replace(" ",",",$a); | |
| 889 | + if ($this->verificaOcorrencia($perfil,explode(",",$a))) | |
| 890 | + { | |
| 891 | + $listaT = $this->pegaTemasSubGrupo($sgrupo["id_n2"]); | |
| 892 | + $down = "nao"; | |
| 893 | + $ogc = "nao"; | |
| 894 | + foreach($listaT as $tema) | |
| 895 | + { | |
| 896 | + if(strtolower($tema["tipoa_tema"]) != "wms") | |
| 897 | + { | |
| 898 | + if (strtolower($tema["download_tema"]) != "nao") | |
| 899 | + { | |
| 900 | + $down = "sim"; | |
| 901 | + } | |
| 902 | + if (strtolower($tema["ogc_tema"]) != "nao") | |
| 903 | + { | |
| 904 | + $ogc = "sim"; | |
| 905 | + } | |
| 906 | + } | |
| 907 | + } | |
| 908 | + if(count($listaT) > 0) | |
| 909 | + { | |
| 910 | + $subgrupos[] = array("publicado"=>($sgrupo["publicado"]),"id_n2"=>($sgrupo["id_n2"]),"nome"=>$this->converte($sgrupo["nome_subgrupo"]),"download"=>$down,"ogc"=>$ogc,"temas"=>$listaT); | |
| 911 | + } | |
| 912 | + } | |
| 913 | + } | |
| 914 | + return (array("subgrupo"=>$subgrupos,"temasgrupo"=>$temasraiz)); | |
| 915 | + } | |
| 916 | + /* | |
| 917 | + Function: formataTemasSubgrupo | |
| 918 | + | |
| 919 | + Retorna os temas de um subgrupo, formatados no padrão da árvore | |
| 920 | + | |
| 921 | + Parametros: | |
| 922 | + | |
| 923 | + id_n2 {string} - id do subgrupo | |
| 924 | + | |
| 925 | + perfil {string} | |
| 926 | + | |
| 927 | + Return: | |
| 928 | + | |
| 929 | + {array} | |
| 930 | + */ | |
| 931 | + function formataTemasSubgrupo($id_n2,$perfil) | |
| 932 | + { | |
| 933 | + $dados = $this->pegaTemasSubGrupo($id_n2); | |
| 934 | + $temas = array(); | |
| 935 | + foreach($dados as $tema) | |
| 936 | + { | |
| 937 | + $a = $tema["n3_perfil"]; | |
| 938 | + $a = str_replace(" ",",",$a); | |
| 939 | + if($this->verificaOcorrencia($perfil,explode(",",$a))) | |
| 940 | + { | |
| 941 | + $temas[] = $this->formataTema($tema["id_tema"],$tema["publicado"]); | |
| 942 | + } | |
| 943 | + } | |
| 944 | + return $temas; | |
| 945 | + } | |
| 946 | + /* | |
| 947 | + Function: formataTema | |
| 948 | + | |
| 949 | + Retorna os dados de um tema, formatados no padrão da árvore | |
| 950 | + | |
| 951 | + Parametros: | |
| 952 | + | |
| 953 | + id_tema {string} | |
| 954 | + | |
| 955 | + publicado {string} - SIM|NAO valor do índice "publicado" que será incluído no array de retorno | |
| 956 | + | |
| 957 | + Return: | |
| 958 | + | |
| 959 | + {array} | |
| 960 | + */ | |
| 961 | + function formataTema($id_tema,$publicado="SIM") | |
| 962 | + { | |
| 963 | + $recordset = $this->pegaTema($id_tema); | |
| 964 | + $recordset = $recordset[0]; | |
| 965 | + $down = "sim"; | |
| 966 | + $ogc = "sim"; | |
| 967 | + $link = " "; | |
| 968 | + $kmz = "nao"; | |
| 969 | + if (strtolower($recordset["download_tema"]) == "nao") | |
| 970 | + { | |
| 971 | + $down = "nao"; | |
| 972 | + } | |
| 973 | + if (strtolower($recordset["ogc_tema"]) == "nao") | |
| 974 | + { | |
| 975 | + $ogc = "nao"; | |
| 976 | + } | |
| 977 | + if(strtolower($recordset["tipoa_tema"]) == "wms") | |
| 978 | + { | |
| 979 | + $down = "nao"; | |
| 980 | + $ogc = "nao"; | |
| 981 | + } | |
| 982 | + if ($recordset["link_tema"] != "") | |
| 983 | + { | |
| 984 | + $link = $recordset["link_tema"]; | |
| 985 | + } | |
| 986 | + if (strtolower($recordset["kmz_tema"]) == "sim") | |
| 987 | + { | |
| 988 | + $kmz = "sim"; | |
| 989 | + } | |
| 990 | + //codigo_tema para fins de compatibilidade | |
| 991 | + return array("codigo_tema"=>($recordset["codigo_tema"]),"tipoa_tema"=>$recordset["tipoa_tema"],"publicado"=>$publicado,"nacessos"=>($recordset["nacessos"]),"tid"=>($recordset["codigo_tema"]),"nome"=>$this->converte($recordset["nome_tema"]),"link"=>$link,"download"=>$down,"ogc"=>$ogc,"kmz"=>$kmz); | |
| 992 | + } | |
| 993 | + /* | |
| 994 | + Function: execSQL | |
| 995 | + | |
| 996 | + Executa um SQL no banco de administração | |
| 997 | + | |
| 998 | + Parametros: | |
| 999 | + | |
| 1000 | + sql {string} | |
| 1001 | + | |
| 1002 | + Return: | |
| 1003 | + | |
| 1004 | + {array} | |
| 1005 | + */ | |
| 1006 | + function execSQL($sql) | |
| 1007 | + { | |
| 1008 | + //echo "<br>".$sql; | |
| 1009 | + //error_reporting(0); | |
| 1010 | + $sql = str_ireplace(array("update","delete","insert","--","drop",";"),"",$sql); | |
| 1011 | + $q = $this->dbh->query($sql,PDO::FETCH_ASSOC); | |
| 1012 | + if($q) | |
| 1013 | + { | |
| 1014 | + return $q->fetchAll(); | |
| 1015 | + } | |
| 1016 | + else | |
| 1017 | + {return false; | |
| 1018 | + } | |
| 1019 | + } | |
| 1020 | + /* | |
| 1021 | + Verifica se uma string ocorre em um array | |
| 1022 | + */ | |
| 1023 | + function verificaOcorrencia($procurar,$em) | |
| 1024 | + { | |
| 1025 | + if(count($em) == 1 && $em[0] == "") | |
| 1026 | + { | |
| 1027 | + $em = ""; | |
| 1028 | + } | |
| 1029 | + if($procurar == "" && $em == "") | |
| 1030 | + { | |
| 1031 | + return true; | |
| 1032 | + } | |
| 1033 | + if($em == "") | |
| 1034 | + { | |
| 1035 | + return true; | |
| 1036 | + } | |
| 1037 | + $resultado = false; | |
| 1038 | + if($procurar != "" && $em != "") | |
| 1039 | + { | |
| 1040 | + foreach($em as $e) | |
| 1041 | + { | |
| 1042 | + $e = trim($e); | |
| 1043 | + foreach($procurar as $p) | |
| 1044 | + { | |
| 1045 | + $p = trim($p); | |
| 1046 | + if($p == $e) | |
| 1047 | + { | |
| 1048 | + $resultado = true; | |
| 1049 | + } | |
| 1050 | + } | |
| 1051 | + } | |
| 1052 | + } | |
| 1053 | + return $resultado; | |
| 1054 | + } | |
| 1055 | + function seems_utf8($Str) { # by bmorel at ssi dot fr | |
| 1056 | + $length = strlen($Str); | |
| 1057 | + for ($i = 0; $i < $length; $i++) { | |
| 1058 | + if (ord($Str[$i]) < 0x80) continue; # 0bbbbbbb | |
| 1059 | + elseif ((ord($Str[$i]) & 0xE0) == 0xC0) $n = 1; # 110bbbbb | |
| 1060 | + elseif ((ord($Str[$i]) & 0xF0) == 0xE0) $n = 2; # 1110bbbb | |
| 1061 | + elseif ((ord($Str[$i]) & 0xF8) == 0xF0) $n = 3; # 11110bbb | |
| 1062 | + elseif ((ord($Str[$i]) & 0xFC) == 0xF8) $n = 4; # 111110bb | |
| 1063 | + elseif ((ord($Str[$i]) & 0xFE) == 0xFC) $n = 5; # 1111110b | |
| 1064 | + else return false; # Does not match any model | |
| 1065 | + for ($j = 0; $j < $n; $j++) { # n bytes matching 10bbbbbb follow ? | |
| 1066 | + if ((++$i == $length) || ((ord($Str[$i]) & 0xC0) != 0x80)) | |
| 1067 | + return false; | |
| 1068 | + } | |
| 1069 | + } | |
| 1070 | + return true; | |
| 1071 | + } | |
| 1072 | + /** | |
| 1073 | + * | |
| 1074 | + * TODO Verificar ao fechar versao - verificar a acentuacao das palavras nessa funcao | |
| 1075 | + */ | |
| 1076 | + function removeAcentos($s) | |
| 1077 | + { | |
| 1078 | + $s = ereg_replace("[áàâã]","a",$s); | |
| 1079 | + $s = ereg_replace("[ÁÀÂÃ]","A",$s); | |
| 1080 | + $s = ereg_replace("[éèê]","e",$s); | |
| 1081 | + $s = ereg_replace("[í]","i",$s); | |
| 1082 | + $s = ereg_replace("[Í]","I",$s); | |
| 1083 | + $s = ereg_replace("[ÉÈÊ]","E",$s); | |
| 1084 | + $s = ereg_replace("[óòôõ]","o",$s); | |
| 1085 | + $s = ereg_replace("[ÓÒÔÕ]","O",$s); | |
| 1086 | + $s = ereg_replace("[úùû]","u",$s); | |
| 1087 | + $s = ereg_replace("[ÚÙÛ]","U",$s); | |
| 1088 | + $s = str_replace("ç","c",$s); | |
| 1089 | + $s = str_replace("Ç","C",$s); | |
| 1090 | + //$str = htmlentities($s); | |
| 1091 | + $str = preg_replace("/(&)([a-z])([a-z]+;)/i", '$2', $s); | |
| 1092 | + $str = preg_replace("/[^A-Z0-9]/i", ' ', $str); | |
| 1093 | + $string = preg_replace("/\s+/i", ' ', $str); | |
| 1094 | + | |
| 1095 | + if (!preg_match('/[\x80-\xff]/', $string)){ | |
| 1096 | + return $string; | |
| 1097 | + } | |
| 1098 | + if ($this->seems_utf8($string)) { | |
| 1099 | + $chars = array( | |
| 1100 | + // Decompositions for Latin-1 Supplement | |
| 1101 | + chr(195).chr(128) => 'A', chr(195).chr(129) => 'A', | |
| 1102 | + chr(195).chr(130) => 'A', chr(195).chr(131) => 'A', | |
| 1103 | + chr(195).chr(132) => 'A', chr(195).chr(133) => 'A', | |
| 1104 | + chr(195).chr(135) => 'C', chr(195).chr(136) => 'E', | |
| 1105 | + chr(195).chr(137) => 'E', chr(195).chr(138) => 'E', | |
| 1106 | + chr(195).chr(139) => 'E', chr(195).chr(140) => 'I', | |
| 1107 | + chr(195).chr(141) => 'I', chr(195).chr(142) => 'I', | |
| 1108 | + chr(195).chr(143) => 'I', chr(195).chr(145) => 'N', | |
| 1109 | + chr(195).chr(146) => 'O', chr(195).chr(147) => 'O', | |
| 1110 | + chr(195).chr(148) => 'O', chr(195).chr(149) => 'O', | |
| 1111 | + chr(195).chr(150) => 'O', chr(195).chr(153) => 'U', | |
| 1112 | + chr(195).chr(154) => 'U', chr(195).chr(155) => 'U', | |
| 1113 | + chr(195).chr(156) => 'U', chr(195).chr(157) => 'Y', | |
| 1114 | + chr(195).chr(159) => 's', chr(195).chr(160) => 'a', | |
| 1115 | + chr(195).chr(161) => 'a', chr(195).chr(162) => 'a', | |
| 1116 | + chr(195).chr(163) => 'a', chr(195).chr(164) => 'a', | |
| 1117 | + chr(195).chr(165) => 'a', chr(195).chr(167) => 'c', | |
| 1118 | + chr(195).chr(168) => 'e', chr(195).chr(169) => 'e', | |
| 1119 | + chr(195).chr(170) => 'e', chr(195).chr(171) => 'e', | |
| 1120 | + chr(195).chr(172) => 'i', chr(195).chr(173) => 'i', | |
| 1121 | + chr(195).chr(174) => 'i', chr(195).chr(175) => 'i', | |
| 1122 | + chr(195).chr(177) => 'n', chr(195).chr(178) => 'o', | |
| 1123 | + chr(195).chr(179) => 'o', chr(195).chr(180) => 'o', | |
| 1124 | + chr(195).chr(181) => 'o', chr(195).chr(182) => 'o', | |
| 1125 | + chr(195).chr(182) => 'o', chr(195).chr(185) => 'u', | |
| 1126 | + chr(195).chr(186) => 'u', chr(195).chr(187) => 'u', | |
| 1127 | + chr(195).chr(188) => 'u', chr(195).chr(189) => 'y', | |
| 1128 | + chr(195).chr(191) => 'y', | |
| 1129 | + // Decompositions for Latin Extended-A | |
| 1130 | + chr(196).chr(128) => 'A', chr(196).chr(129) => 'a', | |
| 1131 | + chr(196).chr(130) => 'A', chr(196).chr(131) => 'a', | |
| 1132 | + chr(196).chr(132) => 'A', chr(196).chr(133) => 'a', | |
| 1133 | + chr(196).chr(134) => 'C', chr(196).chr(135) => 'c', | |
| 1134 | + chr(196).chr(136) => 'C', chr(196).chr(137) => 'c', | |
| 1135 | + chr(196).chr(138) => 'C', chr(196).chr(139) => 'c', | |
| 1136 | + chr(196).chr(140) => 'C', chr(196).chr(141) => 'c', | |
| 1137 | + chr(196).chr(142) => 'D', chr(196).chr(143) => 'd', | |
| 1138 | + chr(196).chr(144) => 'D', chr(196).chr(145) => 'd', | |
| 1139 | + chr(196).chr(146) => 'E', chr(196).chr(147) => 'e', | |
| 1140 | + chr(196).chr(148) => 'E', chr(196).chr(149) => 'e', | |
| 1141 | + chr(196).chr(150) => 'E', chr(196).chr(151) => 'e', | |
| 1142 | + chr(196).chr(152) => 'E', chr(196).chr(153) => 'e', | |
| 1143 | + chr(196).chr(154) => 'E', chr(196).chr(155) => 'e', | |
| 1144 | + chr(196).chr(156) => 'G', chr(196).chr(157) => 'g', | |
| 1145 | + chr(196).chr(158) => 'G', chr(196).chr(159) => 'g', | |
| 1146 | + chr(196).chr(160) => 'G', chr(196).chr(161) => 'g', | |
| 1147 | + chr(196).chr(162) => 'G', chr(196).chr(163) => 'g', | |
| 1148 | + chr(196).chr(164) => 'H', chr(196).chr(165) => 'h', | |
| 1149 | + chr(196).chr(166) => 'H', chr(196).chr(167) => 'h', | |
| 1150 | + chr(196).chr(168) => 'I', chr(196).chr(169) => 'i', | |
| 1151 | + chr(196).chr(170) => 'I', chr(196).chr(171) => 'i', | |
| 1152 | + chr(196).chr(172) => 'I', chr(196).chr(173) => 'i', | |
| 1153 | + chr(196).chr(174) => 'I', chr(196).chr(175) => 'i', | |
| 1154 | + chr(196).chr(176) => 'I', chr(196).chr(177) => 'i', | |
| 1155 | + chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij', | |
| 1156 | + chr(196).chr(180) => 'J', chr(196).chr(181) => 'j', | |
| 1157 | + chr(196).chr(182) => 'K', chr(196).chr(183) => 'k', | |
| 1158 | + chr(196).chr(184) => 'k', chr(196).chr(185) => 'L', | |
| 1159 | + chr(196).chr(186) => 'l', chr(196).chr(187) => 'L', | |
| 1160 | + chr(196).chr(188) => 'l', chr(196).chr(189) => 'L', | |
| 1161 | + chr(196).chr(190) => 'l', chr(196).chr(191) => 'L', | |
| 1162 | + chr(197).chr(128) => 'l', chr(197).chr(129) => 'L', | |
| 1163 | + chr(197).chr(130) => 'l', chr(197).chr(131) => 'N', | |
| 1164 | + chr(197).chr(132) => 'n', chr(197).chr(133) => 'N', | |
| 1165 | + chr(197).chr(134) => 'n', chr(197).chr(135) => 'N', | |
| 1166 | + chr(197).chr(136) => 'n', chr(197).chr(137) => 'N', | |
| 1167 | + chr(197).chr(138) => 'n', chr(197).chr(139) => 'N', | |
| 1168 | + chr(197).chr(140) => 'O', chr(197).chr(141) => 'o', | |
| 1169 | + chr(197).chr(142) => 'O', chr(197).chr(143) => 'o', | |
| 1170 | + chr(197).chr(144) => 'O', chr(197).chr(145) => 'o', | |
| 1171 | + chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe', | |
| 1172 | + chr(197).chr(148) => 'R',chr(197).chr(149) => 'r', | |
| 1173 | + chr(197).chr(150) => 'R',chr(197).chr(151) => 'r', | |
| 1174 | + chr(197).chr(152) => 'R',chr(197).chr(153) => 'r', | |
| 1175 | + chr(197).chr(154) => 'S',chr(197).chr(155) => 's', | |
| 1176 | + chr(197).chr(156) => 'S',chr(197).chr(157) => 's', | |
| 1177 | + chr(197).chr(158) => 'S',chr(197).chr(159) => 's', | |
| 1178 | + chr(197).chr(160) => 'S', chr(197).chr(161) => 's', | |
| 1179 | + chr(197).chr(162) => 'T', chr(197).chr(163) => 't', | |
| 1180 | + chr(197).chr(164) => 'T', chr(197).chr(165) => 't', | |
| 1181 | + chr(197).chr(166) => 'T', chr(197).chr(167) => 't', | |
| 1182 | + chr(197).chr(168) => 'U', chr(197).chr(169) => 'u', | |
| 1183 | + chr(197).chr(170) => 'U', chr(197).chr(171) => 'u', | |
| 1184 | + chr(197).chr(172) => 'U', chr(197).chr(173) => 'u', | |
| 1185 | + chr(197).chr(174) => 'U', chr(197).chr(175) => 'u', | |
| 1186 | + chr(197).chr(176) => 'U', chr(197).chr(177) => 'u', | |
| 1187 | + chr(197).chr(178) => 'U', chr(197).chr(179) => 'u', | |
| 1188 | + chr(197).chr(180) => 'W', chr(197).chr(181) => 'w', | |
| 1189 | + chr(197).chr(182) => 'Y', chr(197).chr(183) => 'y', | |
| 1190 | + chr(197).chr(184) => 'Y', chr(197).chr(185) => 'Z', | |
| 1191 | + chr(197).chr(186) => 'z', chr(197).chr(187) => 'Z', | |
| 1192 | + chr(197).chr(188) => 'z', chr(197).chr(189) => 'Z', | |
| 1193 | + chr(197).chr(190) => 'z', chr(197).chr(191) => 's', | |
| 1194 | + // Euro Sign | |
| 1195 | + chr(226).chr(130).chr(172) => 'E', | |
| 1196 | + // GBP (Pound) Sign | |
| 1197 | + chr(194).chr(163) => ''); | |
| 1198 | + $string = strtr($string, $chars); | |
| 1199 | + } else { | |
| 1200 | + // Assume ISO-8859-1 if not UTF-8 | |
| 1201 | + $chars['in'] = chr(128).chr(131).chr(138).chr(142).chr(154).chr(158) | |
| 1202 | + .chr(159).chr(162).chr(165).chr(181).chr(192).chr(193).chr(194) | |
| 1203 | + .chr(195).chr(196).chr(197).chr(199).chr(200).chr(201).chr(202) | |
| 1204 | + .chr(203).chr(204).chr(205).chr(206).chr(207).chr(209).chr(210) | |
| 1205 | + .chr(211).chr(212).chr(213).chr(214).chr(216).chr(217).chr(218) | |
| 1206 | + .chr(219).chr(220).chr(221).chr(224).chr(225).chr(226).chr(227) | |
| 1207 | + .chr(228).chr(229).chr(231).chr(232).chr(233).chr(234).chr(235) | |
| 1208 | + .chr(236).chr(237).chr(238).chr(239).chr(241).chr(242).chr(243) | |
| 1209 | + .chr(244).chr(245).chr(246).chr(248).chr(249).chr(250).chr(251) | |
| 1210 | + .chr(252).chr(253).chr(255); | |
| 1211 | + $chars['out'] = "EfSZszYcYuAAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiinoooooouuuuyy"; | |
| 1212 | + $string = strtr($string, $chars['in'], $chars['out']); | |
| 1213 | + $double_chars['in'] = array(chr(140), chr(156), chr(198), chr(208), chr(222), chr(223), chr(230), chr(240), chr(254)); | |
| 1214 | + $double_chars['out'] = array('OE', 'oe', 'AE', 'DH', 'TH', 'ss', 'ae', 'dh', 'th'); | |
| 1215 | + $string = str_replace($double_chars['in'], $double_chars['out'], $string); | |
| 1216 | + } | |
| 1217 | + return $string; | |
| 1218 | + } | |
| 1219 | + function converte($texto){ | |
| 1220 | + if($this->convUTF == true) | |
| 1221 | + $texto = mb_convert_encoding($texto,mb_detect_encoding($texto),"UTF-8"); | |
| 1222 | + else | |
| 1223 | + $texto = mb_convert_encoding($texto,mb_detect_encoding($texto),"ISO-8859-1"); | |
| 1224 | + return $texto; | |
| 1225 | + } | |
| 1226 | + function verificaPapelSessao($id_papel){ | |
| 1227 | + if(!empty($_COOKIE["i3geocodigologin"])){ | |
| 1228 | + session_write_close(); | |
| 1229 | + session_name("i3GeoLogin"); | |
| 1230 | + session_id($_COOKIE["i3geocodigologin"]); | |
| 1231 | + session_start(); | |
| 1232 | + //var_dump($_SESSION);exit; | |
| 1233 | + if($_SESSION["usuario"] != $_COOKIE["i3geousuariologin"]){ | |
| 1234 | + return false; | |
| 1235 | + } | |
| 1236 | + foreach($_SESSION["papeis"] as $p){ | |
| 1237 | + if($p == 1 || $p == $id_papel){ | |
| 1238 | + return true; | |
| 1239 | + } | |
| 1240 | + } | |
| 1241 | + } | |
| 1242 | + else{//caso nao exista, retorna um erro | |
| 1243 | + return false; | |
| 1244 | + } | |
| 1245 | + } | |
| 1246 | + function verificaOperacaoSessao($operacao){ | |
| 1247 | + if($_COOKIE["i3geocodigologin"] != ""){ | |
| 1248 | + session_write_close(); | |
| 1249 | + session_name("i3GeoLogin"); | |
| 1250 | + session_id($_COOKIE["i3geocodigologin"]); | |
| 1251 | + session_start(); | |
| 1252 | + $resultado = false; | |
| 1253 | + //verifica se e administrador | |
| 1254 | + foreach($_SESSION["papeis"] as $p){ | |
| 1255 | + if($p == 1){ | |
| 1256 | + return true; | |
| 1257 | + } | |
| 1258 | + } | |
| 1259 | + if(!empty($_SESSION["operacoes"][$operacao])){ | |
| 1260 | + $resultado = true; | |
| 1261 | + } | |
| 1262 | + return $resultado; | |
| 1263 | + } else { | |
| 1264 | + return false; | |
| 1265 | + } | |
| 1266 | + } | |
| 1267 | +} | |
| 1268 | +?> | |
| 0 | 1269 | \ No newline at end of file | ... | ... |
admin/php/xxxmapas.php
| ... | ... | @@ -1,329 +0,0 @@ |
| 1 | -<?php | |
| 2 | -/* | |
| 3 | -Title: mapas.php | |
| 4 | - | |
| 5 | -Funções utilizadas pelo editor do cadastro de mapas (links). | |
| 6 | - | |
| 7 | -É utilizado nas funções em AJAX da interface de edição dos links para mapas | |
| 8 | - | |
| 9 | -Licenca: | |
| 10 | - | |
| 11 | -GPL2 | |
| 12 | - | |
| 13 | -i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet | |
| 14 | - | |
| 15 | -Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil | |
| 16 | -Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com | |
| 17 | - | |
| 18 | -Este programa é software livre; você pode redistribuí-lo | |
| 19 | -e/ou modificá-lo sob os termos da Licença Pública Geral | |
| 20 | -GNU conforme publicada pela Free Software Foundation; | |
| 21 | - | |
| 22 | -Este programa é distribuído na expectativa de que seja útil, | |
| 23 | -porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita | |
| 24 | -de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. | |
| 25 | -Consulte a Licença Pública Geral do GNU para mais detalhes. | |
| 26 | -Você deve ter recebido uma cópia da Licença Pública Geral do | |
| 27 | - GNU junto com este programa; se não, escreva para a | |
| 28 | -Free Software Foundation, Inc., no endereço | |
| 29 | -59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 30 | - | |
| 31 | -Arquivo: | |
| 32 | - | |
| 33 | -i3geo/admin/php/mapas.php | |
| 34 | - | |
| 35 | -Parametros: | |
| 36 | - | |
| 37 | -O parâmetro principal é "funcao", que define qual operação será executada, por exemplo, mapas.php?funcao=pegamapas. | |
| 38 | - | |
| 39 | -Cada operação possuí seus próprios parâmetros, que devem ser enviados também na requisição da operação. | |
| 40 | - | |
| 41 | -*/ | |
| 42 | -include_once(dirname(__FILE__)."/login.php"); | |
| 43 | -$funcoesEdicao = array( | |
| 44 | - "ALTERARMAPA", | |
| 45 | - "EXCLUIRMAPA", | |
| 46 | - "SALVAMAPFILE" | |
| 47 | -); | |
| 48 | -if(in_array(strtoupper($funcao),$funcoesEdicao)){ | |
| 49 | - if(verificaOperacaoSessao("admin/html/mapas") == false){ | |
| 50 | - retornaJSON("Vc nao pode realizar essa operacao. Tente fazer login novamente.");exit; | |
| 51 | - } | |
| 52 | -} | |
| 53 | -$id = $_GET["id"]; | |
| 54 | -$id_mapa = $_GET["id_mapa"]; | |
| 55 | -testaSafeNumerico([$id,$id_mapa]); | |
| 56 | - | |
| 57 | - | |
| 58 | -//error_reporting(0); | |
| 59 | -//faz a busca da função que deve ser executada | |
| 60 | -switch (strtoupper($funcao)) | |
| 61 | -{ | |
| 62 | - /* | |
| 63 | - Note: | |
| 64 | - | |
| 65 | - Valores que o parâmetro &funcao pode receber. Os parâmetros devem ser enviados na requisição em AJAX. | |
| 66 | - */ | |
| 67 | - /* | |
| 68 | - Valor: PEGAMAPAS | |
| 69 | - | |
| 70 | - Lista os links existentes | |
| 71 | - | |
| 72 | - Retorno: | |
| 73 | - | |
| 74 | - {JSON} | |
| 75 | - */ | |
| 76 | - case "PEGAMAPAS": | |
| 77 | - $semmapfile = pegaDados("SELECT id_mapa,nome_mapa,ordem_mapa,'nao' as contemmapfile from ".$esquemaadmin."i3geoadmin_mapas where mapfile = '' or mapfile is null order by ordem_mapa"); | |
| 78 | - $commapfile = pegaDados("SELECT id_mapa,nome_mapa,ordem_mapa,'sim' as contemmapfile from ".$esquemaadmin."i3geoadmin_mapas where mapfile != '' and mapfile is not null order by ordem_mapa"); | |
| 79 | - retornaJSON(array_merge($semmapfile,$commapfile)); | |
| 80 | - exit; | |
| 81 | - break; | |
| 82 | - /* | |
| 83 | - Valor: PEGADADOSMAPA | |
| 84 | - | |
| 85 | - Lista os dados de um link | |
| 86 | - | |
| 87 | - Parametro: | |
| 88 | - | |
| 89 | - id_mapa {string} | |
| 90 | - | |
| 91 | - Retorno: | |
| 92 | - | |
| 93 | - {JSON} | |
| 94 | - */ | |
| 95 | - case "PEGADADOSMAPA": | |
| 96 | - $dadosMapa = pegaDados("SELECT * from ".$esquemaadmin."i3geoadmin_mapas where id_mapa =".$id_mapa); | |
| 97 | - retornaJSON($dadosMapa); | |
| 98 | - exit; | |
| 99 | - break; | |
| 100 | - /* | |
| 101 | - Valor: ALTERARMAPA | |
| 102 | - | |
| 103 | - Altera os dados de um link | |
| 104 | - | |
| 105 | - Parametro: | |
| 106 | - | |
| 107 | - publicado_mapa | |
| 108 | - | |
| 109 | - ordem_mapa | |
| 110 | - | |
| 111 | - id_mapa | |
| 112 | - | |
| 113 | - desc_mapa | |
| 114 | - | |
| 115 | - ext_mapa | |
| 116 | - | |
| 117 | - imagem_mapa | |
| 118 | - | |
| 119 | - outros_mapa | |
| 120 | - | |
| 121 | - nome_mapa | |
| 122 | - | |
| 123 | - linkdireto_mapa | |
| 124 | - | |
| 125 | - temas_mapa | |
| 126 | - | |
| 127 | - ligados_mapa | |
| 128 | - | |
| 129 | - perfil_mapa | |
| 130 | - | |
| 131 | - Retorno: | |
| 132 | - | |
| 133 | - {JSON} | |
| 134 | - */ | |
| 135 | - case "ALTERARMAPA": | |
| 136 | - $novo = alterarMapa(); | |
| 137 | - $sql = "SELECT * from ".$esquemaadmin."i3geoadmin_mapas WHERE id_mapa = '".$novo."'"; | |
| 138 | - retornaJSON(pegaDados($sql)); | |
| 139 | - exit; | |
| 140 | - break; | |
| 141 | - /* | |
| 142 | - Valor: EXCLUIRMAPA | |
| 143 | - | |
| 144 | - Exclui um link | |
| 145 | - | |
| 146 | - Parametro: | |
| 147 | - | |
| 148 | - id {string} | |
| 149 | - | |
| 150 | - Retorno: | |
| 151 | - | |
| 152 | - {JSON} | |
| 153 | - */ | |
| 154 | - case "EXCLUIRMAPA": | |
| 155 | - retornaJSON(excluirMapa()); | |
| 156 | - exit; | |
| 157 | - break; | |
| 158 | - /* | |
| 159 | - Valor: SALVAMAPFILE | |
| 160 | - | |
| 161 | - Salva um mapfile no banco | |
| 162 | - | |
| 163 | - Parametro: | |
| 164 | - | |
| 165 | - url {string} - url de acesso a interface do mapa que iniciou o processo de salvar o mapa | |
| 166 | - | |
| 167 | - titulo {string} - titulo do mapa | |
| 168 | - | |
| 169 | - mapfile {string} - mapfile na pasta temporária | |
| 170 | - | |
| 171 | - Retorno: | |
| 172 | - | |
| 173 | - {JSON} | |
| 174 | - */ | |
| 175 | - case "SALVAMAPFILE": | |
| 176 | - retornaJSON(salvaMapfile()); | |
| 177 | - exit; | |
| 178 | - break; | |
| 179 | -} | |
| 180 | -function salvaMapfile(){ | |
| 181 | - global $esquemaadmin,$id_mapa; | |
| 182 | - //as preferencias sao criadas via javascript e guardadas junto com o mapa | |
| 183 | - try{ | |
| 184 | - // | |
| 185 | - //as configuracoes especiais do mapa, definidas nas preferencias ou em ferramentas abertas quando o mapa e salvo, | |
| 186 | - //sao convertidas em base64 do lado do cliente | |
| 187 | - //esses dados sao entao armazenados como tags METADATA no mapfile | |
| 188 | - //quando o mapa e restaurado, esses valores sao recuperados | |
| 189 | - //a string que vai no metadata segue o padrao JSON | |
| 190 | - //o parser para reconstruir os valores e feito em javascript, no cliente | |
| 191 | - // | |
| 192 | - $_GET["arqmapfile"] = str_replace(".map","",$_GET["arqmapfile"]); | |
| 193 | - $_GET["arqmapfile"] = str_replace(".","",$_GET["arqmapfile"]).".map"; | |
| 194 | - $customizacoesinit = array(); | |
| 195 | - if(isset($_GET["preferenciasbase64"]) || isset($_GET["geometriasbase64"]) || isset($_GET["graficosbase64"]) || isset($_GET["tabelasbase64"])){ | |
| 196 | - $customizacoesinit[] = '"preferenciasbase64":"'.$_GET["preferenciasbase64"].'"'; | |
| 197 | - $customizacoesinit[] = '"geometriasbase64":"'.$_GET["geometriasbase64"].'"'; | |
| 198 | - $customizacoesinit[] = '"graficosbase64":"'.$_GET["graficosbase64"].'"'; | |
| 199 | - $customizacoesinit[] = '"tabelasbase64":"'.$_GET["tabelasbase64"].'"'; | |
| 200 | - $m = ms_newMapObj($_GET["arqmapfile"]); | |
| 201 | - $m->setmetadata("CUSTOMIZACOESINIT",'{'.implode(",",$customizacoesinit).'}'); | |
| 202 | - $m->save($_GET["arqmapfile"]); | |
| 203 | - } | |
| 204 | - if($_GET["ext"] && $_GET["ext"] != ""){ | |
| 205 | - $e = explode(" ",$_GET["ext"]); | |
| 206 | - $m = ms_newMapObj($_GET["arqmapfile"]); | |
| 207 | - $extatual = $m->extent; | |
| 208 | - $extatual->setextent((min($e[0],$e[2])),(min($e[1],$e[3])),(max($e[0],$e[2])),(max($e[1],$e[3]))); | |
| 209 | - $m->save($_GET["arqmapfile"]); | |
| 210 | - } | |
| 211 | - $handle = fopen ($_GET["arqmapfile"], 'r'); | |
| 212 | - $conteudo = fread ($handle, filesize ($_GET["arqmapfile"])); | |
| 213 | - fclose ($handle); | |
| 214 | - //$conteudo = base64_encode($conteudo); | |
| 215 | - $conteudo = str_replace("'","_!_",$conteudo); | |
| 216 | - $conteudo = str_replace('"',"_!!_",$conteudo); | |
| 217 | - $conteudo = str_replace(array("<?","?>"),"",$conteudo); | |
| 218 | - | |
| 219 | - require_once("conexao.php"); | |
| 220 | - if($convUTF){ | |
| 221 | - $_GET["nome_mapa"] = utf8_encode($_GET["nome_mapa"]); | |
| 222 | - $conteudo = utf8_encode($conteudo); | |
| 223 | - } | |
| 224 | - $retorna = ""; | |
| 225 | - if(empty($id_mapa)){ | |
| 226 | - $dataCol = array( | |
| 227 | - "publicado_mapa" => '', | |
| 228 | - "ordem_mapa" => 0, | |
| 229 | - "perfil_mapa" => '', | |
| 230 | - "desc_mapa" => '', | |
| 231 | - "ext_mapa" => '', | |
| 232 | - "imagem_mapa" => '', | |
| 233 | - "linkdireto_mapa" => '', | |
| 234 | - "outros_mapa" => '', | |
| 235 | - "temas_mapa" => '', | |
| 236 | - "ligados_mapa" => '', | |
| 237 | - "nome_mapa" => '' | |
| 238 | - ); | |
| 239 | - $id = i3GeoAdminInsertUnico($dbhw,"i3geoadmin_mapas",$dataCol,"nome_mapa","id_mapa"); | |
| 240 | - } | |
| 241 | - else{ | |
| 242 | - $id = $id_mapa; | |
| 243 | - } | |
| 244 | - if (filter_var($id, FILTER_VALIDATE_INT) === false){ | |
| 245 | - return array("id"=>"","status"=>"Error!: "); | |
| 246 | - } | |
| 247 | - $dataCol = array( | |
| 248 | - "mapfile" => $conteudo, | |
| 249 | - "publicado_mapa" => "sim", | |
| 250 | - "nome_mapa" => $_GET["nome_mapa"], | |
| 251 | - "outros_mapa" => "&restauramapa=$id&interface=".$_GET["url"] | |
| 252 | - ); | |
| 253 | - i3GeoAdminUpdate($dbhw,"i3geoadmin_mapas",$dataCol, "WHERE id_mapa =".$id); | |
| 254 | - $dbhw = null; | |
| 255 | - $dbh = null; | |
| 256 | - return array("id"=>$id,"status"=>"ok"); | |
| 257 | - } | |
| 258 | - catch (PDOException $e){ | |
| 259 | - return array("id"=>"","status"=>"Error!: "); | |
| 260 | - } | |
| 261 | -} | |
| 262 | -/* | |
| 263 | -Altera o registro de um mapa | |
| 264 | -*/ | |
| 265 | -function alterarMapa(){ | |
| 266 | - global $esquemaadmin,$id_mapa; | |
| 267 | - //substitui a string do parametro outros | |
| 268 | - $_GET["outros_mapa"] = str_replace("*","&",$_GET["outros_mapa"]); | |
| 269 | - try{ | |
| 270 | - require_once("conexao.php"); | |
| 271 | - if($convUTF){ | |
| 272 | - $_GET["nome_mapa"] = utf8_encode($_GET["nome_mapa"]); | |
| 273 | - $_GET["desc_mapa"] = utf8_encode($_GET["desc_mapa"]); | |
| 274 | - } | |
| 275 | - $retorna = ""; | |
| 276 | - if($id_mapa != ""){ | |
| 277 | - $dataCol = array( | |
| 278 | - "publicado_mapa" => $_GET["publicado_mapa"], | |
| 279 | - "ordem_mapa" => $_GET["ordem_mapa"], | |
| 280 | - "desc_mapa" => $_GET["desc_mapa"], | |
| 281 | - "ext_mapa" => $_GET["ext_mapa"], | |
| 282 | - "imagem_mapa" => $_GET["imagem_mapa"], | |
| 283 | - "outros_mapa" => $_GET["outros_mapa"], | |
| 284 | - "nome_mapa" => $_GET["nome_mapa"], | |
| 285 | - "linkdireto_mapa" => $_GET["linkdireto_mapa"], | |
| 286 | - "temas_mapa" => $_GET["temas_mapa"], | |
| 287 | - "ligados_mapa" => $_GET["ligados_mapa"], | |
| 288 | - "perfil_mapa" => $_GET["perfil_mapa"] | |
| 289 | - ); | |
| 290 | - i3GeoAdminUpdate($dbhw,"i3geoadmin_mapas",$dataCol, "WHERE id_mapa =".$id_mapa); | |
| 291 | - $retorna = $id_mapa; | |
| 292 | - } | |
| 293 | - else{ | |
| 294 | - $dataCol = array( | |
| 295 | - "publicado_mapa" => '', | |
| 296 | - "ordem_mapa" => 0, | |
| 297 | - "perfil_mapa" => '', | |
| 298 | - "desc_mapa" => '', | |
| 299 | - "ext_mapa" => '', | |
| 300 | - "imagem_mapa" => '', | |
| 301 | - "linkdireto_mapa" => '', | |
| 302 | - "outros_mapa" => '', | |
| 303 | - "temas_mapa" => '', | |
| 304 | - "ligados_mapa" => '', | |
| 305 | - "nome_mapa" => '', | |
| 306 | - "mapfile" => '' | |
| 307 | - ); | |
| 308 | - $id = i3GeoAdminInsertUnico($dbhw,"i3geoadmin_mapas",$dataCol,"nome_mapa","id_mapa"); | |
| 309 | - $retorna = $id; | |
| 310 | - } | |
| 311 | - $dbhw = null; | |
| 312 | - $dbh = null; | |
| 313 | - return $retorna; | |
| 314 | - } | |
| 315 | - catch (PDOException $e){ | |
| 316 | - return "Error!: "; | |
| 317 | - } | |
| 318 | -} | |
| 319 | -function excluirMapa(){ | |
| 320 | - global $id,$esquemaadmin; | |
| 321 | - try{ | |
| 322 | - exclui($esquemaadmin."i3geoadmin_mapas","id_mapa",$id); | |
| 323 | - return "ok"; | |
| 324 | - } | |
| 325 | - catch (PDOException $e){ | |
| 326 | - return "Error!: "; | |
| 327 | - } | |
| 328 | -} | |
| 329 | -?> | |
| 330 | 0 | \ No newline at end of file |
admin1/catalogo/atlas/pranchas/temas/exec.php
| ... | ... | @@ -62,7 +62,7 @@ switch ($funcao) { |
| 62 | 62 | if ($dados === false) { |
| 63 | 63 | header ( "HTTP/1.1 500 erro ao consultar banco de dados tabela de temas de uma prancha" ); |
| 64 | 64 | } else { |
| 65 | - include("../../../../../admin/php/classe_arvore.php"); | |
| 65 | + include("../../../../../classesphp/classe_arvore.php"); | |
| 66 | 66 | $arvore = new Arvore($_SESSION["locaplic"]); |
| 67 | 67 | $temas = $arvore->pegaTodosTemas(true); |
| 68 | 68 | \admin\php\funcoesAdmin\retornaJSON ( array("dados"=>$dados, "temas"=>$temas) ); |
| ... | ... | @@ -77,7 +77,7 @@ switch ($funcao) { |
| 77 | 77 | header ( "HTTP/1.1 500 erro ao consultar banco de dados tabela de temas de uma prancha" ); |
| 78 | 78 | } else { |
| 79 | 79 | //pega a lista de temas |
| 80 | - include("../../../../../admin/php/classe_arvore.php"); | |
| 80 | + include("../../../../../classesphp/classe_arvore.php"); | |
| 81 | 81 | $arvore = new Arvore($_SESSION["locaplic"]); |
| 82 | 82 | $temas = $arvore->pegaTodosTemas(true); |
| 83 | 83 | \admin\php\funcoesAdmin\retornaJSON ( array("dados"=>$dados, "temas"=>$temas) ); | ... | ... |
admin1/catalogo/mapas/exec.php
| ... | ... | @@ -81,7 +81,7 @@ switch ($funcao) { |
| 81 | 81 | $dbhw = null; |
| 82 | 82 | $dbh = null; |
| 83 | 83 | // pega a lista de temas |
| 84 | - include ("../../../admin/php/classe_arvore.php"); | |
| 84 | + include ("../../../classesphp/classe_arvore.php"); | |
| 85 | 85 | $arvore = new Arvore($_SESSION["locaplic"]); |
| 86 | 86 | $temas = $arvore->pegaTodosTemas(true); |
| 87 | 87 | \admin\php\funcoesAdmin\retornaJSON(array( |
| ... | ... | @@ -103,7 +103,7 @@ switch ($funcao) { |
| 103 | 103 | $dbhw = null; |
| 104 | 104 | $dbh = null; |
| 105 | 105 | // pega a lista de temas |
| 106 | - include ("../../../admin/php/classe_arvore.php"); | |
| 106 | + include ("../../../classesphp/classe_arvore.php"); | |
| 107 | 107 | $arvore = new Arvore($_SESSION["locaplic"]); |
| 108 | 108 | $temas = $arvore->pegaTodosTemas(true); |
| 109 | 109 | \admin\php\funcoesAdmin\retornaJSON(array( | ... | ... |
admin1/catalogo/mapfile/editor/funcoes.php
admin1/catalogo/mapfile/editor/index.php
| ... | ... | @@ -13,6 +13,10 @@ |
| 13 | 13 | // |
| 14 | 14 | include ("../../../php/checaLogin.php"); |
| 15 | 15 | \admin\php\login\checaLogin(); |
| 16 | + | |
| 17 | + | |
| 18 | +//$k = filter_var ( $k, FILTER_SANITIZE_STRING ); | |
| 19 | + | |
| 16 | 20 | //funcoes de administracao |
| 17 | 21 | include ($_SESSION["locaplic"]."/admin1/php/funcoesAdmin.php"); |
| 18 | 22 | // |
| ... | ... | @@ -30,6 +34,7 @@ include ("funcoes.php"); |
| 30 | 34 | // |
| 31 | 35 | include ($_SESSION["locaplic"]."/admin1/php/conexao.php"); |
| 32 | 36 | /***************************************************************/ |
| 37 | + | |
| 33 | 38 | define ( "ONDEI3GEO", "../../../.." ); |
| 34 | 39 | include "../../../head.php"; |
| 35 | 40 | $codigo = filter_var ( $_GET ["codigo"], FILTER_SANITIZE_STRING ); |
| ... | ... | @@ -102,7 +107,7 @@ $textoMapfile = \admin\catalogo\mapfile\editor\textoMapfile ( $codigo ); |
| 102 | 107 | </form> |
| 103 | 108 | <!-- para calcular a altura do textarea --> |
| 104 | 109 | <pre id="editortemp" style="font-size: 16px; display: block; visibility: hidden;"><?php echo $textoMapfile["texto"]; ?></pre> |
| 105 | - </div> | |
| 110 | + </div> | |
| 106 | 111 | </div> |
| 107 | 112 | </div> |
| 108 | 113 | ... | ... |
| ... | ... | @@ -0,0 +1,1268 @@ |
| 1 | +<?php | |
| 2 | +/* | |
| 3 | +Title: classe_arvore.php | |
| 4 | + | |
| 5 | +Funções para montagem da árvore de temas | |
| 6 | + | |
| 7 | +Licenca: | |
| 8 | + | |
| 9 | +GPL2 | |
| 10 | + | |
| 11 | +i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet | |
| 12 | + | |
| 13 | +Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil | |
| 14 | +Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com | |
| 15 | + | |
| 16 | +Este programa é software livre; você pode redistribuí-lo | |
| 17 | +e/ou modificá-lo sob os termos da Licença Pública Geral | |
| 18 | +GNU conforme publicada pela Free Software Foundation; | |
| 19 | + | |
| 20 | +Este programa é distribuído na expectativa de que seja útil, | |
| 21 | +porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita | |
| 22 | +de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. | |
| 23 | +Consulte a Licença Pública Geral do GNU para mais detalhes. | |
| 24 | +Você deve ter recebido uma c�pia da Licença Pública Geral do | |
| 25 | + GNU junto com este programa; se não, escreva para a | |
| 26 | +Free Software Foundation, Inc., no endereço | |
| 27 | +59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 28 | + | |
| 29 | +Arquivo: | |
| 30 | + | |
| 31 | +classe_arvore.php | |
| 32 | +*/ | |
| 33 | +/* | |
| 34 | +Classe: Arvore | |
| 35 | + | |
| 36 | +Classe utilizada para compor a árvore de temas ou obter dados específicos da árvore. | |
| 37 | + | |
| 38 | +É utilizada por várias operações do i3Geo, principalmente pela <classe_menutemas> | |
| 39 | +*/ | |
| 40 | +class Arvore | |
| 41 | +{ | |
| 42 | + //temas com acesso restrito e que nao podem ser acessados pelo usuario que esta logado | |
| 43 | + public $temassindevidos; | |
| 44 | + protected $locaplic; | |
| 45 | + //subgrupos que tem pelo menos um tema | |
| 46 | + //public $sql_subgrupos = "select i3geoadmin_subgrupos.nome_subgrupo,i3geoadmin_n2.id_n2,i3geoadmin_n2.publicado,i3geoadmin_n2.n2_perfil from i3geoadmin_n2 LEFT JOIN i3geoadmin_subgrupos ON i3geoadmin_n2.id_subgrupo = i3geoadmin_subgrupos.id_subgrupo "; | |
| 47 | + //grupos que tem pelo menos um sub-grupo | |
| 48 | + //public $sql_grupos = "select i3geoadmin_grupos.nome_grupo,id_n1,id_menu,i3geoadmin_n1.publicado,n1_perfil from i3geoadmin_n1 LEFT JOIN i3geoadmin_grupos ON i3geoadmin_n1.id_grupo = i3geoadmin_grupos.id_grupo "; | |
| 49 | + //nomes de todos os grupos | |
| 50 | + public $sql_todosgrupos = "select * from i3geoadmin_grupos "; | |
| 51 | + //tipo de filtro | |
| 52 | + //ogc|download|"" | |
| 53 | + public $filtro; | |
| 54 | + //temas na raiz | |
| 55 | + //public $sql_temasraiz = "select id_raiz,i3geoadmin_raiz.id_tema,nome_tema,tipoa_tema FROM i3geoadmin_raiz LEFT JOIN i3geoadmin_temas ON i3geoadmin_temas.id_tema = i3geoadmin_raiz.id_tema "; | |
| 56 | + //todos os temas | |
| 57 | + //public $sql_temas = "select * from i3geoadmin_temas "; | |
| 58 | + //temas de um subgrupo | |
| 59 | + //public $sql_temasSubgrupo = "select i3geoadmin_temas.tipoa_tema, i3geoadmin_temas.codigo_tema,i3geoadmin_temas.tags_tema,i3geoadmin_n3.id_n3,i3geoadmin_temas.nome_tema,i3geoadmin_n3.publicado,i3geoadmin_n3.n3_perfil,i3geoadmin_n3.id_tema,i3geoadmin_temas.download_tema,i3geoadmin_temas.ogc_tema from i3geoadmin_n3 LEFT JOIN i3geoadmin_temas ON i3geoadmin_n3.id_tema = i3geoadmin_temas.id_tema "; | |
| 60 | + /* | |
| 61 | + Function: __construct | |
| 62 | + | |
| 63 | + Cria um objeto Arvore | |
| 64 | + | |
| 65 | + Parametros: | |
| 66 | + | |
| 67 | + locaplic {string} - localização do i3geo no sistema de arquivos | |
| 68 | + | |
| 69 | + idioma {string} - default = "pt" | |
| 70 | + */ | |
| 71 | + function __construct($locaplic,$idioma="pt",$filtro="") | |
| 72 | + { | |
| 73 | + $this->locaplic = $locaplic; | |
| 74 | + $this->filtro = $filtro; | |
| 75 | + $dbh = ""; | |
| 76 | + //error_reporting(0); | |
| 77 | + | |
| 78 | + include($locaplic."/classesphp/conexao.php"); | |
| 79 | + | |
| 80 | + $this->esquemaadmin = $esquemaadmin; | |
| 81 | + $this->convUTF = $convUTF; | |
| 82 | + $this->dbh = $dbh; | |
| 83 | + | |
| 84 | + $this->idioma = $idioma; | |
| 85 | + if($idioma == "pt"){ | |
| 86 | + $coluna = "nome_grupo"; | |
| 87 | + } | |
| 88 | + else{ | |
| 89 | + $coluna = $idioma; | |
| 90 | + } | |
| 91 | + $this->sql_grupos = "select CASE i3geoadmin_grupos.$coluna WHEN '' THEN nome_grupo ELSE i3geoadmin_grupos.$coluna END as nome_grupo,i3geoadmin_grupos.id_grupo, id_n1,id_menu,i3geoadmin_n1.publicado,n1_perfil,ordem from ".$this->esquemaadmin."i3geoadmin_n1 LEFT JOIN ".$this->esquemaadmin."i3geoadmin_grupos ON i3geoadmin_n1.id_grupo = i3geoadmin_grupos.id_grupo "; | |
| 92 | + if($filtro === "ogc" || $filtro === "download"){ | |
| 93 | + //esse sql retorna tambem os grupos dos temas que estao na raiz do grupo | |
| 94 | + $this->sql_grupos = "select DISTINCT * from (select CASE grupos.$coluna WHEN '' THEN nome_grupo ELSE grupos.$coluna END as nome_grupo,gr.id_n1,gr.id_menu,gr.publicado,gr.n1_perfil, 0 as ordem from ".$this->esquemaadmin."i3geoadmin_grupos as grupos, ".$this->esquemaadmin."i3geoadmin_n1 as gr, ".$this->esquemaadmin."i3geoadmin_n2 as sg, ".$this->esquemaadmin."i3geoadmin_n3 as t, ".$this->esquemaadmin."i3geoadmin_temas as temas where gr.id_grupo = grupos.id_grupo AND sg.id_n1 = gr.id_n1 AND t.id_n2 = sg.id_n2 AND t.id_tema = temas.id_tema AND (temas.ogc_tema NOT IN ('NAO','nao') OR temas.download_tema NOT IN ('NAO','nao') ) UNION select c.nome_grupo as nome_grupo,a.id_nivel as id_n1,a.id_menu,'SIM' as publicado,a.perfil as n1_perfil, 0 as ordem from ".$this->esquemaadmin."i3geoadmin_raiz as a, ".$this->esquemaadmin."i3geoadmin_temas as b, ".$this->esquemaadmin."i3geoadmin_grupos as c, ".$this->esquemaadmin."i3geoadmin_n1 as d where nivel = 1 AND a.id_tema = b.id_tema AND a.id_nivel = d.id_n1 AND d.id_grupo = c.id_grupo) as s "; | |
| 95 | + } | |
| 96 | + | |
| 97 | + if($idioma == "pt"){ | |
| 98 | + $coluna = "nome_subgrupo"; | |
| 99 | + } | |
| 100 | + else{ | |
| 101 | + $coluna = $idioma; | |
| 102 | + } | |
| 103 | + $this->sql_subgrupos = "select CASE i3geoadmin_subgrupos.$coluna WHEN '' THEN nome_subgrupo ELSE i3geoadmin_subgrupos.$coluna END as nome_subgrupo,i3geoadmin_subgrupos.id_subgrupo,i3geoadmin_n2.id_n2,i3geoadmin_n2.publicado,i3geoadmin_n2.n2_perfil from ".$this->esquemaadmin."i3geoadmin_n2 LEFT JOIN ".$this->esquemaadmin."i3geoadmin_subgrupos ON i3geoadmin_n2.id_subgrupo = i3geoadmin_subgrupos.id_subgrupo "; | |
| 104 | + | |
| 105 | + if($idioma == "pt"){ | |
| 106 | + $coluna = "nome_tema"; | |
| 107 | + } | |
| 108 | + else{ | |
| 109 | + $coluna = $idioma; | |
| 110 | + } | |
| 111 | + | |
| 112 | + $this->sql_temasraiz = "select id_nivel,ordem,codigo_tema,id_raiz,i3geoadmin_raiz.id_tema,CASE $coluna WHEN '' THEN nome_tema ELSE $coluna END as nome_tema,tipoa_tema,perfil, ogc_tema, download_tema, link_tema FROM ".$this->esquemaadmin."i3geoadmin_raiz LEFT JOIN ".$this->esquemaadmin."i3geoadmin_temas ON i3geoadmin_temas.id_tema = i3geoadmin_raiz.id_tema "; | |
| 113 | + $this->sql_temasSubgrupo = "select i3geoadmin_temas.tipoa_tema, i3geoadmin_temas.codigo_tema,i3geoadmin_temas.tags_tema,i3geoadmin_n3.id_n3,CASE i3geoadmin_temas.$coluna WHEN '' THEN nome_tema ELSE i3geoadmin_temas.$coluna END as nome_tema,i3geoadmin_n3.publicado,i3geoadmin_n3.n3_perfil,i3geoadmin_n3.id_tema,i3geoadmin_temas.download_tema,i3geoadmin_temas.ogc_tema from ".$this->esquemaadmin."i3geoadmin_n3 LEFT JOIN ".$this->esquemaadmin."i3geoadmin_temas ON i3geoadmin_n3.id_tema = i3geoadmin_temas.id_tema "; | |
| 114 | + | |
| 115 | + //$this->sql_temas = "select kmz_tema,nacessos,id_tema,kml_tema,ogc_tema,download_tema,tags_tema,tipoa_tema,link_tema,desc_tema,$coluna as nome_tema,codigo_tema from i3geoadmin_temas "; | |
| 116 | + | |
| 117 | + $this->sql_temas = "select kmz_tema,b.soma as nacessos,id_tema,kml_tema,ogc_tema,download_tema,tags_tema,tipoa_tema,link_tema,desc_tema,CASE $coluna WHEN '' THEN nome_tema ELSE $coluna END as nome_tema,codigo_tema from ".$this->esquemaadmin."i3geoadmin_temas as a,(SELECT c.codigo_tema codigo_soma,sum( r.nacessos) as soma FROM ".$this->esquemaadmin."i3geoadmin_temas c LEFT JOIN ".$this->esquemaadmin."i3geoadmin_acessostema r ON (c.codigo_tema = r.codigo_tema) group by c.codigo_tema) as b WHERE a.codigo_tema = b.codigo_soma "; | |
| 118 | + $this->sql_temas_combo = "select id_tema,CASE $coluna WHEN '' THEN nome_tema ELSE $coluna END as nome_tema,codigo_tema from ".$this->esquemaadmin."i3geoadmin_temas as a,(SELECT c.codigo_tema codigo_soma,sum( r.nacessos) as soma FROM ".$this->esquemaadmin."i3geoadmin_temas c LEFT JOIN ".$this->esquemaadmin."i3geoadmin_acessostema r ON (c.codigo_tema = r.codigo_tema) group by c.codigo_tema) as b WHERE a.codigo_tema = b.codigo_soma "; | |
| 119 | + // | |
| 120 | + //verifica se o ip atual está cadastrado como um dos editores | |
| 121 | + //editores podem ver as coisas marcadas como não publicado | |
| 122 | + //no sistema de administração | |
| 123 | + // | |
| 124 | + $this->editor = false; | |
| 125 | + $this->editor = $this->verificaOperacaoSessao("admin/php/classe_arvore/editor"); | |
| 126 | + $this->pubsql = " (publicado != 'NAO' or publicado is null) and "; | |
| 127 | + if($this->editor){ | |
| 128 | + $this->pubsql = ""; | |
| 129 | + } | |
| 130 | + if(!function_exists("listaTemasIndevidos")){ | |
| 131 | + include_once($locaplic."/classesphp/funcoes_gerais.php"); | |
| 132 | + } | |
| 133 | + $this->temasindevidos = listaTemasIndevidos(); | |
| 134 | + } | |
| 135 | + function __destruct() | |
| 136 | + { | |
| 137 | + $this->dbh = null; | |
| 138 | + $this->dbhw = null; | |
| 139 | + } | |
| 140 | + /* | |
| 141 | + Function: validaTemas | |
| 142 | + | |
| 143 | + Remove de um array os temas que nao sao permitidos ao usuario atualmente logado | |
| 144 | + */ | |
| 145 | + function validaTemas($linhas,$id){ | |
| 146 | + $res = array(); | |
| 147 | + foreach($linhas as $l){ | |
| 148 | + if(!in_array($l[$id],$this->temasindevidos)){ | |
| 149 | + array_push($res,$l); | |
| 150 | + } | |
| 151 | + } | |
| 152 | + return $res; | |
| 153 | + } | |
| 154 | + /* | |
| 155 | + Function: pegaListaDeMenus | |
| 156 | + | |
| 157 | + Retorna a lista de menus | |
| 158 | + | |
| 159 | + Parametros: | |
| 160 | + | |
| 161 | + perfil {string} - considera apenas esse perfil | |
| 162 | + | |
| 163 | + Return: | |
| 164 | + | |
| 165 | + {array} | |
| 166 | + */ | |
| 167 | + function pegaListaDeMenus($perfil="",$filtraOgc="nao",$filtraDown="nao") | |
| 168 | + { | |
| 169 | + if($this->idioma == "pt"){ | |
| 170 | + $coluna = "nome_menu"; | |
| 171 | + } | |
| 172 | + else{ | |
| 173 | + $coluna = $this->idioma; | |
| 174 | + } | |
| 175 | + if($this->editor == true) | |
| 176 | + { | |
| 177 | + $perfil = ""; | |
| 178 | + $sql = "SELECT publicado_menu,'' as perfil_menu,aberto,desc_menu,id_menu,CASE $coluna WHEN '' THEN nome_menu ELSE $coluna END as nome_menu from ".$this->esquemaadmin."i3geoadmin_menus order by nome_menu"; | |
| 179 | + } | |
| 180 | + else{ | |
| 181 | + $sql = "SELECT publicado_menu,perfil_menu,aberto,desc_menu,id_menu,CASE $coluna WHEN '' THEN nome_menu ELSE $coluna END as nome_menu from ".$this->esquemaadmin."i3geoadmin_menus where publicado_menu != 'NAO' or publicado_menu is null order by nome_menu"; | |
| 182 | + } | |
| 183 | + $regs = $this->execSQL($sql); | |
| 184 | + $resultado = array(); | |
| 185 | + foreach($regs as $reg){ | |
| 186 | + $a = $reg["perfil_menu"]; | |
| 187 | + $a = str_replace(" ",",",$a); | |
| 188 | + if ($this->verificaOcorrencia($perfil,explode(",",$a))) | |
| 189 | + { | |
| 190 | + $status = "fechado"; | |
| 191 | + if(strtolower($reg["aberto"]) == "sim") | |
| 192 | + $status = "aberto"; | |
| 193 | + $url = ""; | |
| 194 | + $resultado[] = array("desc"=>$this->converte($reg["desc_menu"]),"publicado"=>$reg["publicado_menu"],"nomemenu"=>$this->converte($reg["nome_menu"]),"idmenu"=>$reg["id_menu"],"arquivo"=>"","status"=>$status,"url"=>$url); | |
| 195 | + } | |
| 196 | + } | |
| 197 | + return $resultado; | |
| 198 | + } | |
| 199 | + /* | |
| 200 | + Function: pegaListaDeTiposGrupos | |
| 201 | + | |
| 202 | + Retorna a lista de grupos de um menu | |
| 203 | + | |
| 204 | + Parametros: | |
| 205 | + | |
| 206 | + id_menu {string} | |
| 207 | + | |
| 208 | + Return: | |
| 209 | + | |
| 210 | + {array} | |
| 211 | + */ | |
| 212 | + function pegaListaDeTiposGrupos(){ | |
| 213 | + if($this->idioma == "pt"){ | |
| 214 | + $coluna = "nome_grupo"; | |
| 215 | + } | |
| 216 | + else{ | |
| 217 | + $coluna = $this->idioma; | |
| 218 | + } | |
| 219 | + $sql = "select CASE i3geoadmin_grupos.$coluna WHEN '' THEN nome_grupo ELSE i3geoadmin_grupos.$coluna END as nome_grupo, id_grupo from ".$this->esquemaadmin."i3geoadmin_grupos ORDER by nome_grupo "; | |
| 220 | + $grupos = $this->execSQL($sql); | |
| 221 | + return $grupos; | |
| 222 | + } | |
| 223 | + /* | |
| 224 | + Function: pegaListaDeTiposSubGrupos | |
| 225 | + | |
| 226 | + Retorna a lista de grupos de um menu | |
| 227 | + | |
| 228 | + Parametros: | |
| 229 | + | |
| 230 | + id_menu {string} | |
| 231 | + | |
| 232 | + Return: | |
| 233 | + | |
| 234 | + {array} | |
| 235 | + */ | |
| 236 | + function pegaListaDeTiposSubGrupos(){ | |
| 237 | + if($this->idioma == "pt"){ | |
| 238 | + $coluna = "nome_subgrupo"; | |
| 239 | + } | |
| 240 | + else{ | |
| 241 | + $coluna = $this->idioma; | |
| 242 | + } | |
| 243 | + $sql = "select CASE i3geoadmin_subgrupos.$coluna WHEN '' THEN nome_subgrupo ELSE i3geoadmin_subgrupos.$coluna END as nome_subgrupo, id_subgrupo from ".$this->esquemaadmin."i3geoadmin_subgrupos ORDER by nome_subgrupo "; | |
| 244 | + $subgrupos = $this->execSQL($sql); | |
| 245 | + return $subgrupos; | |
| 246 | + } | |
| 247 | + /* | |
| 248 | + Function: procuraTemas | |
| 249 | + | |
| 250 | + Localiza temas conforme uma palavra de busca | |
| 251 | + | |
| 252 | + Parametros: | |
| 253 | + | |
| 254 | + procurar {string} - palavra de busca | |
| 255 | + | |
| 256 | + perfil {string} - considera apenas esse perfil | |
| 257 | + | |
| 258 | + Return: | |
| 259 | + | |
| 260 | + {array} | |
| 261 | + */ | |
| 262 | + function procuraTemas ($procurar,$perfil) | |
| 263 | + { | |
| 264 | + if($procurar != "") | |
| 265 | + { | |
| 266 | + $procurar = $this->removeAcentos($procurar); | |
| 267 | + } | |
| 268 | + $menus = $this->pegaListaDeMenus($perfil); | |
| 269 | + $resultado = array(); | |
| 270 | + $subgrupo = array(); | |
| 271 | + $final = array(); | |
| 272 | + foreach($menus as $menu) | |
| 273 | + { | |
| 274 | + $grupos = $this->pegaGruposMenu($menu["idmenu"]); | |
| 275 | + foreach($grupos["grupos"] as $grupo) | |
| 276 | + { | |
| 277 | + $a = $grupo["n1_perfil"]; | |
| 278 | + $a = str_replace(" ",",",$a); | |
| 279 | + if($this->verificaOcorrencia($perfil,explode(",",$a))) | |
| 280 | + { | |
| 281 | + $sgrupos = $this->pegaSubgruposGrupo($menu["idmenu"],$grupo["id_n1"]); | |
| 282 | + $temasRaizGrupo = array(); | |
| 283 | + $temasR = $this->pegaTemasRaizGrupo($menu["idmenu"],$grupo["id_n1"]); | |
| 284 | + foreach($temasR as $tema) | |
| 285 | + { | |
| 286 | + $a = $tema["perfil"]; | |
| 287 | + $a = str_replace(" ",",",$a); | |
| 288 | + if($this->verificaOcorrencia($perfil,explode(",",$a))) | |
| 289 | + { | |
| 290 | + $t = $this->pegaTema($tema["id_tema"]); | |
| 291 | + $t = $t[0]; | |
| 292 | + $nome = $this->removeAcentos($tema["nome_tema"]); | |
| 293 | + $tags = $this->removeAcentos($tema["tags_tema"]); | |
| 294 | + $tags1 = $this->removeAcentos(mb_convert_encoding($tema["tags_tema"],"ISO-8859-1","UTF-8")); | |
| 295 | + $nome1 = $this->removeAcentos(mb_convert_encoding($tema["nome_tema"],"ISO-8859-1","UTF-8")); | |
| 296 | + $miniatura = "nao"; | |
| 297 | + if(file_exists($this->locaplic."/temas/miniaturas/".$t["codigo_tema"].".map.mini.png")) | |
| 298 | + { | |
| 299 | + $miniatura = "sim"; | |
| 300 | + } | |
| 301 | + $down = "sim"; | |
| 302 | + if (strtolower($t["download_tema"]) == "nao") | |
| 303 | + { | |
| 304 | + $down = "nao"; | |
| 305 | + } | |
| 306 | + $texto = array("codigo_tema"=>$t["codigo_tema"],"miniatura"=>$miniatura,"tid"=>$t["codigo_tema"],"nome"=>$this->converte($tema["nome_tema"]),"link"=>$t["link_tema"],"download"=>$down); | |
| 307 | + if($procurar == "") | |
| 308 | + { | |
| 309 | + $temasRaizGrupo[] = $texto; | |
| 310 | + } | |
| 311 | + else | |
| 312 | + { | |
| 313 | + if (stristr($nome,$procurar) || stristr($nome1,$procurar)) | |
| 314 | + { | |
| 315 | + $temasRaizGrupo[] = $texto; | |
| 316 | + } | |
| 317 | + else | |
| 318 | + { | |
| 319 | + if (stristr($tags,$procurar) || stristr($tags1,$procurar)) | |
| 320 | + { | |
| 321 | + $temasRaizGrupo[] = $texto; | |
| 322 | + } | |
| 323 | + } | |
| 324 | + } | |
| 325 | + } | |
| 326 | + } | |
| 327 | + foreach($sgrupos["subgrupos"] as $sgrupo) | |
| 328 | + { | |
| 329 | + $a = $sgrupo["n2_perfil"]; | |
| 330 | + $a = str_replace(" ",",",$a); | |
| 331 | + if($this->verificaOcorrencia($perfil,explode(",",$a))) | |
| 332 | + { | |
| 333 | + $temas = $this->pegaTemasSubGrupo($sgrupo["id_n2"]); | |
| 334 | + foreach ($temas as $tema) | |
| 335 | + { | |
| 336 | + $a = $tema["n3_perfil"]; | |
| 337 | + $a = str_replace(" ",",",$a); | |
| 338 | + if($this->verificaOcorrencia($perfil,explode(",",$a))) | |
| 339 | + { | |
| 340 | + $t = $this->pegaTema($tema["id_tema"]); | |
| 341 | + $t = $t[0]; | |
| 342 | + $nome = $this->removeAcentos($tema["nome_tema"]); | |
| 343 | + $tags = $this->removeAcentos($tema["tags_tema"]); | |
| 344 | + $tags1 = $this->removeAcentos(mb_convert_encoding($tema["tags_tema"],"ISO-8859-1","UTF-8")); | |
| 345 | + $nome1 = $this->removeAcentos(mb_convert_encoding($tema["nome_tema"],"ISO-8859-1","UTF-8")); | |
| 346 | + $miniatura = "nao"; | |
| 347 | + if(file_exists($this->locaplic."/temas/miniaturas/".$tema["codigo_tema"].".map.mini.png")) | |
| 348 | + { | |
| 349 | + $miniatura = "sim"; | |
| 350 | + } | |
| 351 | + $down = "sim"; | |
| 352 | + if (strtolower($t["download_tema"]) == "nao") | |
| 353 | + { | |
| 354 | + $down = "nao"; | |
| 355 | + } | |
| 356 | + $texto = array("codigo_tema"=>$tema["codigo_tema"],"miniatura"=>$miniatura,"tid"=>$tema["codigo_tema"],"nome"=>$this->converte($tema["nome_tema"]),"link"=>$t["link_tema"],"download"=>$down); | |
| 357 | + if($procurar == "") | |
| 358 | + { | |
| 359 | + $resultado[] = $texto; | |
| 360 | + } | |
| 361 | + else | |
| 362 | + { | |
| 363 | + if (stristr($nome,$procurar) || stristr($nome1,$procurar)) | |
| 364 | + { | |
| 365 | + $resultado[] = $texto; | |
| 366 | + } | |
| 367 | + else | |
| 368 | + { | |
| 369 | + if (stristr($tags,$procurar) || stristr($tags1,$procurar)) | |
| 370 | + { | |
| 371 | + $resultado[] = $texto; | |
| 372 | + } | |
| 373 | + } | |
| 374 | + } | |
| 375 | + } | |
| 376 | + } | |
| 377 | + } | |
| 378 | + if (count($resultado) > 0) | |
| 379 | + { | |
| 380 | + $subgrupo[] = array("subgrupo"=>$this->converte($sgrupo["nome_subgrupo"]),"temas"=>$resultado); | |
| 381 | + } | |
| 382 | + $resultado = array(); | |
| 383 | + } | |
| 384 | + } | |
| 385 | + if (count($subgrupo) > 0 || count($temasRaizGrupo) > 0) | |
| 386 | + { | |
| 387 | + $final[] = array("grupo"=>$this->converte($grupo["nome_grupo"]),"temas"=>$temasRaizGrupo,"subgrupos"=>$subgrupo); | |
| 388 | + } | |
| 389 | + $subgrupo = array(); | |
| 390 | + } | |
| 391 | + } | |
| 392 | + return $final; | |
| 393 | + } | |
| 394 | + /* | |
| 395 | + Function: procuraTemasEstrela | |
| 396 | + | |
| 397 | + Localiza temas que têm um determinado número (nível) de estrelas | |
| 398 | + | |
| 399 | + Parametros: | |
| 400 | + | |
| 401 | + nivel {numeric} - número de estrelas | |
| 402 | + | |
| 403 | + perfil {string} - considera apenas esse perfil | |
| 404 | + | |
| 405 | + Return: | |
| 406 | + | |
| 407 | + {array} | |
| 408 | + */ | |
| 409 | + function procuraTemasEstrela($nivel,$fatorestrela,$perfil) | |
| 410 | + { | |
| 411 | + $menus = $this->pegaListaDeMenus($perfil); | |
| 412 | + | |
| 413 | + $resultado = array(); | |
| 414 | + $subgrupo = array(); | |
| 415 | + $final = array(); | |
| 416 | + foreach($menus as $menu) | |
| 417 | + { | |
| 418 | + $grupos = $this->pegaGruposMenu($menu["idmenu"]); | |
| 419 | + foreach($grupos["grupos"] as $grupo) | |
| 420 | + { | |
| 421 | + $a = $grupo["n1_perfil"]; | |
| 422 | + $a = str_replace(" ",",",$a); | |
| 423 | + if($this->verificaOcorrencia($perfil,explode(",",$a))) | |
| 424 | + { | |
| 425 | + $sgrupos = $this->pegaSubgruposGrupo($menu["idmenu"],$grupo["id_n1"]); | |
| 426 | + $temasRaizGrupo = array(); | |
| 427 | + $temasR = $this->pegaTemasRaizGrupo($menu["idmenu"],$grupo["id_n1"]); | |
| 428 | + foreach($temasR as $tema) | |
| 429 | + { | |
| 430 | + $a = $tema["perfil"]; | |
| 431 | + $a = str_replace(" ",",",$a); | |
| 432 | + if($this->verificaOcorrencia($perfil,explode(",",$a))) | |
| 433 | + { | |
| 434 | + $t = $this->pegaTema($tema["id_tema"]); | |
| 435 | + $t = $t[0]; | |
| 436 | + $nome = $this->removeAcentos($tema["nome_tema"]); | |
| 437 | + $tags = $this->removeAcentos($tema["tags_tema"]); | |
| 438 | + $tags1 = $this->removeAcentos(mb_convert_encoding($tema["tags_tema"],"ISO-8859-1","UTF-8")); | |
| 439 | + $nome1 = $this->removeAcentos(mb_convert_encoding($tema["nome_tema"],"ISO-8859-1","UTF-8")); | |
| 440 | + $miniatura = "nao"; | |
| 441 | + if(file_exists($this->locaplic."/temas/miniaturas/".$t["codigo_tema"].".map.mini.png")) | |
| 442 | + { | |
| 443 | + $miniatura = "sim"; | |
| 444 | + } | |
| 445 | + $down = "sim"; | |
| 446 | + if (strtolower($t["download_tema"]) == "nao") | |
| 447 | + { | |
| 448 | + $down = "nao"; | |
| 449 | + } | |
| 450 | + $texto = array("codigo_tema"=>$t["codigo_tema"],"miniatura"=>$miniatura,"tid"=>$t["codigo_tema"],"nome"=>$this->converte($tema["nome_tema"]),"link"=>$t["link_tema"],"download"=>$down); | |
| 451 | + $n = intval($t["nacessos"] / $fatorestrela); | |
| 452 | + if($n >= 5){ | |
| 453 | + $n = 5; | |
| 454 | + } | |
| 455 | + | |
| 456 | + if ($n == $nivel) | |
| 457 | + { | |
| 458 | + $temasRaizGrupo[] = $texto; | |
| 459 | + } | |
| 460 | + } | |
| 461 | + } | |
| 462 | + foreach($sgrupos["subgrupos"] as $sgrupo) | |
| 463 | + { | |
| 464 | + $a = $sgrupo["n2_perfil"]; | |
| 465 | + $a = str_replace(" ",",",$a); | |
| 466 | + if($this->verificaOcorrencia($perfil,explode(",",$a))) | |
| 467 | + { | |
| 468 | + $temas = $this->pegaTemasSubGrupo($sgrupo["id_n2"]); | |
| 469 | + foreach ($temas as $tema) | |
| 470 | + { | |
| 471 | + $a = $tema["n3_perfil"]; | |
| 472 | + $a = str_replace(" ",",",$a); | |
| 473 | + if($this->verificaOcorrencia($perfil,explode(",",$a))) | |
| 474 | + { | |
| 475 | + $t = $this->pegaTema($tema["id_tema"]); | |
| 476 | + $t = $t[0]; | |
| 477 | + $nome = $this->removeAcentos($tema["nome_tema"]); | |
| 478 | + $tags = $this->removeAcentos($tema["tags_tema"]); | |
| 479 | + $tags1 = $this->removeAcentos(mb_convert_encoding($tema["tags_tema"],"ISO-8859-1","UTF-8")); | |
| 480 | + $nome1 = $this->removeAcentos(mb_convert_encoding($tema["nome_tema"],"ISO-8859-1","UTF-8")); | |
| 481 | + $miniatura = "nao"; | |
| 482 | + if(file_exists($this->locaplic."/temas/miniaturas/".$tema["codigo_tema"].".map.mini.png")) | |
| 483 | + { | |
| 484 | + $miniatura = "sim"; | |
| 485 | + } | |
| 486 | + $down = "sim"; | |
| 487 | + if (strtolower($t["download_tema"]) == "nao") | |
| 488 | + { | |
| 489 | + $down = "nao"; | |
| 490 | + } | |
| 491 | + $texto = array("codigo_tema"=>$tema["codigo_tema"],"miniatura"=>$miniatura,"tid"=>$tema["codigo_tema"],"nome"=>$this->converte($tema["nome_tema"]),"link"=>$t["link_tema"],"download"=>$down); | |
| 492 | + $n = abs($t["nacessos"] / $fatorestrela); | |
| 493 | + if($n >= 5){ | |
| 494 | + $n = 5; | |
| 495 | + } | |
| 496 | + if ($n == $nivel) | |
| 497 | + { | |
| 498 | + $resultado[] = $texto; | |
| 499 | + } | |
| 500 | + } | |
| 501 | + } | |
| 502 | + } | |
| 503 | + if (count($resultado) > 0) | |
| 504 | + { | |
| 505 | + $subgrupo[] = array("subgrupo"=>$this->converte($sgrupo["nome_subgrupo"]),"temas"=>$resultado); | |
| 506 | + } | |
| 507 | + $resultado = array(); | |
| 508 | + } | |
| 509 | + } | |
| 510 | + if (count($subgrupo) > 0 || count($temasRaizGrupo) > 0) | |
| 511 | + { | |
| 512 | + $final[] = array("grupo"=>$this->converte($grupo["nome_grupo"]),"temas"=>$temasRaizGrupo,"subgrupos"=>$subgrupo); | |
| 513 | + } | |
| 514 | + $subgrupo = array(); | |
| 515 | + } | |
| 516 | + } | |
| 517 | + return $final; | |
| 518 | + } | |
| 519 | + /* | |
| 520 | + Function: pegaGruposMenu | |
| 521 | + | |
| 522 | + Retorna a lista de grupos de um menu | |
| 523 | + | |
| 524 | + Parametros: | |
| 525 | + | |
| 526 | + id_menu {string} | |
| 527 | + | |
| 528 | + Return: | |
| 529 | + | |
| 530 | + {array} | |
| 531 | + */ | |
| 532 | + function pegaGruposMenu($id_menu,$ordenaNome="nao"){ | |
| 533 | + if($ordenaNome == "sim"){ | |
| 534 | + $ordem = "nome_grupo"; | |
| 535 | + } | |
| 536 | + else{ | |
| 537 | + $ordem = "ordem"; | |
| 538 | + } | |
| 539 | + $sqlgrupos = $this->sql_grupos."where ".$this->pubsql." id_menu='$id_menu' order by $ordem"; | |
| 540 | + $sqlraiz = $this->sql_temasraiz."where i3geoadmin_raiz.id_menu='$id_menu' and i3geoadmin_raiz.nivel = 0 order by ordem"; | |
| 541 | + $grupos = $this->execSQL($sqlgrupos); | |
| 542 | + $raiz = $this->execSQL($sqlraiz); | |
| 543 | + $raiz = $this->validaTemas($raiz,"codigo_tema"); | |
| 544 | + return array("raiz"=>$raiz,"grupos"=>$grupos); | |
| 545 | + } | |
| 546 | + /* | |
| 547 | + Function: pegaSubgruposGrupo | |
| 548 | + | |
| 549 | + Retorna a lista de subgrupos de um grupo | |
| 550 | + | |
| 551 | + Parametros: | |
| 552 | + | |
| 553 | + id_menu {string} | |
| 554 | + | |
| 555 | + id_n1 {string} - id do grupo | |
| 556 | + | |
| 557 | + Return: | |
| 558 | + | |
| 559 | + {array} | |
| 560 | + */ | |
| 561 | + function pegaSubgruposGrupo($id_menu,$id_n1,$ordenaNome="nao",$filtraOgc="nao",$filtraDown="nao") | |
| 562 | + { | |
| 563 | + if($ordenaNome == "sim"){ | |
| 564 | + $ordem = "nome_subgrupo"; | |
| 565 | + } | |
| 566 | + else{ | |
| 567 | + $ordem = "ordem"; | |
| 568 | + } | |
| 569 | + $f = ""; | |
| 570 | + if($filtraOgc == "sim" || $filtraDown == "sim"){ | |
| 571 | + $ff = array(); | |
| 572 | + if($filtraOgc == "sim"){ | |
| 573 | + $ff[] = " i3geoadmin_temas.ogc_tema = 'SIM' "; | |
| 574 | + } | |
| 575 | + if($filtraDown == "sim"){ | |
| 576 | + $ff[] = " i3geoadmin_temas.download_tema = 'SIM' "; | |
| 577 | + } | |
| 578 | + $f = implode(" AND ",$ff) . " AND "; | |
| 579 | + } | |
| 580 | + $subgrupos = $this->execSQL($this->sql_subgrupos."where ".$this->pubsql." i3geoadmin_n2.id_n1='$id_n1' order by $ordem"); | |
| 581 | + $raiz = $this->execSQL($this->sql_temasraiz."where $f i3geoadmin_raiz.nivel = 1 and i3geoadmin_raiz.id_nivel = $id_n1 order by ordem"); | |
| 582 | + $raiz = $this->validaTemas($raiz,"codigo_tema"); | |
| 583 | + return array("raiz"=>$raiz,"subgrupos"=>$subgrupos); | |
| 584 | + } | |
| 585 | + /* | |
| 586 | + Function: pegaTemasRaizMenu | |
| 587 | + | |
| 588 | + Retorna a lista de temas da raiz de um menu | |
| 589 | + | |
| 590 | + Parametros: | |
| 591 | + | |
| 592 | + id_menu {string} | |
| 593 | + | |
| 594 | + Return: | |
| 595 | + | |
| 596 | + {array} | |
| 597 | + */ | |
| 598 | + function pegaTemasRaizMenu($id_menu) | |
| 599 | + { | |
| 600 | + $raiz = $this->execSQL($this->sql_temasraiz."where i3geoadmin_raiz.id_menu='$id_menu' and i3geoadmin_raiz.nivel = 0 order by ordem"); | |
| 601 | + $raiz = $this->validaTemas($raiz,"codigo_tema"); | |
| 602 | + return $raiz; | |
| 603 | + } | |
| 604 | + /* | |
| 605 | + Function: pegaTemasRaizGrupo | |
| 606 | + | |
| 607 | + Retorna a lista de temas da raiz de um grupo | |
| 608 | + | |
| 609 | + Parametros: | |
| 610 | + | |
| 611 | + id_menu {string} | |
| 612 | + | |
| 613 | + id_n1 {string} - id do grupo | |
| 614 | + | |
| 615 | + Return: | |
| 616 | + | |
| 617 | + {array} | |
| 618 | + */ | |
| 619 | + function pegaTemasRaizGrupo($id_menu,$id_n1,$filtraOgc="nao",$filtraDown="nao") | |
| 620 | + { | |
| 621 | + $f = ""; | |
| 622 | + if($filtraOgc == "sim" || $filtraDown == "sim"){ | |
| 623 | + $ff = array(); | |
| 624 | + if($filtraOgc == "sim"){ | |
| 625 | + $ff[] = " i3geoadmin_temas.ogc_tema = 'SIM' "; | |
| 626 | + } | |
| 627 | + if($filtraDown == "sim"){ | |
| 628 | + $ff[] = " i3geoadmin_temas.download_tema = 'SIM' "; | |
| 629 | + } | |
| 630 | + $f = implode(" AND ",$ff) . " AND "; | |
| 631 | + } | |
| 632 | + if($id_n1 == ""){ | |
| 633 | + $raiz = $this->execSQL($this->sql_temasraiz."where $f i3geoadmin_raiz.nivel = 1 and i3geoadmin_raiz.id_nivel > 0 order by ordem"); | |
| 634 | + } | |
| 635 | + else { | |
| 636 | + $raiz = $this->execSQL($this->sql_temasraiz."where $f i3geoadmin_raiz.nivel = 1 and i3geoadmin_raiz.id_nivel = $id_n1 order by ordem"); | |
| 637 | + } | |
| 638 | + $raiz = $this->validaTemas($raiz,"codigo_tema"); | |
| 639 | + return $raiz; | |
| 640 | + } | |
| 641 | + /* | |
| 642 | + Function: pegaTodosTemas | |
| 643 | + | |
| 644 | + Retorna os dados de todos os temas | |
| 645 | + | |
| 646 | + Return: | |
| 647 | + | |
| 648 | + {array} | |
| 649 | + */ | |
| 650 | + function pegaTodosTemas($combo=false) | |
| 651 | + { | |
| 652 | + if($combo == true){ | |
| 653 | + $q = $this->execSQL($this->sql_temas_combo." ORDER BY nome_tema ASC"); | |
| 654 | + } | |
| 655 | + else{ | |
| 656 | + $q = $this->execSQL($this->sql_temas." ORDER BY nome_tema ASC"); | |
| 657 | + } | |
| 658 | + if($q){ | |
| 659 | + $q = $this->validaTemas($q,"codigo_tema"); | |
| 660 | + return $q; | |
| 661 | + } | |
| 662 | + } | |
| 663 | + /* | |
| 664 | + Function: pegaTema | |
| 665 | + | |
| 666 | + Retorna os dados de um tema | |
| 667 | + | |
| 668 | + Parametros: | |
| 669 | + | |
| 670 | + id_tema {string} | |
| 671 | + | |
| 672 | + Return: | |
| 673 | + | |
| 674 | + {array} | |
| 675 | + */ | |
| 676 | + function pegaTema($id_tema) | |
| 677 | + { | |
| 678 | + $q = $this->execSQL($this->sql_temas." and id_tema = '$id_tema' "); | |
| 679 | + if($q){ | |
| 680 | + return $q; | |
| 681 | + } | |
| 682 | + else{ | |
| 683 | + //caso de banco de dados antigo | |
| 684 | + $sql = "select kmz_tema,'0' as nacessos,id_tema,kml_tema,ogc_tema,download_tema,tags_tema,tipoa_tema,link_tema,desc_tema,nome_tema,codigo_tema from ".$this->esquemaadmin."i3geoadmin_temas "; | |
| 685 | + $q = $this->execSQL($sql." where id_tema = '$id_tema' "); | |
| 686 | + return $q; | |
| 687 | + } | |
| 688 | + } | |
| 689 | + /* | |
| 690 | + Function: pegaTemaPorCodigo | |
| 691 | + | |
| 692 | + Retorna os dados de um tema buscando por codigo | |
| 693 | + | |
| 694 | + Parametros: | |
| 695 | + | |
| 696 | + codigo_tema {string} | |
| 697 | + | |
| 698 | + Return: | |
| 699 | + | |
| 700 | + {array} | |
| 701 | + */ | |
| 702 | + function pegaTemaPorCodigo($codigo_tema) | |
| 703 | + { | |
| 704 | + $q = $this->execSQL($this->sql_temas." and codigo_tema = '$codigo_tema' "); | |
| 705 | + if($q){ | |
| 706 | + return $q; | |
| 707 | + } | |
| 708 | + else{ | |
| 709 | + //caso de banco de dados antigo | |
| 710 | + $sql = "select kmz_tema,'0' as nacessos,id_tema,kml_tema,ogc_tema,download_tema,tags_tema,tipoa_tema,link_tema,desc_tema,nome_tema,codigo_tema from ".$this->esquemaadmin."i3geoadmin_temas "; | |
| 711 | + $q = $this->execSQL($sql." where codigo_tema = '$codigo_tema' "); | |
| 712 | + return $q; | |
| 713 | + } | |
| 714 | + } | |
| 715 | + /* | |
| 716 | + Function: pegaTemasSubGrupo | |
| 717 | + | |
| 718 | + Retorna os temas de um subgrupo | |
| 719 | + | |
| 720 | + Parametros: | |
| 721 | + | |
| 722 | + id_n2 {string} - id do subgrupo | |
| 723 | + | |
| 724 | + Return: | |
| 725 | + | |
| 726 | + {array} | |
| 727 | + */ | |
| 728 | + function pegaTemasSubGrupo($id_n2,$filtraOgc="nao",$filtraDown="nao") | |
| 729 | + { | |
| 730 | + $f = ""; | |
| 731 | + if($filtraOgc == "sim" || $filtraDown == "sim"){ | |
| 732 | + $ff = array(); | |
| 733 | + if($filtraOgc == "sim"){ | |
| 734 | + $ff[] = " i3geoadmin_temas.ogc_tema = 'SIM' "; | |
| 735 | + } | |
| 736 | + if($filtraDown == "sim"){ | |
| 737 | + $ff[] = " i3geoadmin_temas.download_tema = 'SIM' "; | |
| 738 | + } | |
| 739 | + $f = implode(" AND ",$ff) . " AND "; | |
| 740 | + } | |
| 741 | + $temas = $this->execSQL($this->sql_temasSubgrupo."where $f ".$this->pubsql." i3geoadmin_n3.id_n2='$id_n2' order by ordem"); | |
| 742 | + $temas = $this->validaTemas($temas,"codigo_tema"); | |
| 743 | + return $temas; | |
| 744 | + } | |
| 745 | + /* | |
| 746 | + Function: formataMenus | |
| 747 | + | |
| 748 | + Retorna os menus e temas na raiz de um menu, formatados no padrão da árvore | |
| 749 | + | |
| 750 | + Return: | |
| 751 | + | |
| 752 | + {array} | |
| 753 | + */ | |
| 754 | + function formataMenus(){ | |
| 755 | + } | |
| 756 | + /* | |
| 757 | + Function: formataGruposMenu | |
| 758 | + | |
| 759 | + Retorna os grupos e temas na raiz de um menu, formatados no padrão da árvore | |
| 760 | + | |
| 761 | + Parametros: | |
| 762 | + | |
| 763 | + id_menu {string} | |
| 764 | + | |
| 765 | + perfil {string} | |
| 766 | + | |
| 767 | + listasgrupos {string} - sim|nao | |
| 768 | + | |
| 769 | + Return: | |
| 770 | + | |
| 771 | + {array} | |
| 772 | + */ | |
| 773 | + function formataGruposMenu ($id_menu,$perfil,$listasgrupos,$ordenaNome="nao",$filtraOgc="nao",$filtraDown="nao") | |
| 774 | + { | |
| 775 | + //error_reporting(0); | |
| 776 | + $dados = $this->pegaGruposMenu($id_menu,$ordenaNome); | |
| 777 | + $resultado = array(); | |
| 778 | + $temasraiz = array(); | |
| 779 | + foreach($dados["raiz"] as $temar){ | |
| 780 | + $temasraiz[] = $this->formataTema($temar["id_tema"]); | |
| 781 | + } | |
| 782 | + if(count($dados["grupos"]) == 0){ | |
| 783 | + $grupos[] = array(); | |
| 784 | + } | |
| 785 | + $raizgrupos = $this->pegaTemasRaizGrupo($id_menu,"",$filtraOgc,$filtraDown); | |
| 786 | + //var_dump($raizgrupos);exit; | |
| 787 | + foreach($dados["grupos"] as $grupo) { | |
| 788 | + $a = $grupo["n1_perfil"]; | |
| 789 | + $a = str_replace(" ",",",$a); | |
| 790 | + if($this->verificaOcorrencia($perfil,explode(",",$a)) == true) | |
| 791 | + { | |
| 792 | + $temas = array(); | |
| 793 | + //$raizgrupo = $this->pegaTemasRaizGrupo($id_menu,$grupo["id_n1"],$filtraOgc,$filtraDown); | |
| 794 | + $grupodown = "nao"; | |
| 795 | + $grupoogc = "nao"; | |
| 796 | + foreach($raizgrupos as $tema){ | |
| 797 | + if($tema["id_nivel"] == $grupo["id_n1"]){ | |
| 798 | + $temas[] = $this->formataTema($tema["id_tema"]); | |
| 799 | + } | |
| 800 | + } | |
| 801 | + if($temas > 0){ | |
| 802 | + $grupodown = "sim"; | |
| 803 | + $grupoogc = "sim"; | |
| 804 | + } | |
| 805 | + $subgrupos = array(); | |
| 806 | + if($listasgrupos=="sim"){ | |
| 807 | + $dadossubgrupos = $this->pegaSubgruposGrupo($id_menu,$grupo["id_n1"],$ordenaNome,$filtraOgc,$filtraDown); | |
| 808 | + foreach($dadossubgrupos["subgrupos"] as $sgrupo){ | |
| 809 | + $a = $sgrupo["n2_perfil"]; | |
| 810 | + $a = str_replace(" ",",",$a); | |
| 811 | + if($this->verificaOcorrencia($perfil,explode(",",$a))){ | |
| 812 | + //verifica se existem temas que podem receber download | |
| 813 | + $down = "nao"; | |
| 814 | + $ogc = "nao"; | |
| 815 | + $listaT = $this->pegaTemasSubGrupo($sgrupo["id_n2"],$filtraOgc,$filtraDown); | |
| 816 | + foreach($listaT as $tema){ | |
| 817 | + if(strtolower($tema["tipoa_tema"]) != "wms") | |
| 818 | + { | |
| 819 | + if (strtolower($tema["download_tema"]) != "nao") | |
| 820 | + { | |
| 821 | + $down = "sim";$grupodown = "sim"; | |
| 822 | + } | |
| 823 | + | |
| 824 | + if (strtolower($tema["ogc_tema"]) != "nao") | |
| 825 | + { | |
| 826 | + $ogc = "sim";$grupoogc = "sim"; | |
| 827 | + } | |
| 828 | + } | |
| 829 | + } | |
| 830 | + if(count($listaT) > 0){ | |
| 831 | + $subgrupos[] = array("id_n2"=>$sgrupo["id_n2"],"publicado"=>($sgrupo["publicado"]),"nome"=>$this->converte($sgrupo["nome_subgrupo"]),"download"=>$down,"ogc"=>$ogc); | |
| 832 | + } | |
| 833 | + } | |
| 834 | + } | |
| 835 | + } | |
| 836 | + //evita ocorrencias vazias quando for aplicado um filtro | |
| 837 | + if($filtraOgc == "sim" || $filtraDown == "sim"){ | |
| 838 | + if(count($subgrupos) > 0 || count($temas) > 0){ | |
| 839 | + $grupos[] = array("publicado"=>($grupo["publicado"]),"id_n1"=>($grupo["id_n1"]),"nome"=>$this->converte($grupo["nome_grupo"]),"ogc"=>$grupoogc,"download"=>$grupodown,"subgrupos"=>$subgrupos,"temasgrupo"=>$temas); | |
| 840 | + } | |
| 841 | + } | |
| 842 | + else{ | |
| 843 | + $grupos[] = array("publicado"=>($grupo["publicado"]),"id_n1"=>($grupo["id_n1"]),"nome"=>$this->converte($grupo["nome_grupo"]),"ogc"=>$grupoogc,"download"=>$grupodown,"subgrupos"=>$subgrupos,"temasgrupo"=>$temas); | |
| 844 | + } | |
| 845 | + } | |
| 846 | + } | |
| 847 | + $grupos[] = array("temasraiz"=>$temasraiz); | |
| 848 | + //pega os sistemas checando os perfis | |
| 849 | + $sistemas = array(); | |
| 850 | + $grupos[] = array("idmenu"=>$id_menu); | |
| 851 | + $grupos[] = array("sistemas"=>""); | |
| 852 | + return($grupos); | |
| 853 | + } | |
| 854 | + /* | |
| 855 | + Function: formataSubgruposGrupo | |
| 856 | + | |
| 857 | + Retorna os subgrupos e temas na raiz de um grupo, formatados no padrão da árvore | |
| 858 | + | |
| 859 | + Parametros: | |
| 860 | + | |
| 861 | + id_menu {string} | |
| 862 | + | |
| 863 | + id_n1 {string} - id do grupo | |
| 864 | + | |
| 865 | + perfil {string} | |
| 866 | + | |
| 867 | + Return: | |
| 868 | + | |
| 869 | + {array} | |
| 870 | + */ | |
| 871 | + function formataSubgruposGrupo ($id_menu,$id_n1,$perfil) | |
| 872 | + { | |
| 873 | + $dados = $this->pegaSubgruposGrupo($id_menu,$id_n1); | |
| 874 | + $resultado = array(); | |
| 875 | + $temasraiz = array(); | |
| 876 | + foreach($dados["raiz"] as $temar) | |
| 877 | + { | |
| 878 | + $temasraiz[] = $this->formataTema($temar["id_tema"]); | |
| 879 | + } | |
| 880 | + if(count($dados["subgrupos"]) == 0) | |
| 881 | + { | |
| 882 | + $sgrupos[] = array(); | |
| 883 | + } | |
| 884 | + $subgrupos = array(); | |
| 885 | + foreach($dados["subgrupos"] as $sgrupo) | |
| 886 | + { | |
| 887 | + $a = $sgrupo["n2_perfil"]; | |
| 888 | + $a = str_replace(" ",",",$a); | |
| 889 | + if ($this->verificaOcorrencia($perfil,explode(",",$a))) | |
| 890 | + { | |
| 891 | + $listaT = $this->pegaTemasSubGrupo($sgrupo["id_n2"]); | |
| 892 | + $down = "nao"; | |
| 893 | + $ogc = "nao"; | |
| 894 | + foreach($listaT as $tema) | |
| 895 | + { | |
| 896 | + if(strtolower($tema["tipoa_tema"]) != "wms") | |
| 897 | + { | |
| 898 | + if (strtolower($tema["download_tema"]) != "nao") | |
| 899 | + { | |
| 900 | + $down = "sim"; | |
| 901 | + } | |
| 902 | + if (strtolower($tema["ogc_tema"]) != "nao") | |
| 903 | + { | |
| 904 | + $ogc = "sim"; | |
| 905 | + } | |
| 906 | + } | |
| 907 | + } | |
| 908 | + if(count($listaT) > 0) | |
| 909 | + { | |
| 910 | + $subgrupos[] = array("publicado"=>($sgrupo["publicado"]),"id_n2"=>($sgrupo["id_n2"]),"nome"=>$this->converte($sgrupo["nome_subgrupo"]),"download"=>$down,"ogc"=>$ogc,"temas"=>$listaT); | |
| 911 | + } | |
| 912 | + } | |
| 913 | + } | |
| 914 | + return (array("subgrupo"=>$subgrupos,"temasgrupo"=>$temasraiz)); | |
| 915 | + } | |
| 916 | + /* | |
| 917 | + Function: formataTemasSubgrupo | |
| 918 | + | |
| 919 | + Retorna os temas de um subgrupo, formatados no padrão da árvore | |
| 920 | + | |
| 921 | + Parametros: | |
| 922 | + | |
| 923 | + id_n2 {string} - id do subgrupo | |
| 924 | + | |
| 925 | + perfil {string} | |
| 926 | + | |
| 927 | + Return: | |
| 928 | + | |
| 929 | + {array} | |
| 930 | + */ | |
| 931 | + function formataTemasSubgrupo($id_n2,$perfil) | |
| 932 | + { | |
| 933 | + $dados = $this->pegaTemasSubGrupo($id_n2); | |
| 934 | + $temas = array(); | |
| 935 | + foreach($dados as $tema) | |
| 936 | + { | |
| 937 | + $a = $tema["n3_perfil"]; | |
| 938 | + $a = str_replace(" ",",",$a); | |
| 939 | + if($this->verificaOcorrencia($perfil,explode(",",$a))) | |
| 940 | + { | |
| 941 | + $temas[] = $this->formataTema($tema["id_tema"],$tema["publicado"]); | |
| 942 | + } | |
| 943 | + } | |
| 944 | + return $temas; | |
| 945 | + } | |
| 946 | + /* | |
| 947 | + Function: formataTema | |
| 948 | + | |
| 949 | + Retorna os dados de um tema, formatados no padrão da árvore | |
| 950 | + | |
| 951 | + Parametros: | |
| 952 | + | |
| 953 | + id_tema {string} | |
| 954 | + | |
| 955 | + publicado {string} - SIM|NAO valor do índice "publicado" que será incluído no array de retorno | |
| 956 | + | |
| 957 | + Return: | |
| 958 | + | |
| 959 | + {array} | |
| 960 | + */ | |
| 961 | + function formataTema($id_tema,$publicado="SIM") | |
| 962 | + { | |
| 963 | + $recordset = $this->pegaTema($id_tema); | |
| 964 | + $recordset = $recordset[0]; | |
| 965 | + $down = "sim"; | |
| 966 | + $ogc = "sim"; | |
| 967 | + $link = " "; | |
| 968 | + $kmz = "nao"; | |
| 969 | + if (strtolower($recordset["download_tema"]) == "nao") | |
| 970 | + { | |
| 971 | + $down = "nao"; | |
| 972 | + } | |
| 973 | + if (strtolower($recordset["ogc_tema"]) == "nao") | |
| 974 | + { | |
| 975 | + $ogc = "nao"; | |
| 976 | + } | |
| 977 | + if(strtolower($recordset["tipoa_tema"]) == "wms") | |
| 978 | + { | |
| 979 | + $down = "nao"; | |
| 980 | + $ogc = "nao"; | |
| 981 | + } | |
| 982 | + if ($recordset["link_tema"] != "") | |
| 983 | + { | |
| 984 | + $link = $recordset["link_tema"]; | |
| 985 | + } | |
| 986 | + if (strtolower($recordset["kmz_tema"]) == "sim") | |
| 987 | + { | |
| 988 | + $kmz = "sim"; | |
| 989 | + } | |
| 990 | + //codigo_tema para fins de compatibilidade | |
| 991 | + return array("codigo_tema"=>($recordset["codigo_tema"]),"tipoa_tema"=>$recordset["tipoa_tema"],"publicado"=>$publicado,"nacessos"=>($recordset["nacessos"]),"tid"=>($recordset["codigo_tema"]),"nome"=>$this->converte($recordset["nome_tema"]),"link"=>$link,"download"=>$down,"ogc"=>$ogc,"kmz"=>$kmz); | |
| 992 | + } | |
| 993 | + /* | |
| 994 | + Function: execSQL | |
| 995 | + | |
| 996 | + Executa um SQL no banco de administração | |
| 997 | + | |
| 998 | + Parametros: | |
| 999 | + | |
| 1000 | + sql {string} | |
| 1001 | + | |
| 1002 | + Return: | |
| 1003 | + | |
| 1004 | + {array} | |
| 1005 | + */ | |
| 1006 | + function execSQL($sql) | |
| 1007 | + { | |
| 1008 | + //echo "<br>".$sql; | |
| 1009 | + //error_reporting(0); | |
| 1010 | + $sql = str_ireplace(array("update","delete","insert","--","drop",";"),"",$sql); | |
| 1011 | + $q = $this->dbh->query($sql,PDO::FETCH_ASSOC); | |
| 1012 | + if($q) | |
| 1013 | + { | |
| 1014 | + return $q->fetchAll(); | |
| 1015 | + } | |
| 1016 | + else | |
| 1017 | + {return false; | |
| 1018 | + } | |
| 1019 | + } | |
| 1020 | + /* | |
| 1021 | + Verifica se uma string ocorre em um array | |
| 1022 | + */ | |
| 1023 | + function verificaOcorrencia($procurar,$em) | |
| 1024 | + { | |
| 1025 | + if(count($em) == 1 && $em[0] == "") | |
| 1026 | + { | |
| 1027 | + $em = ""; | |
| 1028 | + } | |
| 1029 | + if($procurar == "" && $em == "") | |
| 1030 | + { | |
| 1031 | + return true; | |
| 1032 | + } | |
| 1033 | + if($em == "") | |
| 1034 | + { | |
| 1035 | + return true; | |
| 1036 | + } | |
| 1037 | + $resultado = false; | |
| 1038 | + if($procurar != "" && $em != "") | |
| 1039 | + { | |
| 1040 | + foreach($em as $e) | |
| 1041 | + { | |
| 1042 | + $e = trim($e); | |
| 1043 | + foreach($procurar as $p) | |
| 1044 | + { | |
| 1045 | + $p = trim($p); | |
| 1046 | + if($p == $e) | |
| 1047 | + { | |
| 1048 | + $resultado = true; | |
| 1049 | + } | |
| 1050 | + } | |
| 1051 | + } | |
| 1052 | + } | |
| 1053 | + return $resultado; | |
| 1054 | + } | |
| 1055 | + function seems_utf8($Str) { # by bmorel at ssi dot fr | |
| 1056 | + $length = strlen($Str); | |
| 1057 | + for ($i = 0; $i < $length; $i++) { | |
| 1058 | + if (ord($Str[$i]) < 0x80) continue; # 0bbbbbbb | |
| 1059 | + elseif ((ord($Str[$i]) & 0xE0) == 0xC0) $n = 1; # 110bbbbb | |
| 1060 | + elseif ((ord($Str[$i]) & 0xF0) == 0xE0) $n = 2; # 1110bbbb | |
| 1061 | + elseif ((ord($Str[$i]) & 0xF8) == 0xF0) $n = 3; # 11110bbb | |
| 1062 | + elseif ((ord($Str[$i]) & 0xFC) == 0xF8) $n = 4; # 111110bb | |
| 1063 | + elseif ((ord($Str[$i]) & 0xFE) == 0xFC) $n = 5; # 1111110b | |
| 1064 | + else return false; # Does not match any model | |
| 1065 | + for ($j = 0; $j < $n; $j++) { # n bytes matching 10bbbbbb follow ? | |
| 1066 | + if ((++$i == $length) || ((ord($Str[$i]) & 0xC0) != 0x80)) | |
| 1067 | + return false; | |
| 1068 | + } | |
| 1069 | + } | |
| 1070 | + return true; | |
| 1071 | + } | |
| 1072 | + /** | |
| 1073 | + * | |
| 1074 | + * TODO Verificar ao fechar versao - verificar a acentuacao das palavras nessa funcao | |
| 1075 | + */ | |
| 1076 | + function removeAcentos($s) | |
| 1077 | + { | |
| 1078 | + $s = ereg_replace("[áàâã]","a",$s); | |
| 1079 | + $s = ereg_replace("[ÁÀÂÃ]","A",$s); | |
| 1080 | + $s = ereg_replace("[éèê]","e",$s); | |
| 1081 | + $s = ereg_replace("[í]","i",$s); | |
| 1082 | + $s = ereg_replace("[Í]","I",$s); | |
| 1083 | + $s = ereg_replace("[ÉÈÊ]","E",$s); | |
| 1084 | + $s = ereg_replace("[óòôõ]","o",$s); | |
| 1085 | + $s = ereg_replace("[ÓÒÔÕ]","O",$s); | |
| 1086 | + $s = ereg_replace("[úùû]","u",$s); | |
| 1087 | + $s = ereg_replace("[ÚÙÛ]","U",$s); | |
| 1088 | + $s = str_replace("ç","c",$s); | |
| 1089 | + $s = str_replace("Ç","C",$s); | |
| 1090 | + //$str = htmlentities($s); | |
| 1091 | + $str = preg_replace("/(&)([a-z])([a-z]+;)/i", '$2', $s); | |
| 1092 | + $str = preg_replace("/[^A-Z0-9]/i", ' ', $str); | |
| 1093 | + $string = preg_replace("/\s+/i", ' ', $str); | |
| 1094 | + | |
| 1095 | + if (!preg_match('/[\x80-\xff]/', $string)){ | |
| 1096 | + return $string; | |
| 1097 | + } | |
| 1098 | + if ($this->seems_utf8($string)) { | |
| 1099 | + $chars = array( | |
| 1100 | + // Decompositions for Latin-1 Supplement | |
| 1101 | + chr(195).chr(128) => 'A', chr(195).chr(129) => 'A', | |
| 1102 | + chr(195).chr(130) => 'A', chr(195).chr(131) => 'A', | |
| 1103 | + chr(195).chr(132) => 'A', chr(195).chr(133) => 'A', | |
| 1104 | + chr(195).chr(135) => 'C', chr(195).chr(136) => 'E', | |
| 1105 | + chr(195).chr(137) => 'E', chr(195).chr(138) => 'E', | |
| 1106 | + chr(195).chr(139) => 'E', chr(195).chr(140) => 'I', | |
| 1107 | + chr(195).chr(141) => 'I', chr(195).chr(142) => 'I', | |
| 1108 | + chr(195).chr(143) => 'I', chr(195).chr(145) => 'N', | |
| 1109 | + chr(195).chr(146) => 'O', chr(195).chr(147) => 'O', | |
| 1110 | + chr(195).chr(148) => 'O', chr(195).chr(149) => 'O', | |
| 1111 | + chr(195).chr(150) => 'O', chr(195).chr(153) => 'U', | |
| 1112 | + chr(195).chr(154) => 'U', chr(195).chr(155) => 'U', | |
| 1113 | + chr(195).chr(156) => 'U', chr(195).chr(157) => 'Y', | |
| 1114 | + chr(195).chr(159) => 's', chr(195).chr(160) => 'a', | |
| 1115 | + chr(195).chr(161) => 'a', chr(195).chr(162) => 'a', | |
| 1116 | + chr(195).chr(163) => 'a', chr(195).chr(164) => 'a', | |
| 1117 | + chr(195).chr(165) => 'a', chr(195).chr(167) => 'c', | |
| 1118 | + chr(195).chr(168) => 'e', chr(195).chr(169) => 'e', | |
| 1119 | + chr(195).chr(170) => 'e', chr(195).chr(171) => 'e', | |
| 1120 | + chr(195).chr(172) => 'i', chr(195).chr(173) => 'i', | |
| 1121 | + chr(195).chr(174) => 'i', chr(195).chr(175) => 'i', | |
| 1122 | + chr(195).chr(177) => 'n', chr(195).chr(178) => 'o', | |
| 1123 | + chr(195).chr(179) => 'o', chr(195).chr(180) => 'o', | |
| 1124 | + chr(195).chr(181) => 'o', chr(195).chr(182) => 'o', | |
| 1125 | + chr(195).chr(182) => 'o', chr(195).chr(185) => 'u', | |
| 1126 | + chr(195).chr(186) => 'u', chr(195).chr(187) => 'u', | |
| 1127 | + chr(195).chr(188) => 'u', chr(195).chr(189) => 'y', | |
| 1128 | + chr(195).chr(191) => 'y', | |
| 1129 | + // Decompositions for Latin Extended-A | |
| 1130 | + chr(196).chr(128) => 'A', chr(196).chr(129) => 'a', | |
| 1131 | + chr(196).chr(130) => 'A', chr(196).chr(131) => 'a', | |
| 1132 | + chr(196).chr(132) => 'A', chr(196).chr(133) => 'a', | |
| 1133 | + chr(196).chr(134) => 'C', chr(196).chr(135) => 'c', | |
| 1134 | + chr(196).chr(136) => 'C', chr(196).chr(137) => 'c', | |
| 1135 | + chr(196).chr(138) => 'C', chr(196).chr(139) => 'c', | |
| 1136 | + chr(196).chr(140) => 'C', chr(196).chr(141) => 'c', | |
| 1137 | + chr(196).chr(142) => 'D', chr(196).chr(143) => 'd', | |
| 1138 | + chr(196).chr(144) => 'D', chr(196).chr(145) => 'd', | |
| 1139 | + chr(196).chr(146) => 'E', chr(196).chr(147) => 'e', | |
| 1140 | + chr(196).chr(148) => 'E', chr(196).chr(149) => 'e', | |
| 1141 | + chr(196).chr(150) => 'E', chr(196).chr(151) => 'e', | |
| 1142 | + chr(196).chr(152) => 'E', chr(196).chr(153) => 'e', | |
| 1143 | + chr(196).chr(154) => 'E', chr(196).chr(155) => 'e', | |
| 1144 | + chr(196).chr(156) => 'G', chr(196).chr(157) => 'g', | |
| 1145 | + chr(196).chr(158) => 'G', chr(196).chr(159) => 'g', | |
| 1146 | + chr(196).chr(160) => 'G', chr(196).chr(161) => 'g', | |
| 1147 | + chr(196).chr(162) => 'G', chr(196).chr(163) => 'g', | |
| 1148 | + chr(196).chr(164) => 'H', chr(196).chr(165) => 'h', | |
| 1149 | + chr(196).chr(166) => 'H', chr(196).chr(167) => 'h', | |
| 1150 | + chr(196).chr(168) => 'I', chr(196).chr(169) => 'i', | |
| 1151 | + chr(196).chr(170) => 'I', chr(196).chr(171) => 'i', | |
| 1152 | + chr(196).chr(172) => 'I', chr(196).chr(173) => 'i', | |
| 1153 | + chr(196).chr(174) => 'I', chr(196).chr(175) => 'i', | |
| 1154 | + chr(196).chr(176) => 'I', chr(196).chr(177) => 'i', | |
| 1155 | + chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij', | |
| 1156 | + chr(196).chr(180) => 'J', chr(196).chr(181) => 'j', | |
| 1157 | + chr(196).chr(182) => 'K', chr(196).chr(183) => 'k', | |
| 1158 | + chr(196).chr(184) => 'k', chr(196).chr(185) => 'L', | |
| 1159 | + chr(196).chr(186) => 'l', chr(196).chr(187) => 'L', | |
| 1160 | + chr(196).chr(188) => 'l', chr(196).chr(189) => 'L', | |
| 1161 | + chr(196).chr(190) => 'l', chr(196).chr(191) => 'L', | |
| 1162 | + chr(197).chr(128) => 'l', chr(197).chr(129) => 'L', | |
| 1163 | + chr(197).chr(130) => 'l', chr(197).chr(131) => 'N', | |
| 1164 | + chr(197).chr(132) => 'n', chr(197).chr(133) => 'N', | |
| 1165 | + chr(197).chr(134) => 'n', chr(197).chr(135) => 'N', | |
| 1166 | + chr(197).chr(136) => 'n', chr(197).chr(137) => 'N', | |
| 1167 | + chr(197).chr(138) => 'n', chr(197).chr(139) => 'N', | |
| 1168 | + chr(197).chr(140) => 'O', chr(197).chr(141) => 'o', | |
| 1169 | + chr(197).chr(142) => 'O', chr(197).chr(143) => 'o', | |
| 1170 | + chr(197).chr(144) => 'O', chr(197).chr(145) => 'o', | |
| 1171 | + chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe', | |
| 1172 | + chr(197).chr(148) => 'R',chr(197).chr(149) => 'r', | |
| 1173 | + chr(197).chr(150) => 'R',chr(197).chr(151) => 'r', | |
| 1174 | + chr(197).chr(152) => 'R',chr(197).chr(153) => 'r', | |
| 1175 | + chr(197).chr(154) => 'S',chr(197).chr(155) => 's', | |
| 1176 | + chr(197).chr(156) => 'S',chr(197).chr(157) => 's', | |
| 1177 | + chr(197).chr(158) => 'S',chr(197).chr(159) => 's', | |
| 1178 | + chr(197).chr(160) => 'S', chr(197).chr(161) => 's', | |
| 1179 | + chr(197).chr(162) => 'T', chr(197).chr(163) => 't', | |
| 1180 | + chr(197).chr(164) => 'T', chr(197).chr(165) => 't', | |
| 1181 | + chr(197).chr(166) => 'T', chr(197).chr(167) => 't', | |
| 1182 | + chr(197).chr(168) => 'U', chr(197).chr(169) => 'u', | |
| 1183 | + chr(197).chr(170) => 'U', chr(197).chr(171) => 'u', | |
| 1184 | + chr(197).chr(172) => 'U', chr(197).chr(173) => 'u', | |
| 1185 | + chr(197).chr(174) => 'U', chr(197).chr(175) => 'u', | |
| 1186 | + chr(197).chr(176) => 'U', chr(197).chr(177) => 'u', | |
| 1187 | + chr(197).chr(178) => 'U', chr(197).chr(179) => 'u', | |
| 1188 | + chr(197).chr(180) => 'W', chr(197).chr(181) => 'w', | |
| 1189 | + chr(197).chr(182) => 'Y', chr(197).chr(183) => 'y', | |
| 1190 | + chr(197).chr(184) => 'Y', chr(197).chr(185) => 'Z', | |
| 1191 | + chr(197).chr(186) => 'z', chr(197).chr(187) => 'Z', | |
| 1192 | + chr(197).chr(188) => 'z', chr(197).chr(189) => 'Z', | |
| 1193 | + chr(197).chr(190) => 'z', chr(197).chr(191) => 's', | |
| 1194 | + // Euro Sign | |
| 1195 | + chr(226).chr(130).chr(172) => 'E', | |
| 1196 | + // GBP (Pound) Sign | |
| 1197 | + chr(194).chr(163) => ''); | |
| 1198 | + $string = strtr($string, $chars); | |
| 1199 | + } else { | |
| 1200 | + // Assume ISO-8859-1 if not UTF-8 | |
| 1201 | + $chars['in'] = chr(128).chr(131).chr(138).chr(142).chr(154).chr(158) | |
| 1202 | + .chr(159).chr(162).chr(165).chr(181).chr(192).chr(193).chr(194) | |
| 1203 | + .chr(195).chr(196).chr(197).chr(199).chr(200).chr(201).chr(202) | |
| 1204 | + .chr(203).chr(204).chr(205).chr(206).chr(207).chr(209).chr(210) | |
| 1205 | + .chr(211).chr(212).chr(213).chr(214).chr(216).chr(217).chr(218) | |
| 1206 | + .chr(219).chr(220).chr(221).chr(224).chr(225).chr(226).chr(227) | |
| 1207 | + .chr(228).chr(229).chr(231).chr(232).chr(233).chr(234).chr(235) | |
| 1208 | + .chr(236).chr(237).chr(238).chr(239).chr(241).chr(242).chr(243) | |
| 1209 | + .chr(244).chr(245).chr(246).chr(248).chr(249).chr(250).chr(251) | |
| 1210 | + .chr(252).chr(253).chr(255); | |
| 1211 | + $chars['out'] = "EfSZszYcYuAAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiinoooooouuuuyy"; | |
| 1212 | + $string = strtr($string, $chars['in'], $chars['out']); | |
| 1213 | + $double_chars['in'] = array(chr(140), chr(156), chr(198), chr(208), chr(222), chr(223), chr(230), chr(240), chr(254)); | |
| 1214 | + $double_chars['out'] = array('OE', 'oe', 'AE', 'DH', 'TH', 'ss', 'ae', 'dh', 'th'); | |
| 1215 | + $string = str_replace($double_chars['in'], $double_chars['out'], $string); | |
| 1216 | + } | |
| 1217 | + return $string; | |
| 1218 | + } | |
| 1219 | + function converte($texto){ | |
| 1220 | + if($this->convUTF == true) | |
| 1221 | + $texto = mb_convert_encoding($texto,mb_detect_encoding($texto),"UTF-8"); | |
| 1222 | + else | |
| 1223 | + $texto = mb_convert_encoding($texto,mb_detect_encoding($texto),"ISO-8859-1"); | |
| 1224 | + return $texto; | |
| 1225 | + } | |
| 1226 | + function verificaPapelSessao($id_papel){ | |
| 1227 | + if(!empty($_COOKIE["i3geocodigologin"])){ | |
| 1228 | + session_write_close(); | |
| 1229 | + session_name("i3GeoLogin"); | |
| 1230 | + session_id($_COOKIE["i3geocodigologin"]); | |
| 1231 | + session_start(); | |
| 1232 | + //var_dump($_SESSION);exit; | |
| 1233 | + if($_SESSION["usuario"] != $_COOKIE["i3geousuariologin"]){ | |
| 1234 | + return false; | |
| 1235 | + } | |
| 1236 | + foreach($_SESSION["papeis"] as $p){ | |
| 1237 | + if($p == 1 || $p == $id_papel){ | |
| 1238 | + return true; | |
| 1239 | + } | |
| 1240 | + } | |
| 1241 | + } | |
| 1242 | + else{//caso nao exista, retorna um erro | |
| 1243 | + return false; | |
| 1244 | + } | |
| 1245 | + } | |
| 1246 | + function verificaOperacaoSessao($operacao){ | |
| 1247 | + if($_COOKIE["i3geocodigologin"] != ""){ | |
| 1248 | + session_write_close(); | |
| 1249 | + session_name("i3GeoLogin"); | |
| 1250 | + session_id($_COOKIE["i3geocodigologin"]); | |
| 1251 | + session_start(); | |
| 1252 | + $resultado = false; | |
| 1253 | + //verifica se e administrador | |
| 1254 | + foreach($_SESSION["papeis"] as $p){ | |
| 1255 | + if($p == 1){ | |
| 1256 | + return true; | |
| 1257 | + } | |
| 1258 | + } | |
| 1259 | + if(!empty($_SESSION["operacoes"][$operacao])){ | |
| 1260 | + $resultado = true; | |
| 1261 | + } | |
| 1262 | + return $resultado; | |
| 1263 | + } else { | |
| 1264 | + return false; | |
| 1265 | + } | |
| 1266 | + } | |
| 1267 | +} | |
| 1268 | +?> | |
| 0 | 1269 | \ No newline at end of file | ... | ... |
classesphp/classe_menutemas.php
| ... | ... | @@ -5,7 +5,7 @@ Title: classe_menutemas.php |
| 5 | 5 | Manipulação dos temas do arquivo menutemas.xml ou sistema de administração |
| 6 | 6 | |
| 7 | 7 | Quando o i3Geo está configurado para acessar o sistema de administração, os métodos desta classe |
| 8 | -passam a utilizar a classe i3geo/admin/php/classe_arvore.php | |
| 8 | +passam a utilizar a classe i3geo/classesphp/classe_arvore.php | |
| 9 | 9 | |
| 10 | 10 | Lista temas, grupos,etc. |
| 11 | 11 | |
| ... | ... | @@ -113,7 +113,7 @@ array |
| 113 | 113 | $locaplic = $this->locaplic; |
| 114 | 114 | if(!isset($this->locaplic)) |
| 115 | 115 | {return "locaplic nao foi definido";} |
| 116 | - include_once($this->locaplic."/admin/php/classe_arvore.php"); | |
| 116 | + include_once($this->locaplic."/classesphp/classe_arvore.php"); | |
| 117 | 117 | $arvore = new Arvore($this->locaplic,$this->idioma); |
| 118 | 118 | $resultado = $arvore->pegaListaDeMenus($this->perfil,$filtraOgc,$filtraDown); |
| 119 | 119 | $final = array(); |
| ... | ... | @@ -155,7 +155,7 @@ array |
| 155 | 155 | else |
| 156 | 156 | {$tipo = "gruposeraiz";} |
| 157 | 157 | $tempm = $this->pegaListaDeMenus($filtraOgc,$filtraDown); |
| 158 | - include_once(dirname(__FILE__)."/../admin/php/classe_arvore.php"); | |
| 158 | + include_once(dirname(__FILE__)."/../classesphp/classe_arvore.php"); | |
| 159 | 159 | $arvore = new Arvore($this->locaplic,$this->idioma,$this->filtro); |
| 160 | 160 | foreach($tempm as $menu) |
| 161 | 161 | { |
| ... | ... | @@ -192,7 +192,7 @@ array |
| 192 | 192 | { |
| 193 | 193 | if($menu["idmenu"] == $idmenu || $idmenu == "") |
| 194 | 194 | { |
| 195 | - include_once(dirname(__FILE__)."/../admin/php/classe_arvore.php"); | |
| 195 | + include_once(dirname(__FILE__)."/../classesphp/classe_arvore.php"); | |
| 196 | 196 | $arvore = new Arvore($this->locaplic,$this->idioma,$this->filtro); |
| 197 | 197 | $subGrupos = $arvore->formataSubgruposGrupo($idmenu,$codgrupo,$this->perfil); |
| 198 | 198 | unset($arvore); |
| ... | ... | @@ -219,7 +219,7 @@ array |
| 219 | 219 | */ |
| 220 | 220 | function pegaListaDeTemas($grupo,$subgrupo,$idmenu) |
| 221 | 221 | { |
| 222 | - include_once(dirname(__FILE__)."/../admin/php/classe_arvore.php"); | |
| 222 | + include_once(dirname(__FILE__)."/../classesphp/classe_arvore.php"); | |
| 223 | 223 | $arvore = new Arvore($this->locaplic,$this->idioma); |
| 224 | 224 | $temas = $arvore->formataTemasSubgrupo($subgrupo,$this->perfil); |
| 225 | 225 | unset($arvore); |
| ... | ... | @@ -384,7 +384,7 @@ $procurar - String que ser&aacute; procurada. |
| 384 | 384 | } |
| 385 | 385 | else |
| 386 | 386 | { |
| 387 | - include_once(dirname(__FILE__)."/../admin/php/classe_arvore.php"); | |
| 387 | + include_once(dirname(__FILE__)."/../classesphp/classe_arvore.php"); | |
| 388 | 388 | $arvore = new Arvore($this->locaplic,$this->idioma); |
| 389 | 389 | $temas = $arvore->procuraTemas($procurar,$this->perfil); |
| 390 | 390 | unset($arvore); |
| ... | ... | @@ -495,7 +495,7 @@ $procurar - String que ser&aacute; procurada. |
| 495 | 495 | */ |
| 496 | 496 | function procurartemas2($procurar) |
| 497 | 497 | { |
| 498 | - include_once(dirname(__FILE__)."/../admin/php/classe_arvore.php"); | |
| 498 | + include_once(dirname(__FILE__)."/../classesphp/classe_arvore.php"); | |
| 499 | 499 | $arvore = new Arvore($this->locaplic,$this->idioma); |
| 500 | 500 | $temas = $arvore->procuraTemas($procurar,$this->perfil); |
| 501 | 501 | unset($arvore); |
| ... | ... | @@ -514,7 +514,7 @@ $fatorestrela - valor para normalizar o total de acessos com o valor da estrela |
| 514 | 514 | */ |
| 515 | 515 | function procurartemasestrela($nivel,$fatorestrela) |
| 516 | 516 | { |
| 517 | - include_once(dirname(__FILE__)."/../admin/php/classe_arvore.php"); | |
| 517 | + include_once(dirname(__FILE__)."/../classesphp/classe_arvore.php"); | |
| 518 | 518 | $arvore = new Arvore($this->locaplic,$this->idioma); |
| 519 | 519 | $temas = $arvore->procuraTemasEstrela($nivel,$fatorestrela,$this->perfil); |
| 520 | 520 | unset($arvore); | ... | ... |
classesphp/mapa_controle.php
| ... | ... | @@ -1744,7 +1744,7 @@ switch (strtoupper($funcao)) { |
| 1744 | 1744 | * Pega a lista de todos os temas que nao possuem restricoes de acesso |
| 1745 | 1745 | */ |
| 1746 | 1746 | case "PEGATODOSTEMAS": |
| 1747 | - include ("../admin/php/classe_arvore.php"); | |
| 1747 | + include ("../classesphp/classe_arvore.php"); | |
| 1748 | 1748 | $idioma = $_pg["idioma"]; |
| 1749 | 1749 | |
| 1750 | 1750 | $arvore = new Arvore($locaplic, $idioma); | ... | ... |
fontetema.php
| ... | ... | @@ -39,7 +39,7 @@ fontetema.php?tema=bioma |
| 39 | 39 | |
| 40 | 40 | */ |
| 41 | 41 | include(dirname(__FILE__)."/ms_configura.php"); |
| 42 | -include(dirname(__FILE__)."/admin/php/classe_arvore.php"); | |
| 42 | +include(dirname(__FILE__)."/classesphp/classe_arvore.php"); | |
| 43 | 43 | |
| 44 | 44 | include_once (dirname(__FILE__)."/classesphp/sani_request.php"); |
| 45 | 45 | $_GET = array_merge($_GET,$_POST); | ... | ... |
interface/carto_ol.htm
| ... | ... | @@ -20,8 +20,6 @@ |
| 20 | 20 | <!-- <link rel="stylesheet" type="text/css" href="../pacotes/bootstrap-accessibility-plugin/plugins/js/bootstrap-accessibility.min.js"> --> |
| 21 | 21 | <link rel="stylesheet" type="text/css" href="../css/default.css"> |
| 22 | 22 | <style> |
| 23 | - | |
| 24 | - | |
| 25 | 23 | .ol-attribution.ol-uncollapsible { |
| 26 | 24 | height: 2.1em; |
| 27 | 25 | right: 24px; |
| ... | ... | @@ -150,14 +148,14 @@ |
| 150 | 148 | <!-- configuracao para todos os botoes |
| 151 | 149 | data-idconteudo - id do DIV que contem o conteudo da guia e que sera mostrado ao ser clicado |
| 152 | 150 | --> |
| 153 | - <div class="iconesGuiaMovel" data-traduzir="true" style="right:0px;border-radius:4px; padding:2px;cursor: pointer; position: absolute; top: 5px; width: auto; z-index: 5000; background-color: rgba(255,255,255,.4);"> | |
| 151 | + <div class="iconesGuiaMovel ol-control" data-traduzir="true"> | |
| 154 | 152 | <!-- ferramentas |
| 155 | 153 | data-idLista - id do DIV dentro de idconteudo que sera utilizado para mostrar as "pastas" que abrem o proximo nivel |
| 156 | 154 | data-idLinks - id do DIV dentro de idconteudo que sera utilizado para mostrar a lista de links que abre cada ferramenta |
| 157 | 155 | data-idMigalha - id do DIV que sera utilizado para mostrar o link de retorno ao nivel anterior |
| 158 | 156 | --> |
| 159 | 157 | <div data-idconteudo="guia8obj" data-idLinks="listaFerramentasLinks" data-idMigalha="migalhaFerramentas" data-idLista="listaFerramentas" onclick="i3GEO.guias.ativa('ferramentas',this)"> |
| 160 | - <button title="{{{iconeFerramentas}}}" class="btn btn-default iconeGuiaMovel" style="color:white;box-shadow: none;"> | |
| 158 | + <button title="{{{iconeFerramentas}}}" class="iconeGuiaMovel" style="color:white;box-shadow: none;"> | |
| 161 | 159 | <i class="material-icons">business_center</i> |
| 162 | 160 | </button> |
| 163 | 161 | </div> |
| ... | ... | @@ -169,7 +167,7 @@ |
| 169 | 167 | do metadata existente na camada. Deixe vazio para nao ativar a operacao. |
| 170 | 168 | --> |
| 171 | 169 | <div onclick="i3GEO.guias.ativa('temas',this)" data-verificaAbrangencia="" data-idconteudo="guia1obj" data-idListaFundo="listaFundo" data-idListaDeCamadas="listaTemas" style="margin-top: 3px;"> |
| 172 | - <button title="{{{iconeMapa}}}" class="btn btn-default iconeGuiaMovel" style="color:white;box-shadow: none;"> | |
| 170 | + <button title="{{{iconeMapa}}}" class="iconeGuiaMovel" style="color:white;box-shadow: none;"> | |
| 173 | 171 | <i class="material-icons"><i class="material-icons">visibility</i></i> |
| 174 | 172 | </button> |
| 175 | 173 | </div> |
| ... | ... | @@ -183,35 +181,35 @@ |
| 183 | 181 | i3GEO.catalogoMenus.IDSMENUS - (array) apenas os menus com idmenu que constem nessa lista serao mostrados. Por default e vazio. |
| 184 | 182 | --> |
| 185 | 183 | <div onclick="i3GEO.guias.ativa('adiciona',this)" data-idconteudo="guia2obj" data-idMigalha="catalogoMigalha" data-idNavegacao="catalogoNavegacao" data-idCatalogo="catalogoPrincipal" data-idMenus="catalogoMenus" style="margin-top: 3px;"> |
| 186 | - <button title="{{{iconeCatalogo}}}" class="btn btn-default iconeGuiaMovel" style="color:white;box-shadow: none;"> | |
| 184 | + <button title="{{{iconeCatalogo}}}" class="iconeGuiaMovel" style="color:white;box-shadow: none;"> | |
| 187 | 185 | <i class="material-icons">layers</i> |
| 188 | 186 | </button> |
| 189 | 187 | </div> |
| 190 | 188 | <!-- legenda --> |
| 191 | 189 | <div onclick="i3GEO.guias.ativa('legenda',this)" data-idconteudo="guia4obj" data-idLegenda="legendaHtml" style="margin-top: 3px;"> |
| 192 | - <button title="{{{iconeLegenda}}}" class="btn btn-default iconeGuiaMovel" style="color:white;box-shadow: none;"> | |
| 190 | + <button title="{{{iconeLegenda}}}" class="iconeGuiaMovel" style="color:white;box-shadow: none;"> | |
| 193 | 191 | <i class="material-icons">view_list</i> |
| 194 | 192 | </button> |
| 195 | 193 | </div> |
| 196 | 194 | <div class="hidden-xs hidden-sm" onclick="i3GEO.guias.ativa('dobraPagina',this)" style="margin-top: 3px;"> |
| 197 | - <button title="{{{trocaInterface}}}" class="btn btn-default iconeGuiaMovel" style="color:white;box-shadow: none;"> | |
| 195 | + <button title="{{{trocaInterface}}}" class="iconeGuiaMovel" style="color:white;box-shadow: none;"> | |
| 198 | 196 | <i class="material-icons">compare_arrows</i> |
| 199 | 197 | </button> |
| 200 | 198 | </div> |
| 201 | 199 | <!-- Busca --> |
| 202 | 200 | <div onclick="i3GEO.guias.ativa('buscaRapida',this)" data-idconteudo="guia7obj" style="margin-top: 3px;"> |
| 203 | - <button class="btn btn-default iconeGuiaMovel" style="color:white;box-shadow: none;"> | |
| 201 | + <button class="iconeGuiaMovel" style="color:white;box-shadow: none;"> | |
| 204 | 202 | <i class="material-icons">search</i> |
| 205 | 203 | </button> |
| 206 | 204 | </div> |
| 207 | 205 | <div onclick="i3GEO.guias.ativa('identificaBalao',this)" style="margin-top: 3px;" > |
| 208 | - <button title="{{{iconeBalao}}}" class="btn btn-default iconeGuiaMovel" style="color:white;box-shadow: none;"> | |
| 206 | + <button title="{{{iconeBalao}}}" class="iconeGuiaMovel" style="color:white;box-shadow: none;"> | |
| 209 | 207 | <i class="material-icons">location_on</i> |
| 210 | 208 | </button> |
| 211 | 209 | </div> |
| 212 | 210 | <!-- A opcao de identificacao esta integrada ao balao de informacoes, mas pode aparecer aqui tambem |
| 213 | 211 | <div class="hidden-xs hidden-sm" onclick="i3GEO.guias.ativa('identifica',this)" style="margin-top: 3px;"> |
| 214 | - <button title="{{{iconeIdentifica}}}" class="btn btn-default iconeGuiaMovel" style="box-shadow: none;"> | |
| 212 | + <button title="{{{iconeIdentifica}}}" class="iconeGuiaMovel" style="box-shadow: none;"> | |
| 215 | 213 | <img src="../imagens/gisicons/pointer-info.png" style="cursor: pointer; padding: 3px;"> |
| 216 | 214 | </button> |
| 217 | 215 | </div> |
| ... | ... | @@ -565,6 +563,7 @@ |
| 565 | 563 | //ativa o banner de inicializacao |
| 566 | 564 | i3GEO.janela.tempoMsg($i("i3GEOlogoMarcaTemplate").innerHTML,4000); |
| 567 | 565 | (function() { |
| 566 | + //parametros aplicados na criacao do arquivo mapfile | |
| 568 | 567 | var parametrosMapa = { |
| 569 | 568 | //arquivo mapfile que servira de base para a criacao do mapa. Por default, sao utilizados os arquivos existentes em i3geo/aplicmap (geral1windows, geral1,...) |
| 570 | 569 | //Essa variavel pode ser definida em ms_configura tambem. Se nao estiver definida em nenhum lugar, o i3Geo tentara descobrir o arquivo adequado a ser utilizado. Voce pode utilizar essa opcao para abrir um mapa com as camadas que voce quiser, mas para evitar redundâncias, prefira o uso de &temasa |
| ... | ... | @@ -644,7 +643,9 @@ |
| 644 | 643 | filters: [{ |
| 645 | 644 | layer: "", |
| 646 | 645 | expression: "" |
| 647 | - }] | |
| 646 | + }], | |
| 647 | + //id de um mapa salvo e que sera recuperado | |
| 648 | + restoreMapId : "" | |
| 648 | 649 | }; |
| 649 | 650 | var config = { |
| 650 | 651 | //id do elemento HTML onde o corpo do mapa sera renderizado |
| ... | ... | @@ -661,6 +662,11 @@ |
| 661 | 662 | //Endereco do servidor i3Geo. Utilizado para gerar as requisicoes AJAX |
| 662 | 663 | //Por default e definido como: i3GEO.util.protocolo() + "://" + window.location.host + "/i3geo" |
| 663 | 664 | i3GeoServer : "", |
| 665 | + //opacidade default para camadas que nao sejam do tipo linha ou ponto | |
| 666 | + //a opacidade sera aplicada ao objeto HTML e nao ao LAYER original | |
| 667 | + //se for vazio, sera utilizado o valor definido no LAYER original | |
| 668 | + //Nao se aplica na interface googlemaps | |
| 669 | + layerOpacity: "", | |
| 664 | 670 | //Funcao que sera executada apos a inicializacao do mapa |
| 665 | 671 | afterStart : function(){ |
| 666 | 672 | $('.iconeGuiaMovel').tooltip({animation: false, trigger: "manual", placement: "left"}); |
| ... | ... | @@ -761,8 +767,43 @@ |
| 761 | 767 | ] |
| 762 | 768 | }, |
| 763 | 769 | //opcoes para o objeto view, que e uma instancia de MapOptions |
| 770 | + //ver https://openlayers.org/en/latest/apidoc/ol.View.html | |
| 764 | 771 | ViewOptions : { |
| 765 | 772 | |
| 773 | + }, | |
| 774 | + //botoes que sao mostrados no editor vetorial | |
| 775 | + editorButtons : { | |
| 776 | + 'imprimir': false, | |
| 777 | + 'grid': false, | |
| 778 | + 'pan' : false, | |
| 779 | + 'zoombox' : false, | |
| 780 | + 'zoomtot' : false, | |
| 781 | + 'zoomin' : false, | |
| 782 | + 'zoomout' : false, | |
| 783 | + 'distancia' : false, | |
| 784 | + 'area' : false, | |
| 785 | + 'identifica' : false, | |
| 786 | + 'linha' : true, | |
| 787 | + 'ponto' : true, | |
| 788 | + 'poligono' : true, | |
| 789 | + 'texto' : true, | |
| 790 | + 'edita' : true, | |
| 791 | + 'listag' : true, | |
| 792 | + 'corta' : true, | |
| 793 | + 'apaga' : true, | |
| 794 | + 'procura' : false, | |
| 795 | + 'selecao' : true, | |
| 796 | + 'selecaotudo' : true, | |
| 797 | + 'salva' : true, | |
| 798 | + 'ajuda' : true, | |
| 799 | + 'propriedades' : true, | |
| 800 | + 'fecha' : true, | |
| 801 | + 'tools' : true, | |
| 802 | + 'undo' : false, | |
| 803 | + 'frente' : false, | |
| 804 | + 'legenda' : false, | |
| 805 | + 'rodadomouse' : true, | |
| 806 | + 'novaaba' : false | |
| 766 | 807 | } |
| 767 | 808 | }, |
| 768 | 809 | //configuracoes especificas para a interface GoogleMaps | ... | ... |
js/compactados/maparef_compacto.js
| 1 | -if(typeof(i3GEO)==='undefined'){var i3GEO={}}i3GEO.maparef={fatorZoomDinamico:-3,TOP:4,RIGHT:120,W:function(){var w=parseInt(i3GEO.parametros.w,10)/5;if(w<150){w=150}return parseInt(w,10)},H:function(){var h=parseInt(i3GEO.parametros.h,10)/5;if(i3GEO.maparef.W()<=150){return 150}else{return parseInt(h,10)}},inicia:function(){if(i3GEO.arvoreDeCamadas.listaLigadosDesligados()[0].length==0){i3GEO.janela.tempoMsg($trad("umaLigada"));return}var r,pos,novoel,ins,temp,moveX,moveY,escondeRef,janela;if($i("i3geo_winRef")){janela=YAHOO.i3GEO.janela.manager.find("i3geo_winRef");janela.show();janela.bringToTop();return}if(!$i("i3geo_winRef")){novoel=document.createElement("div");novoel.id="i3geo_winRef";novoel.style.display="none";novoel.style.borderColor="gray";ins="";ins+='<div class="hd" style="border:0px solid black;text-align:left;z-index:20;padding-left: 0px;padding-bottom: 3px;padding-top: 1px;">';ins+='<span id=maparefmaismenosZoom style=display:none > ';temp="javascript:if(i3GEO.maparef.fatorZoomDinamico == -1){i3GEO.maparef.fatorZoomDinamico = 1};i3GEO.maparef.fatorZoomDinamico = i3GEO.maparef.fatorZoomDinamico + 1 ;$i(\"refDinamico\").checked = true;i3GEO.maparef.atualiza();";ins+="<button onclick='"+temp+"' class='btn btn-xs' style='margin:2px;padding:2px;'><span class='material-icons'>add_circle_outline</span></button>";temp="javascript:if(i3GEO.maparef.fatorZoomDinamico == 1){i3GEO.maparef.fatorZoomDinamico = -1};i3GEO.maparef.fatorZoomDinamico = i3GEO.maparef.fatorZoomDinamico - 1 ;$i(\"refDinamico\").checked = true;i3GEO.maparef.atualiza();";ins+="<button onclick='"+temp+"' class='btn btn-xs' style='margin:2px;padding:2px;'><span class='material-icons'>remove_circle_outline</span></button>";ins+="<div style='width: 100px;display:inline-table' class='form-group label-fixed condensed'>";ins+="<div style='width: 100%;' class='input-group'>";ins+="<select class='form-control' style='background-color:#094672' id='refDinamico' onchange='javascript:i3GEO.parametros.celularef=\"\";i3GEO.maparef.atualiza()'>";ins+="<option value='mapa' >"+$trad("refMapaAtual")+"</option>";ins+="<option value='dinamico' >"+$trad("refMapaDinamico")+"</option>";ins+="</select>";ins+="</div></div></div>";ins+='<div class="bd" style="border:0px solid black;text-align:left;padding:3px;height: '+i3GEO.maparef.H()+'px;" id="mapaReferencia" onmouseover="this.onmousemove=function(exy){i3GEO.eventos.posicaoMouseMapa(exy)}" >';ins+='<img style="cursor:pointer;display:none"class="img-rounded" onload="javascript:this.style.display = \'block\'" id="imagemReferencia" src="" onclick="javascript:i3GEO.maparef.click()">';ins+='</div>';novoel.innerHTML=ins;$(novoel).css("opacity",1);document.body.appendChild(novoel)}if($i("i3geo_winRef").style.display!=="block"){$i("i3geo_winRef").style.display="block";janela=new YAHOO.widget.Panel("i3geo_winRef",{height:i3GEO.maparef.H()+47+"px",width:i3GEO.maparef.W()+6+"px",fixedcenter:false,constraintoviewport:false,underlay:"shadow",close:true,visible:true,draggable:true,modal:false,iframe:false,strings:{close:"<span class='material-icons'>cancel</span>"}});YAHOO.i3GEO.janela.manager.register(janela);janela.cfg.setProperty("effect",[{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.5}]);janela.render();janela.show();try{janela.header.style.height="40px"}catch(e){};r=$i("i3geo_winRef_c");if(r){r.style.position="absolute"}pos=i3GEO.util.pegaPosicaoObjeto($i(i3GEO.Interface.IDCORPO));$i("mapaReferencia").style.height=i3GEO.maparef.H()+"px";$i("i3geo_winRef").style.border="0px solid gray";moveX=pos[0]+i3GEO.parametros.w-i3GEO.maparef.W()+3-i3GEO.maparef.RIGHT;moveY=pos[1]+i3GEO.maparef.TOP;if(i3GEO.Interface.ATUAL==="googlemaps"){moveY+=30}janela.moveTo(moveX,moveY);escondeRef=function(){$i("imagemReferencia").src="";janela.destroy()};$(janela.close).click(escondeRef);if($i("localizarxygeoProjxg")){var temp=function(){i3GEO.coordenadas.atualizaGeo(objposicaocursor.dmsx,objposicaocursor.dmsy,"localizarxygeoProj")};$("#imagemReferencia").mousemove(temp)}}i3GEO.eventos.adicionaEventos("NAVEGAMAPA",["i3GEO.maparef.atualiza()"]);this.atualiza(true);$i("i3geo_winRef_h").className="hd2"},atualiza:function(forca){if(arguments.length===0){forca=false}var tiporef,temp;temp=$i("refDinamico")?tiporef=$i("refDinamico").value:tiporef="fixo";if($i("mapaReferencia")){temp=$i("maparefmaismenosZoom");if(tiporef==="dinamico"){i3GEO.php.referenciadinamica(i3GEO.maparef.processaImagem,i3GEO.maparef.fatorZoomDinamico,tiporef,i3GEO.maparef.W(),i3GEO.maparef.H());if(temp){temp.style.display="inline-table"}}if(tiporef==="mapa"){i3GEO.php.referenciadinamica(i3GEO.maparef.processaImagem,i3GEO.maparef.fatorZoomDinamico,tiporef,i3GEO.maparef.W(),i3GEO.maparef.H());if(temp){temp.style.display="inline-table"}}}else{i3GEO.eventos.removeEventos("NAVEGAMAPA",["i3GEO.maparef.atualiza()"])}},processaImagem:function(retorno){var m,box,temp,tiporef="fixo";if((retorno.data!=="erro")&&(retorno.data!==undefined)){eval(retorno.data);i3GEO.parametros.celularef=g_celularef;i3GEO.parametros.extentref=extentref;temp=$i("imagemReferencia");if(temp){m=new Image();m.src=refimagem;temp.src=m.src}temp=$i("refDinamico");if(temp){tiporef=temp.value}if(tiporef!=="fixo"){box=$i("boxref");if(box){box.style.display="none"}return}i3GEO.maparef.atualizaBox()}},atualizaBox:function(){var box=i3GEO.maparef.criaBox(),w;i3GEO.calculo.ext2rect("boxref",i3GEO.parametros.extentref,i3GEO.parametros.mapexten,i3GEO.parametros.celularef,$i("mapaReferencia"));w=parseInt(box.style.width,10);if(w>120){box.style.display="none";return}box.style.display="block";box.style.top=parseInt(box.style.top,10)+4+"px";box.style.left=parseInt(box.style.left,10)+4+"px";if(w<3){box.style.width="3px";box.style.height="3px"}},criaBox:function(){var box=$i("boxref");if(!box){novoel=document.createElement("div");novoel.id="boxref";novoel.style.zIndex=10;novoel.style.position='absolute';novoel.style.cursor="move";novoel.style.backgroundColor="RGB(120,220,220)";novoel.style.borderWidth="3px";if(navm){novoel.style.filter='alpha(opacity=40)'}else{novoel.style.opacity=0.4}$i("mapaReferencia").appendChild(novoel);novoel.onmouseup=function(){var rect,telaminx,telamaxx,telaminy,m,x,ext;rect=$i("boxref");telaminx=parseInt(rect.style.left,10);telamaxy=parseInt(rect.style.top,10);telamaxx=telaminx+parseInt(rect.style.width,10);telaminy=telamaxy+parseInt(rect.style.height,10);m=i3GEO.calculo.tela2dd(telaminx,telaminy,i3GEO.parametros.celularef,i3GEO.parametros.extentref,"imagemReferencia");x=i3GEO.calculo.tela2dd(telamaxx,telamaxy,i3GEO.parametros.celularef,i3GEO.parametros.extentref,"imagemReferencia");ext=m[0]+" "+m[1]+" "+x[0]+" "+x[1];i3GEO.navega.zoomExt(i3GEO.configura.locaplic,i3GEO.configura.sid,"",ext)};return novoel}else{return box}},click:function(){if(i3GEO.Interface.ATUAL==="openlayers"||i3GEO.Interface.ATUAL==="googlemaps"){i3GEO.Interface[i3GEO.Interface.ATUAL].pan2ponto(objposicaocursor.ddx,objposicaocursor.ddy)}}}; | |
| 2 | 1 | \ No newline at end of file |
| 2 | +if(typeof(i3GEO)==='undefined'){var i3GEO={}}i3GEO.maparef={fatorZoomDinamico:-3,TOP:4,RIGHT:120,W:function(){var w=parseInt(i3GEO.parametros.w,10)/5;if(w<150){w=150}return parseInt(w,10)},H:function(){var h=parseInt(i3GEO.parametros.h,10)/5;if(i3GEO.maparef.W()<=150){return 150}else{return parseInt(h,10)}},inicia:function(){if(i3GEO.arvoreDeCamadas.listaLigadosDesligados()[0].length==0){i3GEO.janela.tempoMsg($trad("umaLigada"));return}var r,pos,novoel,ins,temp,moveX,moveY,escondeRef,janela;if($i("i3geo_winRef")){janela=YAHOO.i3GEO.janela.manager.find("i3geo_winRef");janela.show();janela.bringToTop();return}if(!$i("i3geo_winRef")){novoel=document.createElement("div");novoel.id="i3geo_winRef";novoel.style.display="none";novoel.style.borderColor="gray";ins="";ins+='<div class="hd" style="border:0px solid black;text-align:left;z-index:20;padding-left: 0px;padding-bottom: 3px;padding-top: 1px;">';ins+='<span id=maparefmaismenosZoom style=display:none > ';temp="javascript:if(i3GEO.maparef.fatorZoomDinamico == -1){i3GEO.maparef.fatorZoomDinamico = 1};i3GEO.maparef.fatorZoomDinamico = i3GEO.maparef.fatorZoomDinamico + 1 ;$i(\"refDinamico\").checked = true;i3GEO.maparef.atualiza();";ins+="<button onclick='"+temp+"' class='btn btn-xs' style='margin:2px;padding:2px;'><span class='material-icons'>add_circle_outline</span></button>";temp="javascript:if(i3GEO.maparef.fatorZoomDinamico == 1){i3GEO.maparef.fatorZoomDinamico = -1};i3GEO.maparef.fatorZoomDinamico = i3GEO.maparef.fatorZoomDinamico - 1 ;$i(\"refDinamico\").checked = true;i3GEO.maparef.atualiza();";ins+="<button onclick='"+temp+"' class='btn btn-xs' style='margin:2px;padding:2px;'><span class='material-icons'>remove_circle_outline</span></button>";ins+="<div style='width: 100px;display:inline-table' class='form-group label-fixed condensed'>";ins+="<div style='width: 100%;' class='input-group'>";ins+="<select class='form-control' style='background-color:#094672' id='refDinamico' onchange='javascript:i3GEO.parametros.celularef=\"\";i3GEO.maparef.atualiza()'>";ins+="<option value='mapa' >"+$trad("refMapaAtual")+"</option>";ins+="<option value='dinamico' >"+$trad("refMapaDinamico")+"</option>";ins+="</select>";ins+="</div></div></div>";ins+='<div class="bd" style="border:0px solid black;text-align:left;padding:3px;height: '+i3GEO.maparef.H()+'px;" id="mapaReferencia" onmouseover="this.onmousemove=function(exy){i3GEO.eventos.posicaoMouseMapa(exy)}" >';ins+='<img style="cursor:pointer;display:none"class="img-rounded" onload="javascript:this.style.display = \'block\'" id="imagemReferencia" src="" onclick="javascript:i3GEO.maparef.click()">';ins+='</div>';novoel.innerHTML=ins;$(novoel).css("opacity",1);document.body.appendChild(novoel)}if($i("i3geo_winRef").style.display!=="block"){$i("i3geo_winRef").style.display="block";janela=new YAHOO.widget.Panel("i3geo_winRef",{height:i3GEO.maparef.H()+47+"px",width:i3GEO.maparef.W()+6+"px",fixedcenter:false,constraintoviewport:false,underlay:"shadow",close:true,visible:true,draggable:true,modal:false,iframe:false,strings:{close:"<span class='material-icons'>cancel</span>"}});YAHOO.i3GEO.janela.manager.register(janela);janela.cfg.setProperty("effect",[{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.5}]);janela.render();janela.show();try{janela.header.style.height="40px"}catch(e){};r=$i("i3geo_winRef_c");if(r){r.style.position="absolute"}pos=i3GEO.util.pegaPosicaoObjeto($i(i3GEO.Interface.IDCORPO));$i("mapaReferencia").style.height=i3GEO.maparef.H()+"px";$i("i3geo_winRef").style.border="0px solid gray";moveX=pos[0]+i3GEO.parametros.w-i3GEO.maparef.W()+3-i3GEO.maparef.RIGHT;moveY=pos[1]+i3GEO.maparef.TOP;if(i3GEO.Interface.ATUAL==="googlemaps"){moveY+=30}janela.moveTo(moveX,moveY);escondeRef=function(){$i("imagemReferencia").src="";janela.destroy()};$(janela.close).click(escondeRef);if($i("localizarxygeoProjxg")){var temp=function(){i3GEO.coordenadas.atualizaGeo(objposicaocursor.dmsx,objposicaocursor.dmsy,"localizarxygeoProj")};$("#imagemReferencia").mousemove(temp)}}i3GEO.eventos.adicionaEventos("NAVEGAMAPA",["i3GEO.maparef.atualiza()"]);i3GEO.maparef.atualiza(true);$i("i3geo_winRef_h").className="hd2"},atualiza:function(forca){if(arguments.length===0){forca=false}var tiporef,temp;temp=$i("refDinamico")?tiporef=$i("refDinamico").value:tiporef="fixo";if($i("mapaReferencia")){temp=$i("maparefmaismenosZoom");if(tiporef==="dinamico"){i3GEO.php.referenciadinamica(i3GEO.maparef.processaImagem,i3GEO.maparef.fatorZoomDinamico,tiporef,i3GEO.maparef.W(),i3GEO.maparef.H());if(temp){temp.style.display="inline-table"}}if(tiporef==="mapa"){i3GEO.php.referenciadinamica(i3GEO.maparef.processaImagem,i3GEO.maparef.fatorZoomDinamico,tiporef,i3GEO.maparef.W(),i3GEO.maparef.H());if(temp){temp.style.display="inline-table"}}}else{i3GEO.eventos.removeEventos("NAVEGAMAPA",["i3GEO.maparef.atualiza()"])}},processaImagem:function(retorno){var m,box,temp,tiporef="fixo";if((retorno.data!=="erro")&&(retorno.data!==undefined)){eval(retorno.data);i3GEO.parametros.celularef=g_celularef;i3GEO.parametros.extentref=extentref;temp=$i("imagemReferencia");if(temp){m=new Image();m.src=refimagem;temp.src=m.src}temp=$i("refDinamico");if(temp){tiporef=temp.value}if(tiporef!=="fixo"){box=$i("boxref");if(box){box.style.display="none"}}i3GEO.maparef.atualizaBox()}},atualizaBox:function(){var box=i3GEO.maparef.criaBox(),w;i3GEO.calculo.ext2rect("boxref",i3GEO.parametros.extentref,i3GEO.parametros.mapexten,i3GEO.parametros.celularef,$i("mapaReferencia"));w=parseInt(box.style.width,10);if(w>120){box.style.display="none";return}box.style.display="block";box.style.top=parseInt(box.style.top,10)+4+"px";box.style.left=parseInt(box.style.left,10)+4+"px";if(w<3){box.style.width="3px";box.style.height="3px"}},criaBox:function(){var box=$i("boxref");if(!box){novoel=document.createElement("div");novoel.id="boxref";novoel.style.zIndex=10;novoel.style.position='absolute';novoel.style.cursor="move";novoel.style.backgroundColor="RGB(120,220,220)";novoel.style.borderWidth="3px";if(navm){novoel.style.filter='alpha(opacity=40)'}else{novoel.style.opacity=0.4}$i("mapaReferencia").appendChild(novoel);novoel.onmouseup=function(){var rect,telaminx,telamaxx,telaminy,m,x,ext;rect=$i("boxref");telaminx=parseInt(rect.style.left,10);telamaxy=parseInt(rect.style.top,10);telamaxx=telaminx+parseInt(rect.style.width,10);telaminy=telamaxy+parseInt(rect.style.height,10);m=i3GEO.calculo.tela2dd(telaminx,telaminy,i3GEO.parametros.celularef,i3GEO.parametros.extentref,"imagemReferencia");x=i3GEO.calculo.tela2dd(telamaxx,telamaxy,i3GEO.parametros.celularef,i3GEO.parametros.extentref,"imagemReferencia");ext=m[0]+" "+m[1]+" "+x[0]+" "+x[1];i3GEO.navega.zoomExt(i3GEO.configura.locaplic,i3GEO.configura.sid,"",ext)};return novoel}else{return box}},click:function(){if(i3GEO.Interface.ATUAL==="openlayers"||i3GEO.Interface.ATUAL==="googlemaps"){i3GEO.Interface[i3GEO.Interface.ATUAL].pan2ponto(objposicaocursor.ddx,objposicaocursor.ddy)}}}; | |
| 3 | 3 | \ No newline at end of file | ... | ... |
js/i3geo_tudo_compacto7.js
| ... | ... | @@ -245,7 +245,7 @@ if(typeof(i3GEO)==='undefined'){var i3GEO={}}i3GEO.tema={TEMPORIZADORESID:{},ati |
| 245 | 245 | if(typeof(i3GEO)==='undefined'){var i3GEO={}}i3GEO.analise={pontos:{xpt:[],ypt:[]},dialogo:{markercluster:function(){i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.markercluster()","markercluster","markercluster","dependencias.php","i3GEOF.markercluster.iniciaJanelaFlutuante()")},heatmap:function(){i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.heatmap()","heatmap","heatmap","dependencias.php","i3GEOF.heatmap.iniciaJanelaFlutuante()")},saiku:function(){if(i3GEO.parametros.statusFerramentas&&i3GEO.parametros.statusFerramentas.saiku===false){i3GEO.janela.tempoMsg($trad("naoInstalado"));return}i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.saiku()","saiku","saiku")},saikuMapa:function(){if(i3GEO.parametros.statusFerramentas&&i3GEO.parametros.statusFerramentas.saiku===false){i3GEO.janela.tempoMsg($trad("naoInstalado"));return}i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.saiku()","saiku","saiku","index.js","i3GEOF.saiku.iniciaJanelaFlutuante2()")},graficoInterativo:function(){alert("depreciado. Use graficointerativo1")},graficoInterativo1:function(){i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.graficointerativo1()","graficointerativo1","graficointerativo1","dependencias.php","i3GEOF.graficointerativo1.iniciaJanelaFlutuante()")},linhaDoTempo:function(){i3GEO.janela.cria("650px","450px",i3GEO.configura.locaplic+"/ferramentas/linhadotempo/index.php","","","</div><a class='i3GeoTituloJanelaBs' target=_blank href='"+i3GEO.configura.locaplic+"/ajuda_usuario.php?idcategoria=3&idajuda=88' >Linha do tempo</a>","i3GEOF.linhaDoTempo",false,"hd","","","",true,i3GEO.configura.locaplic+"/imagens/oxygen/16x16/clock.png");i3GEO.analise.atualizaLinhaDoTempo=function(){var doc="",ifr="";try{ifr=$i("i3GEOF.linhaDoTempoi");if(navn){if(ifr){doc=ifr.contentDocument}}else{if(document.frames("i3GEOF.linhaDoTempoi")){doc=document.frames("i3GEOF.linhaDoTempoi").document}}doc.getElementById("tl")?window.parent["i3GEOF.linhaDoTempoi"].carregaDados():i3GEO.eventos.removeEventos("NAVEGAMAPA",["i3GEO.analise.atualizaLinhaDoTempo()"])}catch(e){i3GEO.eventos.removeEventos("NAVEGAMAPA",["i3GEO.analise.atualizaLinhaDoTempo()"])}};i3GEO.eventos.adicionaEventos("NAVEGAMAPA",["i3GEO.analise.atualizaLinhaDoTempo()"]);var ifr=$i("i3GEOF.linhaDoTempoi");if(ifr){ifr.style.width="100%"}},perfil:function(){i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.perfil()","perfil","perfil")},rota:function(){if(i3GEO.Interface.ATUAL!=="googlemaps"){alert("Operacao disponivel apenas na interface Google Maps");return}counterClick=1;var parametrosRota=function(overlay,latlng){var temp,janela;if(counterClick===1){counterClick++;alert("Clique o ponto de destino da rota");pontoRota1=latlng;return}if(counterClick===2){pontoRota2=latlng;counterClick=0;GEvent.removeListener(rotaEvento);janela=i3GEO.janela.cria("300px","300px","","center","","<div class='i3GeoTituloJanela'>"+$trad("x48")+"</div>");janela[2].style.overflow="auto";janela[2].style.height="300px";directions=new GDirections(i3GeoMap,janela[2]);temp=function(){$i("wdoca_corpo").innerHTML="Não foi possível criar a rota"};GEvent.addListener(directions,"error",temp);directions.load("from: "+pontoRota1.lat()+","+pontoRota1.lng()+" to: "+pontoRota2.lat()+","+pontoRota2.lng())}};rotaEvento=GEvent.addListener(i3GeoMap,"click",parametrosRota);i3GEO.janela.tempoMsg("Clique o ponto de origem da rota")},melhorcaminho:function(){if(i3GEO.parametros.statusFerramentas&&i3GEO.parametros.statusFerramentas.melhorcaminho===false){i3GEO.janela.tempoMsg($trad("naoInstalado"));return}i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.melhorcaminho()","melhorcaminho","melhorcaminho")},gradePontos:function(){i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.gradePontos()","gradepontos","gradeDePontos","dependencias.php","i3GEOF.gradeDePontos.iniciaJanelaFlutuante()")},gradePol:function(){i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.gradePol()","gradepol","gradeDePoligonos","dependencias.php","i3GEOF.gradeDePoligonos.iniciaJanelaFlutuante()")},gradeHex:function(){i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.gradeHex()","gradehex","gradeDeHex","dependencias.php","i3GEOF.gradeDeHex.iniciaJanelaFlutuante()")},analisaGeometrias:function(){i3GEO.util.dialogoFerramenta("i3GEO.tema.dialogo.tabela()","analisageometrias","analisaGeometrias","dependencias.php","i3GEOF.analisaGeometrias.iniciaJanelaFlutuante()")},pontosdistri:function(){i3GEO.parametros.r==="nao"?i3GEO.janela.tempoMsg($trad("x22")):i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.pontosdistri()","pontosdistri","pontosDistri","dependencias.php","i3GEOF.pontosDistri.iniciaJanelaFlutuante()")},pontoempoligono:function(){i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.pontoempoligono()","pontoempoligono","pontoEmPoligono","dependencias.php","i3GEOF.pontoEmPoligono.iniciaJanelaFlutuante()")},centromassa:function(){i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.centromassa()","centromassa","centromassa","dependencias.php","i3GEOF.centromassa.iniciaJanelaFlutuante()")},nptPol:function(){i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.nptpol()","nptpol","nptpol","dependencias.php","i3GEOF.nptpol.iniciaJanelaFlutuante()")},buffer:function(){i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.buffer()","buffer","buffer","dependencias.php","i3GEOF.buffer.iniciaJanelaFlutuante()")},distanciaptpt:function(){i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.distanciaptpt()","distanciaptpt","distanciaptpt","dependencias.php","i3GEOF.distanciaptpt.iniciaJanelaFlutuante()")},centroide:function(){i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.centroide()","centroide","centroide","dependencias.php","i3GEOF.centroide.iniciaJanelaFlutuante()")},dissolve:function(){i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.dissolve()","dissolve","dissolve","dependencias.php","i3GEOF.dissolve.iniciaJanelaFlutuante()")},agrupaElementos:function(){i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.agrupaElementos()","agrupaelementos","agrupaElementos","dependencias.php","i3GEOF.agrupaElementos.iniciaJanelaFlutuante()")},distancia:function(){i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.distancia()","distancia","distancia","dependencias.php","i3GEOF.distancia.iniciaJanelaFlutuante()")},area:function(){i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.area()","area","area","dependencias.php","i3GEOF.area.iniciaJanelaFlutuante()")},juntamedidasvariavel:function(tema){if(!tema){tema=i3GEO.temaAtivo}var temp=function(){i3GEOF.juntamedidasvariavel.iniciaJanelaFlutuante(tema)};i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.juntamedidasvariavel()","juntamedidasvariavel","juntamedidasvariavel","dependencias.php",temp)}}}; |
| 246 | 246 | // |
| 247 | 247 | //compactados/maparef_compacto.js |
| 248 | -if(typeof(i3GEO)==='undefined'){var i3GEO={}}i3GEO.maparef={fatorZoomDinamico:-3,TOP:4,RIGHT:120,W:function(){var w=parseInt(i3GEO.parametros.w,10)/5;if(w<150){w=150}return parseInt(w,10)},H:function(){var h=parseInt(i3GEO.parametros.h,10)/5;if(i3GEO.maparef.W()<=150){return 150}else{return parseInt(h,10)}},inicia:function(){if(i3GEO.arvoreDeCamadas.listaLigadosDesligados()[0].length==0){i3GEO.janela.tempoMsg($trad("umaLigada"));return}var r,pos,novoel,ins,temp,moveX,moveY,escondeRef,janela;if($i("i3geo_winRef")){janela=YAHOO.i3GEO.janela.manager.find("i3geo_winRef");janela.show();janela.bringToTop();return}if(!$i("i3geo_winRef")){novoel=document.createElement("div");novoel.id="i3geo_winRef";novoel.style.display="none";novoel.style.borderColor="gray";ins="";ins+='<div class="hd" style="border:0px solid black;text-align:left;z-index:20;padding-left: 0px;padding-bottom: 3px;padding-top: 1px;">';ins+='<span id=maparefmaismenosZoom style=display:none > ';temp="javascript:if(i3GEO.maparef.fatorZoomDinamico == -1){i3GEO.maparef.fatorZoomDinamico = 1};i3GEO.maparef.fatorZoomDinamico = i3GEO.maparef.fatorZoomDinamico + 1 ;$i(\"refDinamico\").checked = true;i3GEO.maparef.atualiza();";ins+="<button onclick='"+temp+"' class='btn btn-xs' style='margin:2px;padding:2px;'><span class='material-icons'>add_circle_outline</span></button>";temp="javascript:if(i3GEO.maparef.fatorZoomDinamico == 1){i3GEO.maparef.fatorZoomDinamico = -1};i3GEO.maparef.fatorZoomDinamico = i3GEO.maparef.fatorZoomDinamico - 1 ;$i(\"refDinamico\").checked = true;i3GEO.maparef.atualiza();";ins+="<button onclick='"+temp+"' class='btn btn-xs' style='margin:2px;padding:2px;'><span class='material-icons'>remove_circle_outline</span></button>";ins+="<div style='width: 100px;display:inline-table' class='form-group label-fixed condensed'>";ins+="<div style='width: 100%;' class='input-group'>";ins+="<select class='form-control' style='background-color:#094672' id='refDinamico' onchange='javascript:i3GEO.parametros.celularef=\"\";i3GEO.maparef.atualiza()'>";ins+="<option value='mapa' >"+$trad("refMapaAtual")+"</option>";ins+="<option value='dinamico' >"+$trad("refMapaDinamico")+"</option>";ins+="</select>";ins+="</div></div></div>";ins+='<div class="bd" style="border:0px solid black;text-align:left;padding:3px;height: '+i3GEO.maparef.H()+'px;" id="mapaReferencia" onmouseover="this.onmousemove=function(exy){i3GEO.eventos.posicaoMouseMapa(exy)}" >';ins+='<img style="cursor:pointer;display:none"class="img-rounded" onload="javascript:this.style.display = \'block\'" id="imagemReferencia" src="" onclick="javascript:i3GEO.maparef.click()">';ins+='</div>';novoel.innerHTML=ins;$(novoel).css("opacity",1);document.body.appendChild(novoel)}if($i("i3geo_winRef").style.display!=="block"){$i("i3geo_winRef").style.display="block";janela=new YAHOO.widget.Panel("i3geo_winRef",{height:i3GEO.maparef.H()+47+"px",width:i3GEO.maparef.W()+6+"px",fixedcenter:false,constraintoviewport:false,underlay:"shadow",close:true,visible:true,draggable:true,modal:false,iframe:false,strings:{close:"<span class='material-icons'>cancel</span>"}});YAHOO.i3GEO.janela.manager.register(janela);janela.cfg.setProperty("effect",[{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.5}]);janela.render();janela.show();try{janela.header.style.height="40px"}catch(e){};r=$i("i3geo_winRef_c");if(r){r.style.position="absolute"}pos=i3GEO.util.pegaPosicaoObjeto($i(i3GEO.Interface.IDCORPO));$i("mapaReferencia").style.height=i3GEO.maparef.H()+"px";$i("i3geo_winRef").style.border="0px solid gray";moveX=pos[0]+i3GEO.parametros.w-i3GEO.maparef.W()+3-i3GEO.maparef.RIGHT;moveY=pos[1]+i3GEO.maparef.TOP;if(i3GEO.Interface.ATUAL==="googlemaps"){moveY+=30}janela.moveTo(moveX,moveY);escondeRef=function(){$i("imagemReferencia").src="";janela.destroy()};$(janela.close).click(escondeRef);if($i("localizarxygeoProjxg")){var temp=function(){i3GEO.coordenadas.atualizaGeo(objposicaocursor.dmsx,objposicaocursor.dmsy,"localizarxygeoProj")};$("#imagemReferencia").mousemove(temp)}}i3GEO.eventos.adicionaEventos("NAVEGAMAPA",["i3GEO.maparef.atualiza()"]);this.atualiza(true);$i("i3geo_winRef_h").className="hd2"},atualiza:function(forca){if(arguments.length===0){forca=false}var tiporef,temp;temp=$i("refDinamico")?tiporef=$i("refDinamico").value:tiporef="fixo";if($i("mapaReferencia")){temp=$i("maparefmaismenosZoom");if(tiporef==="dinamico"){i3GEO.php.referenciadinamica(i3GEO.maparef.processaImagem,i3GEO.maparef.fatorZoomDinamico,tiporef,i3GEO.maparef.W(),i3GEO.maparef.H());if(temp){temp.style.display="inline-table"}}if(tiporef==="mapa"){i3GEO.php.referenciadinamica(i3GEO.maparef.processaImagem,i3GEO.maparef.fatorZoomDinamico,tiporef,i3GEO.maparef.W(),i3GEO.maparef.H());if(temp){temp.style.display="inline-table"}}}else{i3GEO.eventos.removeEventos("NAVEGAMAPA",["i3GEO.maparef.atualiza()"])}},processaImagem:function(retorno){var m,box,temp,tiporef="fixo";if((retorno.data!=="erro")&&(retorno.data!==undefined)){eval(retorno.data);i3GEO.parametros.celularef=g_celularef;i3GEO.parametros.extentref=extentref;temp=$i("imagemReferencia");if(temp){m=new Image();m.src=refimagem;temp.src=m.src}temp=$i("refDinamico");if(temp){tiporef=temp.value}if(tiporef!=="fixo"){box=$i("boxref");if(box){box.style.display="none"}return}i3GEO.maparef.atualizaBox()}},atualizaBox:function(){var box=i3GEO.maparef.criaBox(),w;i3GEO.calculo.ext2rect("boxref",i3GEO.parametros.extentref,i3GEO.parametros.mapexten,i3GEO.parametros.celularef,$i("mapaReferencia"));w=parseInt(box.style.width,10);if(w>120){box.style.display="none";return}box.style.display="block";box.style.top=parseInt(box.style.top,10)+4+"px";box.style.left=parseInt(box.style.left,10)+4+"px";if(w<3){box.style.width="3px";box.style.height="3px"}},criaBox:function(){var box=$i("boxref");if(!box){novoel=document.createElement("div");novoel.id="boxref";novoel.style.zIndex=10;novoel.style.position='absolute';novoel.style.cursor="move";novoel.style.backgroundColor="RGB(120,220,220)";novoel.style.borderWidth="3px";if(navm){novoel.style.filter='alpha(opacity=40)'}else{novoel.style.opacity=0.4}$i("mapaReferencia").appendChild(novoel);novoel.onmouseup=function(){var rect,telaminx,telamaxx,telaminy,m,x,ext;rect=$i("boxref");telaminx=parseInt(rect.style.left,10);telamaxy=parseInt(rect.style.top,10);telamaxx=telaminx+parseInt(rect.style.width,10);telaminy=telamaxy+parseInt(rect.style.height,10);m=i3GEO.calculo.tela2dd(telaminx,telaminy,i3GEO.parametros.celularef,i3GEO.parametros.extentref,"imagemReferencia");x=i3GEO.calculo.tela2dd(telamaxx,telamaxy,i3GEO.parametros.celularef,i3GEO.parametros.extentref,"imagemReferencia");ext=m[0]+" "+m[1]+" "+x[0]+" "+x[1];i3GEO.navega.zoomExt(i3GEO.configura.locaplic,i3GEO.configura.sid,"",ext)};return novoel}else{return box}},click:function(){if(i3GEO.Interface.ATUAL==="openlayers"||i3GEO.Interface.ATUAL==="googlemaps"){i3GEO.Interface[i3GEO.Interface.ATUAL].pan2ponto(objposicaocursor.ddx,objposicaocursor.ddy)}}}; | |
| 248 | +if(typeof(i3GEO)==='undefined'){var i3GEO={}}i3GEO.maparef={fatorZoomDinamico:-3,TOP:4,RIGHT:120,W:function(){var w=parseInt(i3GEO.parametros.w,10)/5;if(w<150){w=150}return parseInt(w,10)},H:function(){var h=parseInt(i3GEO.parametros.h,10)/5;if(i3GEO.maparef.W()<=150){return 150}else{return parseInt(h,10)}},inicia:function(){if(i3GEO.arvoreDeCamadas.listaLigadosDesligados()[0].length==0){i3GEO.janela.tempoMsg($trad("umaLigada"));return}var r,pos,novoel,ins,temp,moveX,moveY,escondeRef,janela;if($i("i3geo_winRef")){janela=YAHOO.i3GEO.janela.manager.find("i3geo_winRef");janela.show();janela.bringToTop();return}if(!$i("i3geo_winRef")){novoel=document.createElement("div");novoel.id="i3geo_winRef";novoel.style.display="none";novoel.style.borderColor="gray";ins="";ins+='<div class="hd" style="border:0px solid black;text-align:left;z-index:20;padding-left: 0px;padding-bottom: 3px;padding-top: 1px;">';ins+='<span id=maparefmaismenosZoom style=display:none > ';temp="javascript:if(i3GEO.maparef.fatorZoomDinamico == -1){i3GEO.maparef.fatorZoomDinamico = 1};i3GEO.maparef.fatorZoomDinamico = i3GEO.maparef.fatorZoomDinamico + 1 ;$i(\"refDinamico\").checked = true;i3GEO.maparef.atualiza();";ins+="<button onclick='"+temp+"' class='btn btn-xs' style='margin:2px;padding:2px;'><span class='material-icons'>add_circle_outline</span></button>";temp="javascript:if(i3GEO.maparef.fatorZoomDinamico == 1){i3GEO.maparef.fatorZoomDinamico = -1};i3GEO.maparef.fatorZoomDinamico = i3GEO.maparef.fatorZoomDinamico - 1 ;$i(\"refDinamico\").checked = true;i3GEO.maparef.atualiza();";ins+="<button onclick='"+temp+"' class='btn btn-xs' style='margin:2px;padding:2px;'><span class='material-icons'>remove_circle_outline</span></button>";ins+="<div style='width: 100px;display:inline-table' class='form-group label-fixed condensed'>";ins+="<div style='width: 100%;' class='input-group'>";ins+="<select class='form-control' style='background-color:#094672' id='refDinamico' onchange='javascript:i3GEO.parametros.celularef=\"\";i3GEO.maparef.atualiza()'>";ins+="<option value='mapa' >"+$trad("refMapaAtual")+"</option>";ins+="<option value='dinamico' >"+$trad("refMapaDinamico")+"</option>";ins+="</select>";ins+="</div></div></div>";ins+='<div class="bd" style="border:0px solid black;text-align:left;padding:3px;height: '+i3GEO.maparef.H()+'px;" id="mapaReferencia" onmouseover="this.onmousemove=function(exy){i3GEO.eventos.posicaoMouseMapa(exy)}" >';ins+='<img style="cursor:pointer;display:none"class="img-rounded" onload="javascript:this.style.display = \'block\'" id="imagemReferencia" src="" onclick="javascript:i3GEO.maparef.click()">';ins+='</div>';novoel.innerHTML=ins;$(novoel).css("opacity",1);document.body.appendChild(novoel)}if($i("i3geo_winRef").style.display!=="block"){$i("i3geo_winRef").style.display="block";janela=new YAHOO.widget.Panel("i3geo_winRef",{height:i3GEO.maparef.H()+47+"px",width:i3GEO.maparef.W()+6+"px",fixedcenter:false,constraintoviewport:false,underlay:"shadow",close:true,visible:true,draggable:true,modal:false,iframe:false,strings:{close:"<span class='material-icons'>cancel</span>"}});YAHOO.i3GEO.janela.manager.register(janela);janela.cfg.setProperty("effect",[{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.5}]);janela.render();janela.show();try{janela.header.style.height="40px"}catch(e){};r=$i("i3geo_winRef_c");if(r){r.style.position="absolute"}pos=i3GEO.util.pegaPosicaoObjeto($i(i3GEO.Interface.IDCORPO));$i("mapaReferencia").style.height=i3GEO.maparef.H()+"px";$i("i3geo_winRef").style.border="0px solid gray";moveX=pos[0]+i3GEO.parametros.w-i3GEO.maparef.W()+3-i3GEO.maparef.RIGHT;moveY=pos[1]+i3GEO.maparef.TOP;if(i3GEO.Interface.ATUAL==="googlemaps"){moveY+=30}janela.moveTo(moveX,moveY);escondeRef=function(){$i("imagemReferencia").src="";janela.destroy()};$(janela.close).click(escondeRef);if($i("localizarxygeoProjxg")){var temp=function(){i3GEO.coordenadas.atualizaGeo(objposicaocursor.dmsx,objposicaocursor.dmsy,"localizarxygeoProj")};$("#imagemReferencia").mousemove(temp)}}i3GEO.eventos.adicionaEventos("NAVEGAMAPA",["i3GEO.maparef.atualiza()"]);i3GEO.maparef.atualiza(true);$i("i3geo_winRef_h").className="hd2"},atualiza:function(forca){if(arguments.length===0){forca=false}var tiporef,temp;temp=$i("refDinamico")?tiporef=$i("refDinamico").value:tiporef="fixo";if($i("mapaReferencia")){temp=$i("maparefmaismenosZoom");if(tiporef==="dinamico"){i3GEO.php.referenciadinamica(i3GEO.maparef.processaImagem,i3GEO.maparef.fatorZoomDinamico,tiporef,i3GEO.maparef.W(),i3GEO.maparef.H());if(temp){temp.style.display="inline-table"}}if(tiporef==="mapa"){i3GEO.php.referenciadinamica(i3GEO.maparef.processaImagem,i3GEO.maparef.fatorZoomDinamico,tiporef,i3GEO.maparef.W(),i3GEO.maparef.H());if(temp){temp.style.display="inline-table"}}}else{i3GEO.eventos.removeEventos("NAVEGAMAPA",["i3GEO.maparef.atualiza()"])}},processaImagem:function(retorno){var m,box,temp,tiporef="fixo";if((retorno.data!=="erro")&&(retorno.data!==undefined)){eval(retorno.data);i3GEO.parametros.celularef=g_celularef;i3GEO.parametros.extentref=extentref;temp=$i("imagemReferencia");if(temp){m=new Image();m.src=refimagem;temp.src=m.src}temp=$i("refDinamico");if(temp){tiporef=temp.value}if(tiporef!=="fixo"){box=$i("boxref");if(box){box.style.display="none"}}i3GEO.maparef.atualizaBox()}},atualizaBox:function(){var box=i3GEO.maparef.criaBox(),w;i3GEO.calculo.ext2rect("boxref",i3GEO.parametros.extentref,i3GEO.parametros.mapexten,i3GEO.parametros.celularef,$i("mapaReferencia"));w=parseInt(box.style.width,10);if(w>120){box.style.display="none";return}box.style.display="block";box.style.top=parseInt(box.style.top,10)+4+"px";box.style.left=parseInt(box.style.left,10)+4+"px";if(w<3){box.style.width="3px";box.style.height="3px"}},criaBox:function(){var box=$i("boxref");if(!box){novoel=document.createElement("div");novoel.id="boxref";novoel.style.zIndex=10;novoel.style.position='absolute';novoel.style.cursor="move";novoel.style.backgroundColor="RGB(120,220,220)";novoel.style.borderWidth="3px";if(navm){novoel.style.filter='alpha(opacity=40)'}else{novoel.style.opacity=0.4}$i("mapaReferencia").appendChild(novoel);novoel.onmouseup=function(){var rect,telaminx,telamaxx,telaminy,m,x,ext;rect=$i("boxref");telaminx=parseInt(rect.style.left,10);telamaxy=parseInt(rect.style.top,10);telamaxx=telaminx+parseInt(rect.style.width,10);telaminy=telamaxy+parseInt(rect.style.height,10);m=i3GEO.calculo.tela2dd(telaminx,telaminy,i3GEO.parametros.celularef,i3GEO.parametros.extentref,"imagemReferencia");x=i3GEO.calculo.tela2dd(telamaxx,telamaxy,i3GEO.parametros.celularef,i3GEO.parametros.extentref,"imagemReferencia");ext=m[0]+" "+m[1]+" "+x[0]+" "+x[1];i3GEO.navega.zoomExt(i3GEO.configura.locaplic,i3GEO.configura.sid,"",ext)};return novoel}else{return box}},click:function(){if(i3GEO.Interface.ATUAL==="openlayers"||i3GEO.Interface.ATUAL==="googlemaps"){i3GEO.Interface[i3GEO.Interface.ATUAL].pan2ponto(objposicaocursor.ddx,objposicaocursor.ddy)}}}; | |
| 249 | 249 | // |
| 250 | 250 | //compactados/ajuda_compacto.js |
| 251 | 251 | if(typeof(i3GEO)==='undefined'){var i3GEO={}}i3GEO.ajuda={abreDoc:function(url){if(!url){url="/documentacao/index.html"}window.open(i3GEO.configura.locaplic+url)},redesSociais:function(){i3GEO.janela.cria("400px","400px",i3GEO.configura.locaplic+"/ferramentas/redessociais/index.php","","","<div class='i3GeoTituloJanela'>"+$trad("u5c")+"</div>",i3GEO.util.generateId("redes"))},ferramenta:function(idajuda){var url=i3GEO.configura.locaplic+"/ferramentas/ajuda_usuario.php?"+"&idajuda="+idajuda;$.get(url).done(function(data){var json=jQuery.parseJSON(data);var texto=json[i3GEO.idioma.ATUAL];var titulo=json["titulo"][i3GEO.idioma.ATUAL];i3GEO.janela.closeMsg(texto)}).fail(function(){return})}}; | ... | ... |
js/i3geo_tudo_compacto7.js.php
| ... | ... | @@ -245,7 +245,7 @@ if(typeof(i3GEO)==='undefined'){var i3GEO={}}i3GEO.tema={TEMPORIZADORESID:{},ati |
| 245 | 245 | if(typeof(i3GEO)==='undefined'){var i3GEO={}}i3GEO.analise={pontos:{xpt:[],ypt:[]},dialogo:{markercluster:function(){i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.markercluster()","markercluster","markercluster","dependencias.php","i3GEOF.markercluster.iniciaJanelaFlutuante()")},heatmap:function(){i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.heatmap()","heatmap","heatmap","dependencias.php","i3GEOF.heatmap.iniciaJanelaFlutuante()")},saiku:function(){if(i3GEO.parametros.statusFerramentas&&i3GEO.parametros.statusFerramentas.saiku===false){i3GEO.janela.tempoMsg($trad("naoInstalado"));return}i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.saiku()","saiku","saiku")},saikuMapa:function(){if(i3GEO.parametros.statusFerramentas&&i3GEO.parametros.statusFerramentas.saiku===false){i3GEO.janela.tempoMsg($trad("naoInstalado"));return}i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.saiku()","saiku","saiku","index.js","i3GEOF.saiku.iniciaJanelaFlutuante2()")},graficoInterativo:function(){alert("depreciado. Use graficointerativo1")},graficoInterativo1:function(){i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.graficointerativo1()","graficointerativo1","graficointerativo1","dependencias.php","i3GEOF.graficointerativo1.iniciaJanelaFlutuante()")},linhaDoTempo:function(){i3GEO.janela.cria("650px","450px",i3GEO.configura.locaplic+"/ferramentas/linhadotempo/index.php","","","</div><a class='i3GeoTituloJanelaBs' target=_blank href='"+i3GEO.configura.locaplic+"/ajuda_usuario.php?idcategoria=3&idajuda=88' >Linha do tempo</a>","i3GEOF.linhaDoTempo",false,"hd","","","",true,i3GEO.configura.locaplic+"/imagens/oxygen/16x16/clock.png");i3GEO.analise.atualizaLinhaDoTempo=function(){var doc="",ifr="";try{ifr=$i("i3GEOF.linhaDoTempoi");if(navn){if(ifr){doc=ifr.contentDocument}}else{if(document.frames("i3GEOF.linhaDoTempoi")){doc=document.frames("i3GEOF.linhaDoTempoi").document}}doc.getElementById("tl")?window.parent["i3GEOF.linhaDoTempoi"].carregaDados():i3GEO.eventos.removeEventos("NAVEGAMAPA",["i3GEO.analise.atualizaLinhaDoTempo()"])}catch(e){i3GEO.eventos.removeEventos("NAVEGAMAPA",["i3GEO.analise.atualizaLinhaDoTempo()"])}};i3GEO.eventos.adicionaEventos("NAVEGAMAPA",["i3GEO.analise.atualizaLinhaDoTempo()"]);var ifr=$i("i3GEOF.linhaDoTempoi");if(ifr){ifr.style.width="100%"}},perfil:function(){i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.perfil()","perfil","perfil")},rota:function(){if(i3GEO.Interface.ATUAL!=="googlemaps"){alert("Operacao disponivel apenas na interface Google Maps");return}counterClick=1;var parametrosRota=function(overlay,latlng){var temp,janela;if(counterClick===1){counterClick++;alert("Clique o ponto de destino da rota");pontoRota1=latlng;return}if(counterClick===2){pontoRota2=latlng;counterClick=0;GEvent.removeListener(rotaEvento);janela=i3GEO.janela.cria("300px","300px","","center","","<div class='i3GeoTituloJanela'>"+$trad("x48")+"</div>");janela[2].style.overflow="auto";janela[2].style.height="300px";directions=new GDirections(i3GeoMap,janela[2]);temp=function(){$i("wdoca_corpo").innerHTML="Não foi possível criar a rota"};GEvent.addListener(directions,"error",temp);directions.load("from: "+pontoRota1.lat()+","+pontoRota1.lng()+" to: "+pontoRota2.lat()+","+pontoRota2.lng())}};rotaEvento=GEvent.addListener(i3GeoMap,"click",parametrosRota);i3GEO.janela.tempoMsg("Clique o ponto de origem da rota")},melhorcaminho:function(){if(i3GEO.parametros.statusFerramentas&&i3GEO.parametros.statusFerramentas.melhorcaminho===false){i3GEO.janela.tempoMsg($trad("naoInstalado"));return}i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.melhorcaminho()","melhorcaminho","melhorcaminho")},gradePontos:function(){i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.gradePontos()","gradepontos","gradeDePontos","dependencias.php","i3GEOF.gradeDePontos.iniciaJanelaFlutuante()")},gradePol:function(){i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.gradePol()","gradepol","gradeDePoligonos","dependencias.php","i3GEOF.gradeDePoligonos.iniciaJanelaFlutuante()")},gradeHex:function(){i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.gradeHex()","gradehex","gradeDeHex","dependencias.php","i3GEOF.gradeDeHex.iniciaJanelaFlutuante()")},analisaGeometrias:function(){i3GEO.util.dialogoFerramenta("i3GEO.tema.dialogo.tabela()","analisageometrias","analisaGeometrias","dependencias.php","i3GEOF.analisaGeometrias.iniciaJanelaFlutuante()")},pontosdistri:function(){i3GEO.parametros.r==="nao"?i3GEO.janela.tempoMsg($trad("x22")):i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.pontosdistri()","pontosdistri","pontosDistri","dependencias.php","i3GEOF.pontosDistri.iniciaJanelaFlutuante()")},pontoempoligono:function(){i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.pontoempoligono()","pontoempoligono","pontoEmPoligono","dependencias.php","i3GEOF.pontoEmPoligono.iniciaJanelaFlutuante()")},centromassa:function(){i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.centromassa()","centromassa","centromassa","dependencias.php","i3GEOF.centromassa.iniciaJanelaFlutuante()")},nptPol:function(){i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.nptpol()","nptpol","nptpol","dependencias.php","i3GEOF.nptpol.iniciaJanelaFlutuante()")},buffer:function(){i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.buffer()","buffer","buffer","dependencias.php","i3GEOF.buffer.iniciaJanelaFlutuante()")},distanciaptpt:function(){i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.distanciaptpt()","distanciaptpt","distanciaptpt","dependencias.php","i3GEOF.distanciaptpt.iniciaJanelaFlutuante()")},centroide:function(){i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.centroide()","centroide","centroide","dependencias.php","i3GEOF.centroide.iniciaJanelaFlutuante()")},dissolve:function(){i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.dissolve()","dissolve","dissolve","dependencias.php","i3GEOF.dissolve.iniciaJanelaFlutuante()")},agrupaElementos:function(){i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.agrupaElementos()","agrupaelementos","agrupaElementos","dependencias.php","i3GEOF.agrupaElementos.iniciaJanelaFlutuante()")},distancia:function(){i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.distancia()","distancia","distancia","dependencias.php","i3GEOF.distancia.iniciaJanelaFlutuante()")},area:function(){i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.area()","area","area","dependencias.php","i3GEOF.area.iniciaJanelaFlutuante()")},juntamedidasvariavel:function(tema){if(!tema){tema=i3GEO.temaAtivo}var temp=function(){i3GEOF.juntamedidasvariavel.iniciaJanelaFlutuante(tema)};i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.juntamedidasvariavel()","juntamedidasvariavel","juntamedidasvariavel","dependencias.php",temp)}}}; |
| 246 | 246 | // |
| 247 | 247 | //compactados/maparef_compacto.js |
| 248 | -if(typeof(i3GEO)==='undefined'){var i3GEO={}}i3GEO.maparef={fatorZoomDinamico:-3,TOP:4,RIGHT:120,W:function(){var w=parseInt(i3GEO.parametros.w,10)/5;if(w<150){w=150}return parseInt(w,10)},H:function(){var h=parseInt(i3GEO.parametros.h,10)/5;if(i3GEO.maparef.W()<=150){return 150}else{return parseInt(h,10)}},inicia:function(){if(i3GEO.arvoreDeCamadas.listaLigadosDesligados()[0].length==0){i3GEO.janela.tempoMsg($trad("umaLigada"));return}var r,pos,novoel,ins,temp,moveX,moveY,escondeRef,janela;if($i("i3geo_winRef")){janela=YAHOO.i3GEO.janela.manager.find("i3geo_winRef");janela.show();janela.bringToTop();return}if(!$i("i3geo_winRef")){novoel=document.createElement("div");novoel.id="i3geo_winRef";novoel.style.display="none";novoel.style.borderColor="gray";ins="";ins+='<div class="hd" style="border:0px solid black;text-align:left;z-index:20;padding-left: 0px;padding-bottom: 3px;padding-top: 1px;">';ins+='<span id=maparefmaismenosZoom style=display:none > ';temp="javascript:if(i3GEO.maparef.fatorZoomDinamico == -1){i3GEO.maparef.fatorZoomDinamico = 1};i3GEO.maparef.fatorZoomDinamico = i3GEO.maparef.fatorZoomDinamico + 1 ;$i(\"refDinamico\").checked = true;i3GEO.maparef.atualiza();";ins+="<button onclick='"+temp+"' class='btn btn-xs' style='margin:2px;padding:2px;'><span class='material-icons'>add_circle_outline</span></button>";temp="javascript:if(i3GEO.maparef.fatorZoomDinamico == 1){i3GEO.maparef.fatorZoomDinamico = -1};i3GEO.maparef.fatorZoomDinamico = i3GEO.maparef.fatorZoomDinamico - 1 ;$i(\"refDinamico\").checked = true;i3GEO.maparef.atualiza();";ins+="<button onclick='"+temp+"' class='btn btn-xs' style='margin:2px;padding:2px;'><span class='material-icons'>remove_circle_outline</span></button>";ins+="<div style='width: 100px;display:inline-table' class='form-group label-fixed condensed'>";ins+="<div style='width: 100%;' class='input-group'>";ins+="<select class='form-control' style='background-color:#094672' id='refDinamico' onchange='javascript:i3GEO.parametros.celularef=\"\";i3GEO.maparef.atualiza()'>";ins+="<option value='mapa' >"+$trad("refMapaAtual")+"</option>";ins+="<option value='dinamico' >"+$trad("refMapaDinamico")+"</option>";ins+="</select>";ins+="</div></div></div>";ins+='<div class="bd" style="border:0px solid black;text-align:left;padding:3px;height: '+i3GEO.maparef.H()+'px;" id="mapaReferencia" onmouseover="this.onmousemove=function(exy){i3GEO.eventos.posicaoMouseMapa(exy)}" >';ins+='<img style="cursor:pointer;display:none"class="img-rounded" onload="javascript:this.style.display = \'block\'" id="imagemReferencia" src="" onclick="javascript:i3GEO.maparef.click()">';ins+='</div>';novoel.innerHTML=ins;$(novoel).css("opacity",1);document.body.appendChild(novoel)}if($i("i3geo_winRef").style.display!=="block"){$i("i3geo_winRef").style.display="block";janela=new YAHOO.widget.Panel("i3geo_winRef",{height:i3GEO.maparef.H()+47+"px",width:i3GEO.maparef.W()+6+"px",fixedcenter:false,constraintoviewport:false,underlay:"shadow",close:true,visible:true,draggable:true,modal:false,iframe:false,strings:{close:"<span class='material-icons'>cancel</span>"}});YAHOO.i3GEO.janela.manager.register(janela);janela.cfg.setProperty("effect",[{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.5}]);janela.render();janela.show();try{janela.header.style.height="40px"}catch(e){};r=$i("i3geo_winRef_c");if(r){r.style.position="absolute"}pos=i3GEO.util.pegaPosicaoObjeto($i(i3GEO.Interface.IDCORPO));$i("mapaReferencia").style.height=i3GEO.maparef.H()+"px";$i("i3geo_winRef").style.border="0px solid gray";moveX=pos[0]+i3GEO.parametros.w-i3GEO.maparef.W()+3-i3GEO.maparef.RIGHT;moveY=pos[1]+i3GEO.maparef.TOP;if(i3GEO.Interface.ATUAL==="googlemaps"){moveY+=30}janela.moveTo(moveX,moveY);escondeRef=function(){$i("imagemReferencia").src="";janela.destroy()};$(janela.close).click(escondeRef);if($i("localizarxygeoProjxg")){var temp=function(){i3GEO.coordenadas.atualizaGeo(objposicaocursor.dmsx,objposicaocursor.dmsy,"localizarxygeoProj")};$("#imagemReferencia").mousemove(temp)}}i3GEO.eventos.adicionaEventos("NAVEGAMAPA",["i3GEO.maparef.atualiza()"]);this.atualiza(true);$i("i3geo_winRef_h").className="hd2"},atualiza:function(forca){if(arguments.length===0){forca=false}var tiporef,temp;temp=$i("refDinamico")?tiporef=$i("refDinamico").value:tiporef="fixo";if($i("mapaReferencia")){temp=$i("maparefmaismenosZoom");if(tiporef==="dinamico"){i3GEO.php.referenciadinamica(i3GEO.maparef.processaImagem,i3GEO.maparef.fatorZoomDinamico,tiporef,i3GEO.maparef.W(),i3GEO.maparef.H());if(temp){temp.style.display="inline-table"}}if(tiporef==="mapa"){i3GEO.php.referenciadinamica(i3GEO.maparef.processaImagem,i3GEO.maparef.fatorZoomDinamico,tiporef,i3GEO.maparef.W(),i3GEO.maparef.H());if(temp){temp.style.display="inline-table"}}}else{i3GEO.eventos.removeEventos("NAVEGAMAPA",["i3GEO.maparef.atualiza()"])}},processaImagem:function(retorno){var m,box,temp,tiporef="fixo";if((retorno.data!=="erro")&&(retorno.data!==undefined)){eval(retorno.data);i3GEO.parametros.celularef=g_celularef;i3GEO.parametros.extentref=extentref;temp=$i("imagemReferencia");if(temp){m=new Image();m.src=refimagem;temp.src=m.src}temp=$i("refDinamico");if(temp){tiporef=temp.value}if(tiporef!=="fixo"){box=$i("boxref");if(box){box.style.display="none"}return}i3GEO.maparef.atualizaBox()}},atualizaBox:function(){var box=i3GEO.maparef.criaBox(),w;i3GEO.calculo.ext2rect("boxref",i3GEO.parametros.extentref,i3GEO.parametros.mapexten,i3GEO.parametros.celularef,$i("mapaReferencia"));w=parseInt(box.style.width,10);if(w>120){box.style.display="none";return}box.style.display="block";box.style.top=parseInt(box.style.top,10)+4+"px";box.style.left=parseInt(box.style.left,10)+4+"px";if(w<3){box.style.width="3px";box.style.height="3px"}},criaBox:function(){var box=$i("boxref");if(!box){novoel=document.createElement("div");novoel.id="boxref";novoel.style.zIndex=10;novoel.style.position='absolute';novoel.style.cursor="move";novoel.style.backgroundColor="RGB(120,220,220)";novoel.style.borderWidth="3px";if(navm){novoel.style.filter='alpha(opacity=40)'}else{novoel.style.opacity=0.4}$i("mapaReferencia").appendChild(novoel);novoel.onmouseup=function(){var rect,telaminx,telamaxx,telaminy,m,x,ext;rect=$i("boxref");telaminx=parseInt(rect.style.left,10);telamaxy=parseInt(rect.style.top,10);telamaxx=telaminx+parseInt(rect.style.width,10);telaminy=telamaxy+parseInt(rect.style.height,10);m=i3GEO.calculo.tela2dd(telaminx,telaminy,i3GEO.parametros.celularef,i3GEO.parametros.extentref,"imagemReferencia");x=i3GEO.calculo.tela2dd(telamaxx,telamaxy,i3GEO.parametros.celularef,i3GEO.parametros.extentref,"imagemReferencia");ext=m[0]+" "+m[1]+" "+x[0]+" "+x[1];i3GEO.navega.zoomExt(i3GEO.configura.locaplic,i3GEO.configura.sid,"",ext)};return novoel}else{return box}},click:function(){if(i3GEO.Interface.ATUAL==="openlayers"||i3GEO.Interface.ATUAL==="googlemaps"){i3GEO.Interface[i3GEO.Interface.ATUAL].pan2ponto(objposicaocursor.ddx,objposicaocursor.ddy)}}}; | |
| 248 | +if(typeof(i3GEO)==='undefined'){var i3GEO={}}i3GEO.maparef={fatorZoomDinamico:-3,TOP:4,RIGHT:120,W:function(){var w=parseInt(i3GEO.parametros.w,10)/5;if(w<150){w=150}return parseInt(w,10)},H:function(){var h=parseInt(i3GEO.parametros.h,10)/5;if(i3GEO.maparef.W()<=150){return 150}else{return parseInt(h,10)}},inicia:function(){if(i3GEO.arvoreDeCamadas.listaLigadosDesligados()[0].length==0){i3GEO.janela.tempoMsg($trad("umaLigada"));return}var r,pos,novoel,ins,temp,moveX,moveY,escondeRef,janela;if($i("i3geo_winRef")){janela=YAHOO.i3GEO.janela.manager.find("i3geo_winRef");janela.show();janela.bringToTop();return}if(!$i("i3geo_winRef")){novoel=document.createElement("div");novoel.id="i3geo_winRef";novoel.style.display="none";novoel.style.borderColor="gray";ins="";ins+='<div class="hd" style="border:0px solid black;text-align:left;z-index:20;padding-left: 0px;padding-bottom: 3px;padding-top: 1px;">';ins+='<span id=maparefmaismenosZoom style=display:none > ';temp="javascript:if(i3GEO.maparef.fatorZoomDinamico == -1){i3GEO.maparef.fatorZoomDinamico = 1};i3GEO.maparef.fatorZoomDinamico = i3GEO.maparef.fatorZoomDinamico + 1 ;$i(\"refDinamico\").checked = true;i3GEO.maparef.atualiza();";ins+="<button onclick='"+temp+"' class='btn btn-xs' style='margin:2px;padding:2px;'><span class='material-icons'>add_circle_outline</span></button>";temp="javascript:if(i3GEO.maparef.fatorZoomDinamico == 1){i3GEO.maparef.fatorZoomDinamico = -1};i3GEO.maparef.fatorZoomDinamico = i3GEO.maparef.fatorZoomDinamico - 1 ;$i(\"refDinamico\").checked = true;i3GEO.maparef.atualiza();";ins+="<button onclick='"+temp+"' class='btn btn-xs' style='margin:2px;padding:2px;'><span class='material-icons'>remove_circle_outline</span></button>";ins+="<div style='width: 100px;display:inline-table' class='form-group label-fixed condensed'>";ins+="<div style='width: 100%;' class='input-group'>";ins+="<select class='form-control' style='background-color:#094672' id='refDinamico' onchange='javascript:i3GEO.parametros.celularef=\"\";i3GEO.maparef.atualiza()'>";ins+="<option value='mapa' >"+$trad("refMapaAtual")+"</option>";ins+="<option value='dinamico' >"+$trad("refMapaDinamico")+"</option>";ins+="</select>";ins+="</div></div></div>";ins+='<div class="bd" style="border:0px solid black;text-align:left;padding:3px;height: '+i3GEO.maparef.H()+'px;" id="mapaReferencia" onmouseover="this.onmousemove=function(exy){i3GEO.eventos.posicaoMouseMapa(exy)}" >';ins+='<img style="cursor:pointer;display:none"class="img-rounded" onload="javascript:this.style.display = \'block\'" id="imagemReferencia" src="" onclick="javascript:i3GEO.maparef.click()">';ins+='</div>';novoel.innerHTML=ins;$(novoel).css("opacity",1);document.body.appendChild(novoel)}if($i("i3geo_winRef").style.display!=="block"){$i("i3geo_winRef").style.display="block";janela=new YAHOO.widget.Panel("i3geo_winRef",{height:i3GEO.maparef.H()+47+"px",width:i3GEO.maparef.W()+6+"px",fixedcenter:false,constraintoviewport:false,underlay:"shadow",close:true,visible:true,draggable:true,modal:false,iframe:false,strings:{close:"<span class='material-icons'>cancel</span>"}});YAHOO.i3GEO.janela.manager.register(janela);janela.cfg.setProperty("effect",[{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.5}]);janela.render();janela.show();try{janela.header.style.height="40px"}catch(e){};r=$i("i3geo_winRef_c");if(r){r.style.position="absolute"}pos=i3GEO.util.pegaPosicaoObjeto($i(i3GEO.Interface.IDCORPO));$i("mapaReferencia").style.height=i3GEO.maparef.H()+"px";$i("i3geo_winRef").style.border="0px solid gray";moveX=pos[0]+i3GEO.parametros.w-i3GEO.maparef.W()+3-i3GEO.maparef.RIGHT;moveY=pos[1]+i3GEO.maparef.TOP;if(i3GEO.Interface.ATUAL==="googlemaps"){moveY+=30}janela.moveTo(moveX,moveY);escondeRef=function(){$i("imagemReferencia").src="";janela.destroy()};$(janela.close).click(escondeRef);if($i("localizarxygeoProjxg")){var temp=function(){i3GEO.coordenadas.atualizaGeo(objposicaocursor.dmsx,objposicaocursor.dmsy,"localizarxygeoProj")};$("#imagemReferencia").mousemove(temp)}}i3GEO.eventos.adicionaEventos("NAVEGAMAPA",["i3GEO.maparef.atualiza()"]);i3GEO.maparef.atualiza(true);$i("i3geo_winRef_h").className="hd2"},atualiza:function(forca){if(arguments.length===0){forca=false}var tiporef,temp;temp=$i("refDinamico")?tiporef=$i("refDinamico").value:tiporef="fixo";if($i("mapaReferencia")){temp=$i("maparefmaismenosZoom");if(tiporef==="dinamico"){i3GEO.php.referenciadinamica(i3GEO.maparef.processaImagem,i3GEO.maparef.fatorZoomDinamico,tiporef,i3GEO.maparef.W(),i3GEO.maparef.H());if(temp){temp.style.display="inline-table"}}if(tiporef==="mapa"){i3GEO.php.referenciadinamica(i3GEO.maparef.processaImagem,i3GEO.maparef.fatorZoomDinamico,tiporef,i3GEO.maparef.W(),i3GEO.maparef.H());if(temp){temp.style.display="inline-table"}}}else{i3GEO.eventos.removeEventos("NAVEGAMAPA",["i3GEO.maparef.atualiza()"])}},processaImagem:function(retorno){var m,box,temp,tiporef="fixo";if((retorno.data!=="erro")&&(retorno.data!==undefined)){eval(retorno.data);i3GEO.parametros.celularef=g_celularef;i3GEO.parametros.extentref=extentref;temp=$i("imagemReferencia");if(temp){m=new Image();m.src=refimagem;temp.src=m.src}temp=$i("refDinamico");if(temp){tiporef=temp.value}if(tiporef!=="fixo"){box=$i("boxref");if(box){box.style.display="none"}}i3GEO.maparef.atualizaBox()}},atualizaBox:function(){var box=i3GEO.maparef.criaBox(),w;i3GEO.calculo.ext2rect("boxref",i3GEO.parametros.extentref,i3GEO.parametros.mapexten,i3GEO.parametros.celularef,$i("mapaReferencia"));w=parseInt(box.style.width,10);if(w>120){box.style.display="none";return}box.style.display="block";box.style.top=parseInt(box.style.top,10)+4+"px";box.style.left=parseInt(box.style.left,10)+4+"px";if(w<3){box.style.width="3px";box.style.height="3px"}},criaBox:function(){var box=$i("boxref");if(!box){novoel=document.createElement("div");novoel.id="boxref";novoel.style.zIndex=10;novoel.style.position='absolute';novoel.style.cursor="move";novoel.style.backgroundColor="RGB(120,220,220)";novoel.style.borderWidth="3px";if(navm){novoel.style.filter='alpha(opacity=40)'}else{novoel.style.opacity=0.4}$i("mapaReferencia").appendChild(novoel);novoel.onmouseup=function(){var rect,telaminx,telamaxx,telaminy,m,x,ext;rect=$i("boxref");telaminx=parseInt(rect.style.left,10);telamaxy=parseInt(rect.style.top,10);telamaxx=telaminx+parseInt(rect.style.width,10);telaminy=telamaxy+parseInt(rect.style.height,10);m=i3GEO.calculo.tela2dd(telaminx,telaminy,i3GEO.parametros.celularef,i3GEO.parametros.extentref,"imagemReferencia");x=i3GEO.calculo.tela2dd(telamaxx,telamaxy,i3GEO.parametros.celularef,i3GEO.parametros.extentref,"imagemReferencia");ext=m[0]+" "+m[1]+" "+x[0]+" "+x[1];i3GEO.navega.zoomExt(i3GEO.configura.locaplic,i3GEO.configura.sid,"",ext)};return novoel}else{return box}},click:function(){if(i3GEO.Interface.ATUAL==="openlayers"||i3GEO.Interface.ATUAL==="googlemaps"){i3GEO.Interface[i3GEO.Interface.ATUAL].pan2ponto(objposicaocursor.ddx,objposicaocursor.ddy)}}}; | |
| 249 | 249 | // |
| 250 | 250 | //compactados/ajuda_compacto.js |
| 251 | 251 | if(typeof(i3GEO)==='undefined'){var i3GEO={}}i3GEO.ajuda={abreDoc:function(url){if(!url){url="/documentacao/index.html"}window.open(i3GEO.configura.locaplic+url)},redesSociais:function(){i3GEO.janela.cria("400px","400px",i3GEO.configura.locaplic+"/ferramentas/redessociais/index.php","","","<div class='i3GeoTituloJanela'>"+$trad("u5c")+"</div>",i3GEO.util.generateId("redes"))},ferramenta:function(idajuda){var url=i3GEO.configura.locaplic+"/ferramentas/ajuda_usuario.php?"+"&idajuda="+idajuda;$.get(url).done(function(data){var json=jQuery.parseJSON(data);var texto=json[i3GEO.idioma.ATUAL];var titulo=json["titulo"][i3GEO.idioma.ATUAL];i3GEO.janela.closeMsg(texto)}).fail(function(){return})}}; | ... | ... |
js/maparef.js
| ... | ... | @@ -207,7 +207,7 @@ i3GEO.maparef = |
| 207 | 207 | } |
| 208 | 208 | } |
| 209 | 209 | i3GEO.eventos.adicionaEventos("NAVEGAMAPA",["i3GEO.maparef.atualiza()"]); |
| 210 | - this.atualiza(true); | |
| 210 | + i3GEO.maparef.atualiza(true); | |
| 211 | 211 | $i("i3geo_winRef_h").className = "hd2"; |
| 212 | 212 | }, |
| 213 | 213 | /** |
| ... | ... | @@ -287,6 +287,7 @@ i3GEO.maparef = |
| 287 | 287 | m.src = refimagem; |
| 288 | 288 | temp.src = m.src; |
| 289 | 289 | } |
| 290 | + | |
| 290 | 291 | temp = $i("refDinamico"); |
| 291 | 292 | if (temp) { |
| 292 | 293 | tiporef = temp.value; |
| ... | ... | @@ -296,7 +297,6 @@ i3GEO.maparef = |
| 296 | 297 | if (box) { |
| 297 | 298 | box.style.display = "none"; |
| 298 | 299 | } |
| 299 | - return; | |
| 300 | 300 | } |
| 301 | 301 | i3GEO.maparef.atualizaBox(); |
| 302 | 302 | } |
| ... | ... | @@ -308,6 +308,9 @@ i3GEO.maparef = |
| 308 | 308 | * |
| 309 | 309 | */ |
| 310 | 310 | atualizaBox : function() { |
| 311 | + if (typeof (console) !== 'undefined') | |
| 312 | + console.info("i3GEO.maparef.atualizaBox()"); | |
| 313 | + | |
| 311 | 314 | var box = i3GEO.maparef.criaBox(), w; |
| 312 | 315 | // |
| 313 | 316 | // aplica ao box um novo tamanho |
| ... | ... | @@ -317,7 +320,8 @@ i3GEO.maparef = |
| 317 | 320 | i3GEO.parametros.extentref, |
| 318 | 321 | i3GEO.parametros.mapexten, |
| 319 | 322 | i3GEO.parametros.celularef, |
| 320 | - $i("mapaReferencia")); | |
| 323 | + $i("mapaReferencia") | |
| 324 | + ); | |
| 321 | 325 | w = parseInt(box.style.width, 10); |
| 322 | 326 | if (w > 120) { |
| 323 | 327 | box.style.display = "none"; |
| ... | ... | @@ -332,6 +336,9 @@ i3GEO.maparef = |
| 332 | 336 | } |
| 333 | 337 | }, |
| 334 | 338 | criaBox : function() { |
| 339 | + if (typeof (console) !== 'undefined') | |
| 340 | + console.info("i3GEO.maparef.criaBox()"); | |
| 341 | + | |
| 335 | 342 | var box = $i("boxref"); |
| 336 | 343 | if (!box) { |
| 337 | 344 | novoel = document.createElement("div"); | ... | ... |
temas/_lbairros.map
| 1 | 1 | MAP |
| 2 | - FONTSET "/var/www/i3geo/symbols/fontes.txt" | |
| 3 | - SYMBOLSET "/var/www/i3geo/symbols/simbolosv6.sym" | |
| 2 | + FONTSET "/var/www/i3geo/symbols/fontes.txt" | |
| 3 | + SYMBOLSET "/var/www/i3geo/symbols/simbolosv6.sym" | |
| 4 | 4 | LAYER |
| 5 | 5 | CONNECTION "i3geosaude" |
| 6 | 6 | CONNECTIONTYPE POSTGIS |
| 7 | - DATA "the_geom from (select gid, st_setsrid(the_geom,4326) as the_geom,co_bairro,no_bairro,no_distr,no_municip from i3geo_metaestat.bairros/*FW*//*FW*/) as foo using unique co_bairro using srid=4326" | |
| 7 | + DATA "the_geom from (select gid, st_setsrid(the_geom,4326) as the_geom,co_bairro,no_bairro,no_distr,no_municip from i3geo_metaestat.bairros ) as foo using unique co_bairro using srid=4326" | |
| 8 | 8 | METADATA |
| 9 | 9 | "TIP" "no_bairro,id" |
| 10 | 10 | "cache" "sim" |
| 11 | - "olopacity" "" | |
| 12 | 11 | "CLASSE" "SIM" |
| 13 | 12 | "permitekmz" "SIM" |
| 14 | - "gmopacity" "" | |
| 15 | - "gmstatus" "" | |
| 16 | 13 | "ITENSDESC" "id,Código bairro,Nome,Distrito,Município" |
| 17 | 14 | "EDITAVEL" "NAO" |
| 18 | - "arquivotemaoriginal" "" | |
| 19 | - "olstatus" "" | |
| 20 | - "nomeoriginal" "" | |
| 21 | 15 | "wkttip" "SIM" |
| 22 | 16 | "permitedownload" "SIM" |
| 23 | - "FILTROORIGINAL" "" | |
| 24 | 17 | "permitecomentario" "NAO" |
| 25 | - "DATAORIGINAL" "" | |
| 26 | 18 | "escondido" "NAO" |
| 27 | 19 | "download" "SIM" |
| 28 | 20 | "ITENS" "gid,co_bairro,no_bairro,no_distr,no_municip" |
| ... | ... | @@ -49,6 +41,4 @@ MAP |
| 49 | 41 | TITLE "" |
| 50 | 42 | END # CLASS |
| 51 | 43 | END # LAYER |
| 52 | - | |
| 53 | 44 | END # MAP |
| 54 | - | ... | ... |