Commit 6f5adab922f84d52502118e0fa94e56221322a8f

Authored by Edmar Moretti
1 parent 798714c4

Inclusão da visualização da miniatura e do título de um tema no editor de mapfiles

admin/html/editormapfile.html
@@ -44,10 +44,9 @@ @@ -44,10 +44,9 @@
44 </div> 44 </div>
45 <input onclick="adicionaLinha()" type=button id=adiciona value="Criar um novo mapfile" /> 45 <input onclick="adicionaLinha()" type=button id=adiciona value="Criar um novo mapfile" />
46 <br><br> 46 <br><br>
47 -Além de criar os mapfiles, é necessário definir as características de cada LAYER nas opções abaixo.<br> 47 +Além de criar os mapfiles, é necessário definir as características de cada LAYER nas opções abaixo.
48 <br> 48 <br>
49 <div id="letras" ></div> 49 <div id="letras" ></div>
50 -<br>  
51 <p>Mapfiles (arquivos .map existentes no diretório i3geo/temas):</p> 50 <p>Mapfiles (arquivos .map existentes no diretório i3geo/temas):</p>
52 <div id="tabela" style="left:-5px;"></div> 51 <div id="tabela" style="left:-5px;"></div>
53 </div> 52 </div>
@@ -110,11 +109,12 @@ var letras = &quot;A B C D E F G H I J K L M N O P Q R S T U V X Y Z _ 1 2 3 4 5 6 7 @@ -110,11 +109,12 @@ var letras = &quot;A B C D E F G H I J K L M N O P Q R S T U V X Y Z _ 1 2 3 4 5 6 7
110 for(i=0;i<nletras;i++){ 109 for(i=0;i<nletras;i++){
111 ins += "<span onclick='filtraLetra(\""+letras[i]+"\")' style='color:blue;cursor:pointer'>"+letras[i]+" </span>"; 110 ins += "<span onclick='filtraLetra(\""+letras[i]+"\")' style='color:blue;cursor:pointer'>"+letras[i]+" </span>";
112 } 111 }
113 -document.getElementById("letras").innerHTML = ins; 112 +document.getElementById("letras").innerHTML = ins+ " <input onclick='filtraLetra(\"\")' type=checkbox id=mostraMini />Mostra a miniatura se houver";
114 113
115 function filtraLetra(letra){ 114 function filtraLetra(letra){
116 document.getElementById("tabela").innerHTML = "<span style=color:red >Aguarde...</span>"; 115 document.getElementById("tabela").innerHTML = "<span style=color:red >Aguarde...</span>";
117 core_pegaMapfiles("montaArvore()",letra) 116 core_pegaMapfiles("montaArvore()",letra)
118 } 117 }
  118 +
119 </script> 119 </script>
120 </body> 120 </body>
admin/js/core.js
@@ -364,7 +364,6 @@ function core_pegaMapfiles(funcaoM,letra) @@ -364,7 +364,6 @@ function core_pegaMapfiles(funcaoM,letra)
364 if(arguments.length == 1){ 364 if(arguments.length == 1){
365 var letra = ""; 365 var letra = "";
366 } 366 }
367 -  
368 var sUrl = "../php/menutemas.php?funcao=listaMapsTemas&letra="+letra; 367 var sUrl = "../php/menutemas.php?funcao=listaMapsTemas&letra="+letra;
369 var callbackM = 368 var callbackM =
370 { 369 {
admin/js/editormapfile.js
@@ -230,10 +230,13 @@ function montaNosRaiz(redesenha) @@ -230,10 +230,13 @@ function montaNosRaiz(redesenha)
230 var nos = new Array() 230 var nos = new Array()
231 for (var i=0, j=$mapfiles.length; i<j; i++) 231 for (var i=0, j=$mapfiles.length; i<j; i++)
232 { 232 {
233 - conteudo = "&nbsp;<img style=\"position:relative;cursor:pointer;top:2px\" onclick=\"excluirMapfile('"+$mapfiles[i]+"')\" title=excluir src=\"../imagens/01.png\" />"  
234 - conteudo += "&nbsp;<img style=\"position:relative;cursor:pointer;top:2px\" onclick=\"editorTemaMapfile('"+$mapfiles[i]+"')\" title='editar tema associado' src=\"../imagens/06.png\" />"  
235 - conteudo += "&nbsp;<img style=\"position:relative;cursor:pointer;top:2px\" onclick=\"testarMapfile('"+$mapfiles[i]+"')\" title='testar!' src=\"../imagens/41.png\" /><b>&nbsp;<span>"+$mapfiles[i]+"</span>"  
236 - var d = {html:conteudo,id:$mapfiles[i],codigoMap:$mapfiles[i]}; 233 + conteudo = "&nbsp;<img style=\"position:relative;cursor:pointer;top:2px\" onclick=\"excluirMapfile('"+$mapfiles[i].codigo+"')\" title=excluir src=\"../imagens/01.png\" />"
  234 + conteudo += "&nbsp;<img style=\"position:relative;cursor:pointer;top:2px\" onclick=\"editorTemaMapfile('"+$mapfiles[i].codigo+"')\" title='editar tema associado' src=\"../imagens/06.png\" />"
  235 + conteudo += "&nbsp;<img style=\"position:relative;cursor:pointer;top:2px\" onclick=\"testarMapfile('"+$mapfiles[i].codigo+"')\" title='testar!' src=\"../imagens/41.png\" /><b>&nbsp;<span>"+$mapfiles[i].codigo+" <span style=color:gray >"+$mapfiles[i].nome+"</span></span>"
  236 + if($mapfiles[i].imagem != "" && $i("mostraMini").checked == true){
  237 + conteudo += "</b><br><img src='../../temas/miniaturas/"+$mapfiles[i].imagem+"'/>";
  238 + }
  239 + var d = {html:conteudo,id:$mapfiles[i].codigo,codigoMap:$mapfiles[i].codigo};
237 var tempNode = new YAHOO.widget.HTMLNode(d, root, false,true); 240 var tempNode = new YAHOO.widget.HTMLNode(d, root, false,true);
238 nos.push(tempNode) 241 nos.push(tempNode)
239 } 242 }
admin/js/menutemas.js
@@ -3,14 +3,6 @@ function iniciaAdmin() @@ -3,14 +3,6 @@ function iniciaAdmin()
3 { 3 {
4 verificaEditores() 4 verificaEditores()
5 } 5 }
6 -function importarXmlMenu()  
7 -{  
8 - $i("resultado").innerHTML = $mensagemAguarde  
9 - var retorna = function(retorno)  
10 - {$i("resultado").innerHTML = retorno.data}  
11 - var p = "../php/menutemas.php?funcao=importarXmlMenu&nomemenu="+$i("nome").value+"&xml="+$i("arquivo").value;  
12 - cPaint.call(p,"",retorna);  
13 -}  
14 function montaParametros() 6 function montaParametros()
15 { 7 {
16 var ins = "" 8 var ins = ""
@@ -399,11 +391,9 @@ function excluir(prefixo,id) @@ -399,11 +391,9 @@ function excluir(prefixo,id)
399 cPaint.call(p,"",retorna); 391 cPaint.call(p,"",retorna);
400 } 392 }
401 } 393 }
402 -  
403 function pegaMapfiles(retorna) 394 function pegaMapfiles(retorna)
404 { 395 {
405 var cPaint = new cpaint(); 396 var cPaint = new cpaint();
406 - //cPaint.set_async("true");  
407 cPaint.set_response_type("JSON"); 397 cPaint.set_response_type("JSON");
408 var p = "../php/menutemas.php?funcao=listaMapsTemas"; 398 var p = "../php/menutemas.php?funcao=listaMapsTemas";
409 cPaint.call(p,"listaMapsTemas",retorna); 399 cPaint.call(p,"listaMapsTemas",retorna);
admin/php/admin.php
@@ -83,6 +83,19 @@ Imprime na saída a string JSON @@ -83,6 +83,19 @@ Imprime na saída a string JSON
83 function retornaJSON($obj) 83 function retornaJSON($obj)
84 { 84 {
85 global $locaplic; 85 global $locaplic;
  86 + if(function_exists("json_encode"))
  87 + {echojson(json_encode($obj));}
  88 + else
  89 + {
  90 + include_once($locaplic."/pacotes/cpaint/JSON/json2.php");
  91 + error_reporting(0);
  92 + $j = new Services_JSON();
  93 + $texto = $j->encode($obj);
  94 + if (!mb_detect_encoding($texto,"UTF-8",true))
  95 + $texto = utf8_encode($texto);
  96 + echo $texto;
  97 + }
  98 +/*
86 include_once($locaplic."/pacotes/cpaint/JSON/json2.php"); 99 include_once($locaplic."/pacotes/cpaint/JSON/json2.php");
87 error_reporting(0); 100 error_reporting(0);
88 $j = new Services_JSON(); 101 $j = new Services_JSON();
@@ -96,6 +109,7 @@ function retornaJSON($obj) @@ -96,6 +109,7 @@ function retornaJSON($obj)
96 header('Pragma: no-cache'); 109 header('Pragma: no-cache');
97 echo $texto; 110 echo $texto;
98 exit; 111 exit;
  112 +*/
99 } 113 }
100 /* 114 /*
101 Function: verificaDuplicados 115 Function: verificaDuplicados
admin/php/classe_arvore.php
@@ -140,9 +140,7 @@ Return: @@ -140,9 +140,7 @@ Return:
140 } 140 }
141 else 141 else
142 $sql = "SELECT publicado_menu,perfil_menu,aberto,desc_menu,id_menu,$coluna as nome_menu from i3geoadmin_menus where publicado_menu != 'NAO' or publicado_menu isnull order by nome_menu"; 142 $sql = "SELECT publicado_menu,perfil_menu,aberto,desc_menu,id_menu,$coluna as nome_menu from i3geoadmin_menus where publicado_menu != 'NAO' or publicado_menu isnull order by nome_menu";
143 -  
144 $regs = $this->execSQL($sql); 143 $regs = $this->execSQL($sql);
145 -  
146 $resultado = array(); 144 $resultado = array();
147 foreach($regs as $reg) 145 foreach($regs as $reg)
148 { 146 {
admin/php/menutemas.php
@@ -749,15 +749,11 @@ function alteraMenus() @@ -749,15 +749,11 @@ function alteraMenus()
749 return "ok"; 749 return "ok";
750 } 750 }
751 catch (PDOException $e) 751 catch (PDOException $e)
752 - {  
753 - return "Error!: " . $e->getMessage();  
754 - } 752 + {return "Error!: " . $e->getMessage();}
755 } 753 }
756 function alteraPerfis() 754 function alteraPerfis()
757 { 755 {
758 global $perfil,$id; 756 global $perfil,$id;
759 - //$perfil = resolveAcentos($perfil,"html");  
760 -  
761 try 757 try
762 { 758 {
763 $dbh = ""; 759 $dbh = "";
@@ -860,18 +856,14 @@ function alteraPerfis() @@ -860,18 +856,14 @@ function alteraPerfis()
860 return $retorna; 856 return $retorna;
861 } 857 }
862 catch (PDOException $e) 858 catch (PDOException $e)
863 - {  
864 - return "Error!: " . $e->getMessage();  
865 - } 859 + {return "Error!: " . $e->getMessage();}
866 } 860 }
867 function alteraTags() 861 function alteraTags()
868 { 862 {
869 global $nome,$id; 863 global $nome,$id;
870 try 864 try
871 { 865 {
872 -  
873 $dbh = ""; 866 $dbh = "";
874 - //$nome = mb_convert_encoding($nome,"UTF-8","ISO-8859-1");  
875 include("conexao.php"); 867 include("conexao.php");
876 if($convUTF) $nome = utf8_encode($nome); 868 if($convUTF) $nome = utf8_encode($nome);
877 $retorna = ""; 869 $retorna = "";
@@ -884,20 +876,6 @@ function alteraTags() @@ -884,20 +876,6 @@ function alteraTags()
884 foreach($q as $row) 876 foreach($q as $row)
885 {$original = $row["nome"];} 877 {$original = $row["nome"];}
886 $dbhw->query("UPDATE i3geoadmin_tags SET nome = '$nome' WHERE id_tag = $id"); 878 $dbhw->query("UPDATE i3geoadmin_tags SET nome = '$nome' WHERE id_tag = $id");
887 - //exclui os registros do tag alterado nos temas  
888 - /*  
889 - if($original != "")  
890 - {  
891 - $q = $dbh->query("select tags_tema,id_tema from i3geoadmin_temas");  
892 - foreach($q as $row)  
893 - {  
894 - $ts = $row['tags_tema'];  
895 - $i = $row['id_tema'];  
896 - $ts = str_replace($original,$nome,$ts);  
897 - $dbhw->query("UPDATE i3geoadmin_temas SET tags_tema = '$ts' WHERE id_tema = $i");  
898 - }  
899 - }  
900 - */  
901 } 879 }
902 $retorna = $id; 880 $retorna = $id;
903 } 881 }
@@ -1069,18 +1047,14 @@ function alteraTemas() @@ -1069,18 +1047,14 @@ function alteraTemas()
1069 foreach($tags as $tag) 1047 foreach($tags as $tag)
1070 { 1048 {
1071 if(!(verificaDuplicados("select * from i3geoadmin_tags where nome = '$tag'",$dbh))) 1049 if(!(verificaDuplicados("select * from i3geoadmin_tags where nome = '$tag'",$dbh)))
1072 - {  
1073 - $dbhw->query("INSERT INTO i3geoadmin_tags (nome) VALUES ('$tag')");  
1074 - } 1050 + {$dbhw->query("INSERT INTO i3geoadmin_tags (nome) VALUES ('$tag')");}
1075 } 1051 }
1076 $dbhw = null; 1052 $dbhw = null;
1077 $dbh = null; 1053 $dbh = null;
1078 return $retorna; 1054 return $retorna;
1079 } 1055 }
1080 catch (PDOException $e) 1056 catch (PDOException $e)
1081 - {  
1082 - return "Error!: " . $e->getMessage();  
1083 - } 1057 + {return "Error!: " . $e->getMessage();}
1084 } 1058 }
1085 /* 1059 /*
1086 Retorna a lista de mapfiles do diretorio i3geo/temas 1060 Retorna a lista de mapfiles do diretorio i3geo/temas
@@ -1113,257 +1087,30 @@ function listaMapsTemas() @@ -1113,257 +1087,30 @@ function listaMapsTemas()
1113 closedir($dh); 1087 closedir($dh);
1114 } 1088 }
1115 sort($arquivos); 1089 sort($arquivos);
1116 - return $arquivos;  
1117 -}  
1118 -/*  
1119 -Importa um arquivo xml do tipo "menutemas" para o banco de dados  
1120 -*/  
1121 -function importarXmlMenu()  
1122 -{  
1123 - global $nomemenu,$xml;  
1124 - error_reporting(E_ALL);  
1125 - set_time_limit(0);  
1126 - $listaDeTags = array();  
1127 - if(!file_exists($xml))  
1128 - {return "<br><b>Arquivo $xml n&atilde;o encontrado";}  
1129 - include_once("../../classesphp/funcoes_gerais.php");  
1130 - include("conexao.php");  
1131 - if($convUTF) $nomemenu = utf8_encode($nomemenu);  
1132 - $dbhw->query("INSERT INTO i3geoadmin_menus (perfil_menu,desc_menu,nome_menu,publicado_menu,aberto) VALUES ('','','$nomemenu','SIM','NAO')");  
1133 - $id_menu = $dbh->query("SELECT id_menu FROM i3geoadmin_menus where nome_menu = '$nomemenu'");  
1134 - $id_menu = $id_menu->fetchAll();  
1135 - $id_menu = $id_menu[0]['id_menu'];  
1136 - $xml = simplexml_load_file($xml);  
1137 - //  
1138 - //importa os grupos  
1139 - //  
1140 - $gruposExistentes = array();  
1141 - $q = $dbh->query("select * from i3geoadmin_grupos");  
1142 - $resultado = $q->fetchAll();  
1143 - foreach($resultado as $r)  
1144 - {$gruposExistentes[$r["nome_grupo"]] = 0;}  
1145 - foreach($xml->GRUPO as $grupo)  
1146 - {  
1147 - $nome = html_entity_decode(ixml($grupo,"GTIPO"));  
1148 - $descricao = html_entity_decode(ixml($grupo,"DTIPO"));  
1149 - if($convUTF)  
1150 - {  
1151 - $nome = utf8_encode($nome);  
1152 - $descricao = utf8_encode($descricao);  
1153 - }  
1154 - if(!isset($gruposExistentes[$nome]))  
1155 - {  
1156 - $nome = str_replace("'","",$nome);  
1157 - $descricao = str_replace("'","",$descricao);  
1158 - $dbhw->query("INSERT INTO i3geoadmin_grupos (desc_grupo,nome_grupo) VALUES ('$descricao','$nome')");  
1159 - }  
1160 - $gruposExistentes[$nome] = 0;  
1161 - }  
1162 - //  
1163 - //importa os sub-grupos  
1164 - //  
1165 - $subgruposExistentes = array();  
1166 - $q = $dbh->query("select * from i3geoadmin_subgrupos");  
1167 - $resultado = $q->fetchAll();  
1168 - foreach($resultado as $r)  
1169 - {$subgruposExistentes[$r["nome_subgrupo"]] = 0;}  
1170 - foreach($xml->GRUPO as $grupo)  
1171 - {  
1172 - foreach($grupo->SGRUPO as $sgrupo)  
1173 - {  
1174 - $nome = html_entity_decode(ixml($sgrupo,"SDTIPO"));  
1175 - if($convUTF)  
1176 - {  
1177 - $nome = utf8_encode($nome);  
1178 - }  
1179 - $descricao = "";  
1180 - if(!isset($subgruposExistentes[$nome]))  
1181 - {  
1182 - $nome = str_replace("'","",$nome);  
1183 - $descricao = str_replace("'","",$descricao);  
1184 - $dbhw->query("INSERT INTO i3geoadmin_subgrupos (desc_subgrupo,nome_subgrupo) VALUES ('$descricao','$nome')");  
1185 - $subgruposExistentes[$nome] = 0;  
1186 - }  
1187 - }  
1188 - }  
1189 - //  
1190 - //importa os temas  
1191 - //  
1192 - $temasExistentes = array();  
1193 - $q = $dbh->query("select * from i3geoadmin_temas");  
1194 - $resultado = $q->fetchAll();  
1195 - foreach($resultado as $r)  
1196 - {  
1197 - if($r["codigo_tema"])  
1198 - $temasExistentes[$r["codigo_tema"]] = 0;  
1199 - }  
1200 - foreach($xml->TEMA as $tema)  
1201 - {  
1202 - $nome = html_entity_decode(ixml($tema,"TNOME"));  
1203 - $descricao = html_entity_decode(ixml($tema,"TDESC"));  
1204 - if($convUTF)  
1205 - {  
1206 - $nome = utf8_encode($nome);  
1207 - $descricao = utf8_encode($descricao);  
1208 - }  
1209 - $codigo = ixml($tema,"TID");  
1210 - $link = ixml($tema,"TLINK");  
1211 - $tipo = ixml($tema,"TIPOA");  
1212 - $tags = ixml($tema,"TAGS");  
1213 - if($convUTF) $tags = utf8_encode($tags);  
1214 - $down = ixml($tema,"DOWNLOAD");  
1215 - $kml = ixml($tema,"KML");  
1216 - $ogc = ixml($tema,"OGC");  
1217 - $listaDeTags = array_merge($listaDeTags,explode(" ",$tags));  
1218 - if(!isset($temasExistentes[$codigo]))  
1219 - {  
1220 - $nome = str_replace("'","",$nome);  
1221 - $descricao = str_replace("'","",$descricao);  
1222 - $dbhw->query("INSERT INTO i3geoadmin_temas (nacessos,kml_tema,kmz_tema,ogc_tema,download_tema,tags_tema,tipoa_tema,link_tema,desc_tema,nome_tema,codigo_tema) VALUES (0,'$kml','NAO','$ogc','$down','$tags','$tipo','$link','$descricao','$nome','$codigo')");  
1223 - }  
1224 - $temasExistentes[$codigo] = 0;  
1225 - }  
1226 - foreach($xml->GRUPO as $grupo)  
1227 - {  
1228 - foreach($grupo->TEMA as $tema)  
1229 - {  
1230 - $nome = html_entity_decode(ixml($tema,"TNOME"));  
1231 - $descricao = html_entity_decode(ixml($tema,"TDESC"));  
1232 - if($convUTF)  
1233 - {  
1234 - $nome = utf8_encode($nome);  
1235 - $descricao = utf8_encode($descricao);  
1236 - }  
1237 - $codigo = ixml($tema,"TID");  
1238 - $link = ixml($tema,"TLINK");  
1239 - $tipo = ixml($tema,"TIPOA");  
1240 - $tags = ixml($tema,"TAGS");  
1241 - if($convUTF) $tags = utf8_encode($tags);  
1242 - $down = ixml($tema,"DOWNLOAD");  
1243 - $kml = ixml($tema,"KML");  
1244 - $ogc = ixml($tema,"OGC");  
1245 - $listaDeTags = array_merge($listaDeTags,explode(" ",$tags));  
1246 - if(!isset($temasExistentes[$codigo]))  
1247 - {  
1248 - $nome = str_replace("'","",$nome);  
1249 - $descricao = str_replace("'","",$descricao);  
1250 - $dbhw->query("INSERT INTO i3geoadmin_temas (nacessos,kml_tema,kmz_tema,ogc_tema,download_tema,tags_tema,tipoa_tema,link_tema,desc_tema,nome_tema,codigo_tema) VALUES (0,'$kml','NAO','$ogc','$down','$tags','$tipo','$link','$descricao','$nome','$codigo')");  
1251 - }  
1252 - $temasExistentes[$codigo] = 0;  
1253 - }  
1254 - foreach($grupo->SGRUPO as $sgrupo)  
1255 - {  
1256 - foreach($sgrupo->TEMA as $tema)  
1257 - {  
1258 - $nome = html_entity_decode(ixml($tema,"TNOME"));  
1259 - $descricao = html_entity_decode(ixml($tema,"TDESC"));  
1260 - if($convUTF)  
1261 - {  
1262 - $nome = utf8_encode($nome);  
1263 - $descricao = utf8_encode($descricao);  
1264 - }  
1265 - $codigo = ixml($tema,"TID");  
1266 - $link = ixml($tema,"TLINK");  
1267 - $tipo = ixml($tema,"TIPOA");  
1268 - $tags = html_entity_decode(ixml($tema,"TAGS"));  
1269 - if($convUTF) $tags = utf8_encode($tags);  
1270 - $down = ixml($tema,"DOWNLOAD");  
1271 - $kml = ixml($tema,"KML");  
1272 - $ogc = ixml($tema,"OGC");  
1273 - $listaDeTags = array_merge($listaDeTags,explode(" ",$tags));  
1274 - if(!isset($temasExistentes[$codigo]))  
1275 - {  
1276 - $nome = str_replace("'","",$nome);  
1277 - $descricao = str_replace("'","",$descricao);  
1278 - $dbhw->query("INSERT INTO i3geoadmin_temas (nacessos,kml_tema,kmz_tema,ogc_tema,download_tema,tags_tema,tipoa_tema,link_tema,desc_tema,nome_tema,codigo_tema) VALUES (0,'$kml','NAO','$ogc','$down','$tags','$tipo','$link','$descricao','$nome','$codigo')");  
1279 - }  
1280 - $temasExistentes[$codigo] = 0;  
1281 - }  
1282 - }  
1283 - }  
1284 - //  
1285 - //monta árvore  
1286 - //  
1287 // 1090 //
1288 - //registra os temas no nível da raiz 1091 + //pega o nome de cada tema
1289 // 1092 //
1290 - foreach($xml->TEMA as $tema)  
1291 - {  
1292 - $codigo = ixml($tema,"TID");  
1293 - $perfil = ixml($tema,"PERFIL");  
1294 - $r = $dbh->query("select id_tema from i3geoadmin_temas where codigo_tema = '$codigo'");  
1295 - $id_tema = $r->fetchAll();  
1296 - $id_tema = $id_tema[0]['id_tema'];  
1297 - $dbhw->query("INSERT INTO i3geoadmin_raiz (id_tema,id_menu,id_nivel,nivel,perfil,ordem) VALUES ('$id_tema','$id_menu','0','0','$perfil','0')");  
1298 - }  
1299 - //  
1300 - //registra o restante  
1301 - //  
1302 - $contaGrupo = 0;  
1303 - foreach($xml->GRUPO as $grupo)  
1304 - {  
1305 - $gtipo = html_entity_decode(ixml($grupo,"GTIPO"));  
1306 - if($convUTF) $gtipo = utf8_encode($gtipo);  
1307 - $n1_perfil = ixml($grupo,"PERFIL");  
1308 - $r = $dbh->query("select id_grupo from i3geoadmin_grupos where nome_grupo = '$gtipo'");  
1309 - $id_grupo = $r->fetchAll();  
1310 - $id_grupo = $id_grupo[0]['id_grupo'];  
1311 - //echo "INSERT INTO i3geoadmin_n1 (ordem,publicado,id_menu,id_grupo,n1_perfil) VALUES ($contaGrupo,'SIM',$id_menu,$id_grupo,'$n1_perfil')"."<br>";  
1312 -  
1313 - $dbhw->query("INSERT INTO i3geoadmin_n1 (ordem,publicado,id_menu,id_grupo,n1_perfil) VALUES ($contaGrupo,'SIM',$id_menu,$id_grupo,'$n1_perfil')");  
1314 -  
1315 - $contaGrupo++;  
1316 - $id_n1 = $dbh->query("SELECT id_n1 FROM i3geoadmin_n1 where id_menu = '$id_menu' and id_grupo = '$id_grupo'");  
1317 - $id_n1 = $id_n1->fetchAll();  
1318 - $id_n1 = $id_n1[0]['id_n1'];  
1319 -  
1320 - foreach($grupo->TEMA as $tema)  
1321 - {  
1322 - $codigo = ixml($tema,"TID");  
1323 - $perfil = ixml($tema,"PERFIL");  
1324 - $r = $dbh->query("select id_tema from i3geoadmin_temas where codigo_tema = '$codigo'");  
1325 - $id_tema = $r->fetchAll();  
1326 - $id_tema = $id_tema[0]['id_tema'];  
1327 - $dbhw->query("INSERT INTO i3geoadmin_raiz (id_tema,id_menu,id_nivel,nivel,perfil,ordem) VALUES ($id_tema,$id_menu,$id_n1,'1','$perfil','0')");  
1328 - }  
1329 - $contaSubGrupo = 0;  
1330 - foreach($grupo->SGRUPO as $subgrupo)  
1331 - {  
1332 - $sdtipo = html_entity_decode(ixml($subgrupo,"SDTIPO"));  
1333 - if($convUTF) $sdtipo = utf8_encode($sdtipo);  
1334 - $n2_perfil = ixml($subgrupo,"PERFIL");  
1335 - $r = $dbh->query("select id_subgrupo from i3geoadmin_subgrupos where nome_subgrupo = '$sdtipo'");  
1336 - $id_subgrupo = $r->fetchAll();  
1337 - $id_subgrupo = $id_subgrupo[0]['id_subgrupo'];  
1338 -  
1339 - $dbhw->query("INSERT INTO i3geoadmin_n2 (publicado,ordem,id_n1,id_subgrupo,n2_perfil) VALUES ('SIM',$contaSubGrupo,$id_n1,$id_subgrupo,'$n2_perfil')");  
1340 - $contaSubGrupo++;  
1341 - $id_n2 = $dbh->query("SELECT id_n2 FROM i3geoadmin_n2 where id_n1='$id_n1' and id_subgrupo = '$id_subgrupo'");  
1342 - $id_n2 = $id_n2->fetchAll();  
1343 - $id_n2 = $id_n2[0]['id_n2'];  
1344 - $contaTema = 0;  
1345 - foreach($subgrupo->TEMA as $tema)  
1346 - {  
1347 - $codigo = ixml($tema,"TID");  
1348 - $perfil = ixml($tema,"PERFIL");  
1349 - $r = $dbh->query("select id_tema from i3geoadmin_temas where codigo_tema = '$codigo'");  
1350 - $id_tema = $r->fetchAll();  
1351 - $id_tema = $id_tema[0]['id_tema'];  
1352 - $dbhw->query("INSERT INTO i3geoadmin_n3 (publicado,ordem,id_n2,id_tema,n3_perfil) VALUES ('SIM',$contaTema,$id_n2,$id_tema,'$perfil')");  
1353 - $contaTema++;  
1354 - }  
1355 - }  
1356 - }  
1357 - //registra os tags  
1358 - $listaDeTags = array_unique($listaDeTags);  
1359 - foreach ($listaDeTags as $t) 1093 + $sql = "select nome_tema,codigo_tema from i3geoadmin_temas ";
  1094 + $dbh = "";
  1095 + include($locaplic."/admin/php/conexao.php");
  1096 + $q = $dbh->query($sql,PDO::FETCH_ASSOC);
  1097 + $regs = $q->fetchAll();
  1098 + $nomes = array();
  1099 + foreach($regs as $reg)
  1100 + {$nomes[$reg["codigo_tema"]] = $reg["nome_tema"];}
  1101 + $lista = array();
  1102 + foreach($arquivos as $arq)
1360 { 1103 {
1361 - if($t != "" && !(verificaDuplicados("select * from i3geoadmin_tags where nome = '$t'",$dbh)))  
1362 - $dbhw->query("INSERT INTO i3geoadmin_tags (nome) VALUES ('$t')"); 1104 + $n = explode(".",$arq);
  1105 + $n = $nomes[$n[0]];
  1106 + if(!$n)
  1107 + {$n = "";}
  1108 + $imagem = "";
  1109 + if(file_exists($locaplic."/temas/miniaturas/".$arq.".map.mini.png"))
  1110 + {$imagem = $arq.".map.mini.png";}
  1111 + $lista[] = array("nome"=>$n,"codigo"=>$arq,"imagem"=>$imagem);
1363 } 1112 }
1364 - $dbhw = null;  
1365 - $dbh = null;  
1366 - return "Dados importados."; 1113 + return $lista;
1367 } 1114 }
1368 1115
1369 function removeCabecalho($arq,$symbolset=true) 1116 function removeCabecalho($arq,$symbolset=true)
@@ -1373,11 +1120,7 @@ function removeCabecalho($arq,$symbolset=true) @@ -1373,11 +1120,7 @@ function removeCabecalho($arq,$symbolset=true)
1373 { 1120 {
1374 $cabeca = array(); 1121 $cabeca = array();
1375 if($symbolset) 1122 if($symbolset)
1376 - {  
1377 - $cabeca[] = "MAP\n";  
1378 - //$final[] = "SYMBOLSET ../symbols/simbolos.sym\n";  
1379 - //$final[] = "FONTSET ".'"'."../symbols/fontes.txt".'"'."\n";  
1380 - } 1123 + {$cabeca[] = "MAP\n";}
1381 $grava = false; 1124 $grava = false;
1382 while (!feof($handle)) 1125 while (!feof($handle))
1383 { 1126 {
classesphp/funcoes_gerais.php
@@ -2553,7 +2553,7 @@ function echojson($a) @@ -2553,7 +2553,7 @@ function echojson($a)
2553 echo $a; 2553 echo $a;
2554 if(extension_loaded('zlib')) 2554 if(extension_loaded('zlib'))
2555 {ob_end_flush();} 2555 {ob_end_flush();}
2556 - exit; 2556 + exit;
2557 } 2557 }
2558 /* 2558 /*
2559 Function: cpjson 2559 Function: cpjson