Commit 4d4ed2df31641a6b22af3a88fbf83cf77899e758
1 parent
610bee1c
Exists in
master
and in
7 other branches
--no commit message
Showing
3 changed files
with
13 additions
and
9 deletions
Show diff stats
admin/admin.db
No preview for this file type
admin/js/estat_editor.js
| @@ -423,11 +423,12 @@ i3GEOadmin.editor = { | @@ -423,11 +423,12 @@ i3GEOadmin.editor = { | ||
| 423 | }, | 423 | }, |
| 424 | formulario: function(){ | 424 | formulario: function(){ |
| 425 | var ins = '<fieldset><form id=i3GEOuploadf target="i3GEOuploadiframe" action="../php/metaestat_uploadshp_submit.php" method="post" ENCTYPE="multipart/form-data">' + | 425 | var ins = '<fieldset><form id=i3GEOuploadf target="i3GEOuploadiframe" action="../php/metaestat_uploadshp_submit.php" method="post" ENCTYPE="multipart/form-data">' + |
| 426 | + '<p class="paragrafo" >Após terminar o processo, atualize essa página</p>' + | ||
| 426 | '<p class="paragrafo" >shp: <br><input class=digitar type="file" size=22 name="i3GEOuploadshp" style="top:0px;left:0px;cursor:pointer;"></p>' + | 427 | '<p class="paragrafo" >shp: <br><input class=digitar type="file" size=22 name="i3GEOuploadshp" style="top:0px;left:0px;cursor:pointer;"></p>' + |
| 427 | '<p class="paragrafo" >shx: <br><input class=digitar type="file" size=22 name="i3GEOuploadshx" style="top:0px;left:0px;cursor:pointer;"></p>' + | 428 | '<p class="paragrafo" >shx: <br><input class=digitar type="file" size=22 name="i3GEOuploadshx" style="top:0px;left:0px;cursor:pointer;"></p>' + |
| 428 | '<p class="paragrafo" >dbf: <br><input class=digitar type="file" size=22 name="i3GEOuploaddbf" style="top:0px;left:0px;cursor:pointer;"></p>' + | 429 | '<p class="paragrafo" >dbf: <br><input class=digitar type="file" size=22 name="i3GEOuploaddbf" style="top:0px;left:0px;cursor:pointer;"></p>' + |
| 429 | '<p class="paragrafo" >Nome da nova tabela:<br><input class=digitar type="text" size=20 id="tabelaDestino" name="tabelaDestino" style="top:0px;left:0px;cursor:pointer;"></p>' + | 430 | '<p class="paragrafo" >Nome da nova tabela:<br><input class=digitar type="text" size=20 id="tabelaDestino" name="tabelaDestino" style="top:0px;left:0px;cursor:pointer;"></p>' + |
| 430 | - '<p class="paragrafo" >Código da projeção (SRID):<br><input class=digitar type="text" value="4326" size=20 id="srid" name="srid" style="top:0px;left:0px;cursor:pointer;"></p>' + | 431 | + '<p class="paragrafo" >Código da projeção (SRID) Assegure-se que o shapefile esteja na projeção geográfica se você for usar com o sistema de metadados estatísticos :<br><input class=digitar type="text" value="4326" size=20 id="srid" name="srid" style="top:0px;left:0px;cursor:pointer;"></p>' + |
| 431 | 432 | ||
| 432 | '<p class="paragrafo" ><input id=i3GEOuploadsubmit type="button" value="Enviar" size=12 />' + | 433 | '<p class="paragrafo" ><input id=i3GEOuploadsubmit type="button" value="Enviar" size=12 />' + |
| 433 | '<input type="hidden" name="MAX_FILE_SIZE" value="1000000">' + | 434 | '<input type="hidden" name="MAX_FILE_SIZE" value="1000000">' + |
| @@ -435,7 +436,7 @@ i3GEOadmin.editor = { | @@ -435,7 +436,7 @@ i3GEOadmin.editor = { | ||
| 435 | '<input type="hidden" id="i3GEOuploadesquema" name="i3GEOuploadesquema" value="">' + | 436 | '<input type="hidden" id="i3GEOuploadesquema" name="i3GEOuploadesquema" value="">' + |
| 436 | '</form>' + | 437 | '</form>' + |
| 437 | "<p class='paragrafo' style=color:red >Não utilize '_' no nome do arquivo. Apenas letras e números são aceitos!!!</p>" + | 438 | "<p class='paragrafo' style=color:red >Não utilize '_' no nome do arquivo. Apenas letras e números são aceitos!!!</p>" + |
| 438 | - '<iframe name=i3GEOuploadiframe style="text-align:left;border:1px solid gray;" width="98%" height="60px"></iframe></fieldset>'; | 439 | + '<iframe name=i3GEOuploadiframe style="text-align:left;border:1px solid gray;" width="98%" height="400px"></iframe></fieldset>'; |
| 439 | return ins; | 440 | return ins; |
| 440 | }, | 441 | }, |
| 441 | submit: function(){ | 442 | submit: function(){ |
admin/php/metaestat_uploadshp_submit.php
| @@ -69,18 +69,20 @@ if (isset($_FILES['i3GEOuploadshp']['name'])){ | @@ -69,18 +69,20 @@ if (isset($_FILES['i3GEOuploadshp']['name'])){ | ||
| 69 | $layer = ms_newLayerObj($mapObj); | 69 | $layer = ms_newLayerObj($mapObj); |
| 70 | $layer->set("data",$arqshp); | 70 | $layer->set("data",$arqshp); |
| 71 | $layer->open(); | 71 | $layer->open(); |
| 72 | - $colunas = $layer->getItems(); | ||
| 73 | - | 72 | + $colunasTemp = $layer->getItems(); |
| 73 | + $colunas = array(); | ||
| 74 | + foreach($colunasTemp as $c){ | ||
| 75 | + if(!is_numeric($c)){ | ||
| 76 | + $colunas[] = $c; | ||
| 77 | + } | ||
| 78 | + } | ||
| 79 | + | ||
| 74 | echo "<br>Numshapes: ". $numshapes; | 80 | echo "<br>Numshapes: ". $numshapes; |
| 75 | $tipo = $shapefileObj->type; | 81 | $tipo = $shapefileObj->type; |
| 76 | echo "<br>Tipo: ". $tipo; | 82 | echo "<br>Tipo: ". $tipo; |
| 77 | echo "<br>Colunas: "; | 83 | echo "<br>Colunas: "; |
| 78 | var_dump($colunas); | 84 | var_dump($colunas); |
| 79 | - | ||
| 80 | $sqinsert = array(); | 85 | $sqinsert = array(); |
| 81 | - | ||
| 82 | - | ||
| 83 | - | ||
| 84 | //verifica o tipo de coluna | 86 | //verifica o tipo de coluna |
| 85 | $tipoColuna = array(); | 87 | $tipoColuna = array(); |
| 86 | if($numshapes < 10){ | 88 | if($numshapes < 10){ |
| @@ -140,6 +142,7 @@ if (isset($_FILES['i3GEOuploadshp']['name'])){ | @@ -140,6 +142,7 @@ if (isset($_FILES['i3GEOuploadshp']['name'])){ | ||
| 140 | } catch (PDOException $e) { | 142 | } catch (PDOException $e) { |
| 141 | echo 'Connection failed: ' . $e->getMessage(); | 143 | echo 'Connection failed: ' . $e->getMessage(); |
| 142 | } | 144 | } |
| 145 | + | ||
| 143 | foreach($sqltabela as $linha){ | 146 | foreach($sqltabela as $linha){ |
| 144 | try { | 147 | try { |
| 145 | $dbh->query($linha); | 148 | $dbh->query($linha); |
| @@ -154,7 +157,7 @@ if (isset($_FILES['i3GEOuploadshp']['name'])){ | @@ -154,7 +157,7 @@ if (isset($_FILES['i3GEOuploadshp']['name'])){ | ||
| 154 | echo 'Erro: ' . $e->getMessage(); | 157 | echo 'Erro: ' . $e->getMessage(); |
| 155 | } | 158 | } |
| 156 | } | 159 | } |
| 157 | - echo "<br>Feito!!!"; | 160 | + echo "<br>Feito!!!<br>Faça o reload da página"; |
| 158 | } | 161 | } |
| 159 | else{ | 162 | else{ |
| 160 | echo "<p class='paragrafo' >Erro ao enviar o arquivo. Talvez o tamanho do arquivo seja maior do que o permitido.</p>"; | 163 | echo "<p class='paragrafo' >Erro ao enviar o arquivo. Talvez o tamanho do arquivo seja maior do que o permitido.</p>"; |