Commit 6fbdd8e48f56ccda12bba4dca4eafaf6c3dde72d
1 parent
a92bc5f5
Exists in
master
and in
7 other branches
Conclusão da migração do sistema de administração para bootstrap
Showing
8 changed files
with
868 additions
and
87 deletions
Show diff stats
| ... | ... | @@ -0,0 +1,29 @@ |
| 1 | +<?php | |
| 2 | +/****************************************************************/ | |
| 3 | +//include (dirname ( __FILE__ ) . "/../../../ms_configura.php"); | |
| 4 | +// | |
| 5 | +//checa login | |
| 6 | +//valida _GET e _POST, juntando em _GET | |
| 7 | +//pega algumas variaveis de uso mais comum | |
| 8 | +//session_start | |
| 9 | +// | |
| 10 | +include ("../../php/checaLogin.php"); | |
| 11 | +\admin\php\login\checaLogin(); | |
| 12 | +//funcoes de administracao | |
| 13 | +include ($_SESSION["locaplic"]."/admin1/php/funcoesAdmin.php"); | |
| 14 | +// | |
| 15 | +//carrega outras funcoes e extensoes do PHP | |
| 16 | +// | |
| 17 | +include ($_SESSION["locaplic"]."/classesphp/carrega_ext.php"); | |
| 18 | +// | |
| 19 | +//conexao com o banco de administracao | |
| 20 | +//cria as variaveis $dbh e $dbhw alem de conexaoadmin | |
| 21 | +// | |
| 22 | +include ($_SESSION["locaplic"]."/admin1/php/conexao.php"); | |
| 23 | +/***************************************************************/ | |
| 24 | +if (\admin\php\funcoesAdmin\verificaOperacaoSessao ( "admin/html/arvore" ) === false) { | |
| 25 | + header ( "HTTP/1.1 403 Vc nao pode realizar essa operacao" ); | |
| 26 | + exit (); | |
| 27 | +} | |
| 28 | + | |
| 29 | +?> | |
| 0 | 30 | \ No newline at end of file | ... | ... |
admin1/ferramentas/banco/index.php
| 1 | 1 | <?php |
| 2 | 2 | define ( "ONDEI3GEO", "../../.." ); |
| 3 | 3 | include ("exec.php"); |
| 4 | -//verifica se o login pode ser realizado | |
| 5 | -if(isset($i3geoPermiteLogin) && $i3geoPermiteLogin == false){ | |
| 6 | - header ( "HTTP/1.1 403 Login desativado" ); | |
| 7 | - exit (); | |
| 8 | -} | |
| 9 | - | |
| 10 | - | |
| 11 | 4 | include "../../head.php"; |
| 12 | 5 | ?> |
| 13 | 6 | <div class="container-fluid migalha" > |
| ... | ... | @@ -41,8 +34,8 @@ include "../../head.php"; |
| 41 | 34 | $resultado = $q->fetchAll(); |
| 42 | 35 | echo "</div><div class='well'><h3>SQL no padrão SQLITE</span></h3>"; |
| 43 | 36 | foreach($resultado as $r){ |
| 44 | - if(mb_detect_encoding($temasacessos2[$i],'UTF-8, ISO-8859-1') == "UTF-8"){ | |
| 45 | - echo "<p>".utf8_decode($r["sql"])."</p>"; | |
| 37 | + if(mb_detect_encoding($temasacessos2[$i],'UTF-8, ISO-8859-1') == "ISO-8859-1"){ | |
| 38 | + echo "<p>".utf8_encode($r["sql"])."</p>"; | |
| 46 | 39 | } |
| 47 | 40 | else{ |
| 48 | 41 | echo "<p>".$r["sql"]."</p>"; |
| ... | ... | @@ -52,16 +45,16 @@ include "../../head.php"; |
| 52 | 45 | echo "<div class='alert alert-info'><p>Após criar as tabelas no Postgres, vc deve definir as permissões para os usuários.</p>"; |
| 53 | 46 | echo "<p>Para usar outro banco de dados que não seja o default (SQLITE), você terá de alterar o programa i3geo/admin/php/conexao.php</p></div>"; |
| 54 | 47 | foreach($resultado as $r){ |
| 55 | - if(mb_detect_encoding($r["sql"],'UTF-8, ISO-8859-1') == "UTF-8"){ | |
| 56 | - $r["sql"] = utf8_decode($r["sql"]); | |
| 48 | + if(mb_detect_encoding($r["sql"],'UTF-8, ISO-8859-1') == "ISO-8859-1"){ | |
| 49 | + $r["sql"] = utf8_encode($r["sql"]); | |
| 57 | 50 | } |
| 58 | 51 | echo str_ireplace("INTEGER PRIMARY KEY","SERIAL PRIMARY KEY NOT NULL",$r["sql"])."<br>"; |
| 59 | 52 | } |
| 60 | 53 | echo "</div><div class='well'><h3>Listagem completa</h3>"; |
| 61 | 54 | echo "<pre style='overflow:auto;'>"; |
| 62 | 55 | $resultado = var_dump($resultado); |
| 63 | - if(mb_detect_encoding($resultado,'UTF-8, ISO-8859-1') == "UTF-8"){ | |
| 64 | - $resultado = utf8_decode($resultado); | |
| 56 | + if(mb_detect_encoding($resultado,'UTF-8, ISO-8859-1') == "ISO-8859-1"){ | |
| 57 | + $resultado = utf8_encode($resultado); | |
| 65 | 58 | } |
| 66 | 59 | echo $resultado; |
| 67 | 60 | $dbh = null; | ... | ... |
| ... | ... | @@ -0,0 +1,29 @@ |
| 1 | +<?php | |
| 2 | +/****************************************************************/ | |
| 3 | +//include (dirname ( __FILE__ ) . "/../../../ms_configura.php"); | |
| 4 | +// | |
| 5 | +//checa login | |
| 6 | +//valida _GET e _POST, juntando em _GET | |
| 7 | +//pega algumas variaveis de uso mais comum | |
| 8 | +//session_start | |
| 9 | +// | |
| 10 | +include ("../../php/checaLogin.php"); | |
| 11 | +\admin\php\login\checaLogin(); | |
| 12 | +//funcoes de administracao | |
| 13 | +include ($_SESSION["locaplic"]."/admin1/php/funcoesAdmin.php"); | |
| 14 | +// | |
| 15 | +//carrega outras funcoes e extensoes do PHP | |
| 16 | +// | |
| 17 | +include ($_SESSION["locaplic"]."/classesphp/carrega_ext.php"); | |
| 18 | +// | |
| 19 | +//conexao com o banco de administracao | |
| 20 | +//cria as variaveis $dbh e $dbhw alem de conexaoadmin | |
| 21 | +// | |
| 22 | +include ($_SESSION["locaplic"]."/admin1/php/conexao.php"); | |
| 23 | +/***************************************************************/ | |
| 24 | +if (\admin\php\funcoesAdmin\verificaOperacaoSessao ( "admin/html/arvore" ) === false) { | |
| 25 | + header ( "HTTP/1.1 403 Vc nao pode realizar essa operacao" ); | |
| 26 | + exit (); | |
| 27 | +} | |
| 28 | + | |
| 29 | +?> | |
| 0 | 30 | \ No newline at end of file | ... | ... |
admin1/ferramentas/estatisticas/index.php
| 1 | 1 | <?php |
| 2 | 2 | define ( "ONDEI3GEO", "../../.." ); |
| 3 | 3 | include ("exec.php"); |
| 4 | -//verifica se o login pode ser realizado | |
| 5 | -if(isset($i3geoPermiteLogin) && $i3geoPermiteLogin == false){ | |
| 6 | - header ( "HTTP/1.1 403 Login desativado" ); | |
| 7 | - exit (); | |
| 8 | -} | |
| 9 | - | |
| 10 | - | |
| 11 | 4 | include "../../head.php"; |
| 12 | 5 | ?> |
| 13 | 6 | <div class="container-fluid migalha" > |
| ... | ... | @@ -25,12 +18,11 @@ include "../../head.php"; |
| 25 | 18 | <div class="col-sm-12"> |
| 26 | 19 | <div class="well"> |
| 27 | 20 | <?php |
| 28 | - include("../../../admin/php/admin.php"); | |
| 29 | - $totaltemas = count(\admin\php\funcoesAdmin\pegaDados("select * from ".$esquemaadmin."i3geoadmin_temas")); | |
| 30 | - $temasvalidos = \admin\php\funcoesAdmin\pegaDados("select codigo_tema,nome_tema,download_tema,kml_tema,ogc_tema,link_tema,tags_tema from ".$esquemaadmin."i3geoadmin_temas where codigo_tema <> ''"); | |
| 31 | - $temasassocsubgrupos = \admin\php\funcoesAdmin\pegaDados("select id_tema from ".$esquemaadmin."i3geoadmin_n3 group by id_tema"); | |
| 32 | - $nacessostema = \admin\php\funcoesAdmin\pegaDados("select b.nome_tema,sum(a.nacessos) as soma,a.codigo_tema from ".$esquemaadmin."i3geoadmin_acessostema as a,".$esquemaadmin."i3geoadmin_temas as b where a.codigo_tema = b.codigo_tema and a.nacessos > 0 group by a.codigo_tema,b.nome_tema"); | |
| 33 | - $ntags = \admin\php\funcoesAdmin\pegaDados("select nome from ".$esquemaadmin."i3geoadmin_tags"); | |
| 21 | + $totaltemas = count(\admin\php\funcoesAdmin\pegaDados("select * from ".$_SESSION["esquemaadmin"]."i3geoadmin_temas")); | |
| 22 | + $temasvalidos = \admin\php\funcoesAdmin\pegaDados("select codigo_tema,nome_tema,download_tema,kml_tema,ogc_tema,link_tema,tags_tema from ".$_SESSION["esquemaadmin"]."i3geoadmin_temas where codigo_tema <> ''"); | |
| 23 | + $temasassocsubgrupos = \admin\php\funcoesAdmin\pegaDados("select id_tema from ".$_SESSION["esquemaadmin"]."i3geoadmin_n3 group by id_tema"); | |
| 24 | + $nacessostema = \admin\php\funcoesAdmin\pegaDados("select b.nome_tema,sum(a.nacessos) as soma,a.codigo_tema from ".$_SESSION["esquemaadmin"]."i3geoadmin_acessostema as a,".$_SESSION["esquemaadmin"]."i3geoadmin_temas as b where a.codigo_tema = b.codigo_tema and a.nacessos > 0 group by a.codigo_tema,b.nome_tema"); | |
| 25 | + $ntags = \admin\php\funcoesAdmin\pegaDados("select nome from ".$_SESSION["esquemaadmin"]."i3geoadmin_tags"); | |
| 34 | 26 | $totaltemasvalidos = count($temasvalidos); |
| 35 | 27 | $codigostemas = array(); |
| 36 | 28 | $ncodigostemas = array(); |
| ... | ... | @@ -41,17 +33,25 @@ include "../../head.php"; |
| 41 | 33 | $nsemlinktemas = 0; |
| 42 | 34 | $nsemtagstemas = 0; |
| 43 | 35 | |
| 44 | - $sql = "select codigo_tema,soma from (select a.codigo_tema, sum(nacessos) as soma from ".$esquemaadmin."i3geoadmin_acessostema as a,".$esquemaadmin."i3geoadmin_temas as b where a.codigo_tema = b.codigo_tema AND nacessos > 0 group by a.codigo_tema) as soma where soma >"; | |
| 36 | + $sql = "select codigo_tema,soma from (select a.codigo_tema, sum(nacessos) as soma from ".$_SESSION["esquemaadmin"]."i3geoadmin_acessostema as a,".$_SESSION["esquemaadmin"]."i3geoadmin_temas as b where a.codigo_tema = b.codigo_tema AND nacessos > 0 group by a.codigo_tema) as soma where soma >"; | |
| 45 | 37 | |
| 46 | 38 | $nacessosmaiorqueum = count(\admin\php\funcoesAdmin\pegaDados($sql." 0")); |
| 47 | 39 | $nacessosmaiorquedez = count(\admin\php\funcoesAdmin\pegaDados($sql." 10")); |
| 48 | 40 | $nacessosmaiorquecem = count(\admin\php\funcoesAdmin\pegaDados($sql." 100")); |
| 49 | 41 | |
| 50 | 42 | $temasacessos = array(); |
| 51 | - error_reporting (E_ALL); | |
| 52 | 43 | foreach($temasvalidos as $tema){ |
| 53 | - $ncodigostemas[$tema["codigo_tema"]]++; | |
| 54 | - $nnomestemas[$tema["nome_tema"]]++; | |
| 44 | + if(in_array($tema["codigo_tema"],array_keys($ncodigostemas))){ | |
| 45 | + $ncodigostemas[$tema["codigo_tema"]]++; | |
| 46 | + } else { | |
| 47 | + $ncodigostemas[$tema["codigo_tema"]] = 1; | |
| 48 | + } | |
| 49 | + if(in_array($tema["nome_tema"],array_keys($nnomestemas))){ | |
| 50 | + $nnomestemas[$tema["nome_tema"]]++; | |
| 51 | + } else { | |
| 52 | + $nnomestemas[$tema["nome_tema"]] = 1; | |
| 53 | + } | |
| 54 | + | |
| 55 | 55 | if(strtolower($tema["download_tema"]) == "sim") |
| 56 | 56 | { |
| 57 | 57 | $ndownloadtemas++; |
| ... | ... | @@ -147,9 +147,9 @@ include "../../head.php"; |
| 147 | 147 | echo "<div class='well'><h4>Acesos por tema</h4><ul>"; |
| 148 | 148 | arsort($temasacessos); |
| 149 | 149 | $temasacessos2 = array_keys($temasacessos); |
| 150 | - for($i=0;$i<=count($temasacessos2);$i++){ | |
| 151 | - if(mb_detect_encoding($temasacessos2[$i],'UTF-8, ISO-8859-1') == "UTF-8"){ | |
| 152 | - echo "<li class='list-group-item'><label class='text-success'>".utf8_decode($temasacessos2[$i])." <span class='badge'> ".$temasacessos[$temasacessos2[$i]]."</span></li>"; | |
| 150 | + for($i=0;$i<count($temasacessos2);$i++){ | |
| 151 | + if(mb_detect_encoding($temasacessos2[$i],'UTF-8, ISO-8859-1') == "ISO-8859-1"){ | |
| 152 | + echo "<li class='list-group-item'><label class='text-success'>".utf8_encode($temasacessos2[$i])." <span class='badge'> ".$temasacessos[$temasacessos2[$i]]."</span></li>"; | |
| 153 | 153 | } |
| 154 | 154 | else{ |
| 155 | 155 | echo "<li class='list-group-item'><label class='text-success'>".$temasacessos2[$i]." <span class='badge'> ".$temasacessos[$temasacessos2[$i]]."</span></li>"; | ... | ... |
admin1/ferramentas/miniaturas/exec.php
| 1 | 1 | <?php |
| 2 | -include "index.php"; | |
| 2 | +// | |
| 3 | +//no caso do programa ser utilizado via URL | |
| 4 | +// | |
| 5 | +if(empty($_GET["tipo"])){ | |
| 6 | + exit; | |
| 7 | +} | |
| 3 | 8 | ?> |
| 4 | 9 | <div class="container"> |
| 5 | 10 | <div class="row center-block"> |
| ... | ... | @@ -12,42 +17,17 @@ include "index.php"; |
| 12 | 17 | // |
| 13 | 18 | //carrega o phpmapscript |
| 14 | 19 | // |
| 15 | - if (!function_exists('ms_GetVersion')){ | |
| 16 | - if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')){ | |
| 17 | - if(!@dl('php_mapscript_48.dll')) | |
| 18 | - dl('php_mapscript.dll'); | |
| 19 | - } | |
| 20 | - else{ | |
| 21 | - dl('php_mapscript.so'); | |
| 22 | - } | |
| 23 | - } | |
| 24 | - include_once (dirname(__FILE__)."/../../../admin/php/admin.php"); | |
| 25 | 20 | $versao = \admin\php\funcoesAdmin\versao(); |
| 26 | 21 | $versao = $versao["principal"]; |
| 27 | - // | |
| 28 | - //no caso do programa ser utilizado via URL | |
| 29 | - // | |
| 30 | - if(empty($tipo)){ | |
| 31 | - exit; | |
| 32 | - } | |
| 22 | + | |
| 23 | + $tipo = $_GET["tipo"]; | |
| 33 | 24 | if($tipo == "mini" || $tipo == "todos" || $tipo == "grande"){ |
| 34 | 25 | ms_ResetErrorList(); |
| 35 | - //verifica login | |
| 36 | - if(empty($_POST["senha"]) || empty($_POST["usuario"])){ | |
| 37 | - exit; | |
| 38 | - } | |
| 39 | - else{ | |
| 40 | - $continua = \admin\php\funcoesAdmin\verificaMaster($_POST["usuario"],$_POST["senha"],$i3geomaster); | |
| 41 | - if($continua === false){ | |
| 42 | - echo "<div class='alert alert-warning'>Usuário não registrado em i3geo/ms_configura.php na variável i3geomaster</div>"; | |
| 43 | - exit; | |
| 44 | - } | |
| 45 | - } | |
| 46 | 26 | if (ob_get_level() == 0){ |
| 47 | 27 | ob_start(); |
| 48 | 28 | } |
| 49 | 29 | error_reporting (E_ALL); |
| 50 | - $arqs = listaArquivos("../../../temas",true,array("map","gvp")); | |
| 30 | + $arqs = listaArquivos("../../../temas",true,array("map")); | |
| 51 | 31 | $arqs = $arqs["arquivos"]; |
| 52 | 32 | sort($arqs); |
| 53 | 33 | foreach ($arqs as $arq){ |
| ... | ... | @@ -67,8 +47,7 @@ include "index.php"; |
| 67 | 47 | } |
| 68 | 48 | echo "</div>"; |
| 69 | 49 | } |
| 70 | - ob_flush(); | |
| 71 | - flush(); | |
| 50 | + ob_flush(); flush(); sleep(2); | |
| 72 | 51 | } |
| 73 | 52 | ob_end_flush(); |
| 74 | 53 | } |
| ... | ... | @@ -162,7 +141,7 @@ function verificaMiniatura($map,$tipo,$admin=false) |
| 162 | 141 | else{ |
| 163 | 142 | $dados = $layern->data; |
| 164 | 143 | } |
| 165 | - $pegarext = $teman->name; | |
| 144 | + $pegarext = $layern->name; | |
| 166 | 145 | } |
| 167 | 146 | |
| 168 | 147 | if (isset($postgis_mapa)){ |
| ... | ... | @@ -187,18 +166,6 @@ function verificaMiniatura($map,$tipo,$admin=false) |
| 187 | 166 | } |
| 188 | 167 | zoomTemaMiniatura($pegarext,$mapa); |
| 189 | 168 | } |
| 190 | - if($extensao == ".gvp"){ | |
| 191 | - include_once($_SESSION["locaplic"]."/pacotes/gvsig/gvsig2mapfile/class.gvsig2mapfile.php"); | |
| 192 | - $gm = new gvsig2mapfile($tema); | |
| 193 | - $gvsigview = $gm->getViewsNames(); | |
| 194 | - foreach($gvsigview as $v){ | |
| 195 | - $dataView = $gm->getViewData($v); | |
| 196 | - $mapa = $gm->addLayers($mapa,$v,$dataView["layerNames"]); | |
| 197 | - } | |
| 198 | - $next = $dataView["extent"]; | |
| 199 | - $ext = $mapa->extent; | |
| 200 | - $ext->setextent($next[0],$next[1],$next[2],$next[3]); | |
| 201 | - } | |
| 202 | 169 | if ($tipo == "mini" || $tipo == "todos"){ |
| 203 | 170 | $mapa->setsize(50,50); |
| 204 | 171 | $sca = $mapa->scalebar; |
| ... | ... | @@ -304,5 +271,244 @@ function zoomTemaMiniatura($nomelayer,&$mapa) |
| 304 | 271 | $extatual->setextent($ret[0],$ret[1],$ret[2],$ret[3]); |
| 305 | 272 | } |
| 306 | 273 | } |
| 274 | +function listaArquivos($diretorio,$seguro=false,$permitido=array("png","PNG","jpg","JPG","tif","tiff","TIF","TIFF","shp","SHP","img")) | |
| 275 | +{ | |
| 276 | + $docroot = $_SERVER["DOCUMENT_ROOT"]; | |
| 277 | + if (!is_dir($diretorio)){ | |
| 278 | + $diretorio = "../".$diretorio; | |
| 279 | + } | |
| 280 | + if (is_dir($diretorio)){ | |
| 281 | + $dirs = array(); | |
| 282 | + $arqs = array(); | |
| 283 | + $nomes = array(); | |
| 284 | + $urls = array(); | |
| 285 | + $exts = array(); | |
| 286 | + $d = dir($diretorio); | |
| 287 | + while (($nd = $d->read()) != FALSE) | |
| 288 | + { | |
| 289 | + if ($nd != "." && $nd != ".."){ | |
| 290 | + $ext = explode(".",$nd); | |
| 291 | + if (count($ext)>1){ | |
| 292 | + if($seguro == true){ | |
| 293 | + $buscar = $ext[1]; | |
| 294 | + //$permitido = array("png","PNG","jpg","JPG","tif","tiff","TIF","TIFF","shp","SHP","img"); | |
| 295 | + if(in_array($buscar,$permitido)){ | |
| 296 | + $arqs[] = $nd; | |
| 297 | + $nomes[] = basename($nd); | |
| 298 | + $exts[] = $ext[1]; | |
| 299 | + $url = ""; | |
| 307 | 300 | |
| 301 | + if(strpos($diretorio,$docroot) === true || strpos($diretorio,$docroot) === 0){ | |
| 302 | + $url = str_replace($docroot,"",$diretorio."/".$nd); | |
| 303 | + } | |
| 304 | + $urls[] = $url; | |
| 305 | + } | |
| 306 | + } | |
| 307 | + else{ | |
| 308 | + $arqs[] = $nd; | |
| 309 | + $nomes[] = basename($nd); | |
| 310 | + $urls = ""; | |
| 311 | + $exts[] = $ext[1]; | |
| 312 | + } | |
| 313 | + } | |
| 314 | + if (count($ext)==1){ | |
| 315 | + $dirs[] = $nd; | |
| 316 | + } | |
| 317 | + } | |
| 318 | + } | |
| 319 | + sort($dirs); | |
| 320 | + return array("diretorios"=>$dirs,"arquivos"=>$arqs,"nomes"=>$nomes,"urls"=>$urls,"extensoes"=>$exts); | |
| 321 | + } | |
| 322 | + else | |
| 323 | + {return "erro";} | |
| 324 | +} | |
| 325 | +function cloneInlineSymbol($layern, $nmapa, $mapa) { | |
| 326 | + $numclasses = $layern->numclasses; | |
| 327 | + for($ci = 0; $ci < $numclasses; $ci ++) { | |
| 328 | + $classe = $layern->getclass ( $ci ); | |
| 329 | + $numestilos = $classe->numstyles; | |
| 330 | + for($ei = 0; $ei < $numestilos; $ei ++) { | |
| 331 | + $estilo = $classe->getstyle ( $ei ); | |
| 332 | + if ($estilo->symbolname != "") { | |
| 333 | + $nomesimbolo = $estilo->symbolname; | |
| 334 | + $simbolo = $nmapa->getSymbolObjectById ( $nmapa->getSymbolByName ( $nomesimbolo ) ); | |
| 335 | + if ($simbolo->inmapfile == MS_TRUE || file_exists ( $nomesimbolo )) { | |
| 336 | + $simbolon = new symbolObj ( $mapa, $nomesimbolo ); | |
| 337 | + $simbolon->set ( "inmapfile", MS_TRUE ); | |
| 338 | + | |
| 339 | + $simbolon->setImagePath ( $simbolo->imagepath ); | |
| 340 | + $simbolon->setPoints ( $simbolo->getPointsArray () ); | |
| 341 | + // $simbolon->setPattern($simbolo->getPatternArray()); | |
| 342 | + $simbolon->set ( "type", $simbolo->type ); | |
| 343 | + // $simbolon->set("antialias",$simbolo->antialias); | |
| 344 | + $simbolon->set ( "character", $simbolo->character ); | |
| 345 | + $simbolon->set ( "filled", $simbolo->filled ); | |
| 346 | + | |
| 347 | + // $simbolon->set("font",$simbolo->font); | |
| 348 | + // $simbolon->set("position",$simbolo->position); | |
| 349 | + $simbolon->set ( "sizex", $simbolo->sizex ); | |
| 350 | + $simbolon->set ( "sizey", $simbolo->sizey ); | |
| 351 | + $simbolon->set ( "transparent", $simbolo->transparent ); | |
| 352 | + $simbolon->set ( "transparentcolor", $simbolo->transparentcolor ); | |
| 353 | + // $simbolon->set("anchorpoint",$simbolo->anchorpoint); | |
| 354 | + } | |
| 355 | + } | |
| 356 | + } | |
| 357 | + } | |
| 358 | +} | |
| 359 | +function autoClasses(&$nlayer, $mapa, $locaplic = null) { | |
| 360 | + $postgis_mapa = $_SESSION ["postgis_mapa"]; | |
| 361 | + ; | |
| 362 | + $substituicon = "nao"; | |
| 363 | + if ($nlayer->connectiontype == MS_POSTGIS) { | |
| 364 | + if ($nlayer->connection == " ") { | |
| 365 | + $nlayer->set ( "connection", $postgis_mapa ); | |
| 366 | + $substituicon = "sim"; | |
| 367 | + } | |
| 368 | + } | |
| 369 | + // | |
| 370 | + // gera classes automaticamente (temas vetoriais) | |
| 371 | + if ($nlayer->getmetadata ( "classesitem" ) != "") { | |
| 372 | + $itemnome = $nlayer->getmetadata ( "classesnome" ); | |
| 373 | + $itemid = $nlayer->getmetadata ( "classesitem" ); | |
| 374 | + $itemcor = $nlayer->getmetadata ( "classescor" ); | |
| 375 | + $itemsimbolo = $nlayer->getmetadata ( "classesimbolo" ); | |
| 376 | + $itemtamanho = $nlayer->getmetadata ( "classestamanho" ); | |
| 377 | + $classeoriginal = $nlayer->getclass ( 0 ); | |
| 378 | + // | |
| 379 | + // pega a extensao geografica que devera ser utilizada | |
| 380 | + // | |
| 381 | + $prjMapa = $mapa->getProjection (); | |
| 382 | + $prjTema = $nlayer->getProjection (); | |
| 383 | + $ret = $nlayer->getmetadata ( "extensao" ); | |
| 384 | + if ($ret == "") { | |
| 385 | + $ret = $nlayer->getextent (); | |
| 386 | + // reprojeta o retangulo | |
| 387 | + if (($prjTema != "") && ($prjMapa != $prjTema)) { | |
| 388 | + $projInObj = ms_newprojectionobj ( $prjTema ); | |
| 389 | + $projOutObj = ms_newprojectionobj ( $prjMapa ); | |
| 390 | + $ret->project ( $projInObj, $projOutObj ); | |
| 391 | + } | |
| 392 | + } else { | |
| 393 | + $temp = explode ( " ", $ret ); | |
| 394 | + $ret = ms_newRectObj (); | |
| 395 | + $ret->setextent ( $temp [0], $temp [1], $temp [2], $temp [3] ); | |
| 396 | + } | |
| 397 | + // | |
| 398 | + $sopen = $nlayer->open (); | |
| 399 | + if ($sopen == MS_FAILURE) { | |
| 400 | + return "erro"; | |
| 401 | + } | |
| 402 | + | |
| 403 | + $status = $nlayer->whichShapes ( $ret ); | |
| 404 | + $parametrosClasses = array (); | |
| 405 | + if ($status == 0) { | |
| 406 | + while ( $shape = $nlayer->nextShape () ) { | |
| 407 | + $id = trim ( $shape->values [$itemid] ); | |
| 408 | + if (! $parametrosClasses [$id]) { | |
| 409 | + $nome = ""; | |
| 410 | + if ($itemnome != "") | |
| 411 | + $nome = trim ( $shape->values [$itemnome] ); | |
| 412 | + $cor = ""; | |
| 413 | + if ($itemcor != "") | |
| 414 | + $cor = explode ( ",", trim ( $shape->values [$itemcor] ) ); | |
| 415 | + if (count ( $cor ) != 3) | |
| 416 | + $cor = explode ( " ", trim ( $shape->values [$itemcor] ) ); | |
| 417 | + $tamanho = ""; | |
| 418 | + if ($itemtamanho != "") | |
| 419 | + $tamanho = trim ( $shape->values [$itemtamanho] ); | |
| 420 | + $simbolo = ""; | |
| 421 | + if ($itemsimbolo != "") | |
| 422 | + $simbolo = trim ( $shape->values [$itemsimbolo] ); | |
| 423 | + $parametrosClasses [$id] = array ( | |
| 424 | + "nome" => $nome, | |
| 425 | + "cor" => $cor, | |
| 426 | + "tamanho" => $tamanho, | |
| 427 | + "simbolo" => $simbolo | |
| 428 | + ); | |
| 429 | + } | |
| 430 | + } | |
| 431 | + $fechou = $nlayer->close (); | |
| 432 | + // echo "<pre>";var_dump($parametrosClasses); | |
| 433 | + if (count ( $parametrosClasses ) > 0) { | |
| 434 | + $ids = array_keys ( $parametrosClasses ); | |
| 435 | + for($i = 0; $i < count ( $parametrosClasses ); ++ $i) { | |
| 436 | + $p = $parametrosClasses [$ids [$i]]; | |
| 437 | + // echo "<pre>";var_dump($p); | |
| 438 | + $nclasse = ms_newClassObj ( $nlayer, $classeoriginal ); | |
| 439 | + if ($p ["nome"] != "") | |
| 440 | + $nclasse->set ( "name", $p ["nome"] ); | |
| 441 | + $estilo = $nclasse->getstyle ( 0 ); | |
| 442 | + if ($p ["cor"] != "") { | |
| 443 | + $cor = $p ["cor"]; | |
| 444 | + $ncor = $estilo->color; | |
| 445 | + if ($ncor == "") | |
| 446 | + $ncor = $estilo->outlinecolor; | |
| 447 | + $ncor->setrgb ( $cor [0], $cor [1], $cor [2] ); | |
| 448 | + } | |
| 449 | + if ($p ["tamanho"] != "") | |
| 450 | + $estilo->set ( "size", $p ["tamanho"] ); | |
| 451 | + if ($p ["simbolo"] != "") | |
| 452 | + $estilo->set ( "symbolname", $p ["simbolo"] ); | |
| 453 | + $strE = "('[" . $itemid . "]'eq'" . $ids [$i] . "')"; | |
| 454 | + $nclasse->setexpression ( $strE ); | |
| 455 | + } | |
| 456 | + $classeoriginal->set ( "status", MS_DELETE ); | |
| 457 | + } | |
| 458 | + } | |
| 459 | + if ($substituicon == "sim") { | |
| 460 | + $nlayer->set ( "connection", " " ); | |
| 461 | + } | |
| 462 | + } | |
| 463 | + $pf = $nlayer->getmetadata ( "palletefile" ); | |
| 464 | + if ($pf != "") { | |
| 465 | + if (! file_exists ( $pf )) { | |
| 466 | + return; | |
| 467 | + } | |
| 468 | + $ps = $nlayer->getmetadata ( "palletesteps" ); | |
| 469 | + if ($ps == "") | |
| 470 | + $ps = 8; | |
| 471 | + // | |
| 472 | + // pega os valores do arquivo | |
| 473 | + // | |
| 474 | + $rules = array (); | |
| 475 | + $abre = fopen ( $pf, "r" ); | |
| 476 | + $paletteRules = array (); | |
| 477 | + while ( ! feof ( $abre ) ) { | |
| 478 | + $line = trim ( fgets ( $abre ) ); | |
| 479 | + $pos = strpos ( $line, "#" ); | |
| 480 | + if ($pos === false || $pos > 0) { | |
| 481 | + $paletteEntry = explode ( " ", $line ); | |
| 482 | + $rules [] = array ( | |
| 483 | + "v0" => $paletteEntry [0], | |
| 484 | + "v1" => $paletteEntry [1], | |
| 485 | + "r0" => $paletteEntry [2], | |
| 486 | + "g0" => $paletteEntry [3], | |
| 487 | + "b0" => $paletteEntry [4], | |
| 488 | + "r1" => $paletteEntry [5], | |
| 489 | + "g1" => $paletteEntry [6], | |
| 490 | + "b1" => $paletteEntry [7] | |
| 491 | + ); | |
| 492 | + } | |
| 493 | + } | |
| 494 | + fclose ( $abre ); | |
| 495 | + foreach ( $rules as $rule ) { | |
| 496 | + $delta = ceil ( ($rule ["v1"] - $rule ["v0"]) / $ps ); | |
| 497 | + $legenda = true; | |
| 498 | + for($value = $rule ["v0"]; $value < $rule ["v1"]; $value += $delta) { | |
| 499 | + $class = ms_newClassObj ( $nlayer ); | |
| 500 | + $style = ms_newStyleObj ( $class ); | |
| 501 | + if ($legenda) { | |
| 502 | + $class->set ( name, round ( $value, 0 ) ); | |
| 503 | + $legenda = true; | |
| 504 | + } | |
| 505 | + $expression = "([pixel] > " . round ( $value, 0 ) . " AND [pixel] <= " . round ( $value + $delta, 0 ) . ")"; | |
| 506 | + $class->setExpression ( $expression ); | |
| 507 | + $rgb = getRGBpallete ( $rule, $value ); | |
| 508 | + $style->color->setRGB ( $rgb [0], $rgb [1], $rgb [2] ); | |
| 509 | + } | |
| 510 | + } | |
| 511 | + } | |
| 512 | + return; | |
| 513 | +} | |
| 308 | 514 | ?> | ... | ... |
admin1/ferramentas/miniaturas/index.php
| 1 | 1 | <?php |
| 2 | 2 | define ( "ONDEI3GEO", "../../.." ); |
| 3 | -include ("exec.php"); | |
| 4 | -//verifica se o login pode ser realizado | |
| 5 | -if(isset($i3geoPermiteLogin) && $i3geoPermiteLogin == false){ | |
| 6 | - header ( "HTTP/1.1 403 Login desativado" ); | |
| 3 | + | |
| 4 | +/****************************************************************/ | |
| 5 | +// | |
| 6 | +//checa login | |
| 7 | +//valida _GET e _POST, juntando em _GET | |
| 8 | +//pega algumas variaveis de uso mais comum | |
| 9 | +//session_start | |
| 10 | +// | |
| 11 | +include ("../../php/checaLogin.php"); | |
| 12 | +\admin\php\login\checaLogin(); | |
| 13 | +//funcoes de administracao | |
| 14 | +include ($_SESSION["locaplic"]."/admin1/php/funcoesAdmin.php"); | |
| 15 | +// | |
| 16 | +//carrega outras funcoes e extensoes do PHP | |
| 17 | +// | |
| 18 | +include ($_SESSION["locaplic"]."/classesphp/carrega_ext.php"); | |
| 19 | +// | |
| 20 | +//conexao com o banco de administracao | |
| 21 | +//cria as variaveis $dbh e $dbhw alem de conexaoadmin | |
| 22 | +// | |
| 23 | +include ($_SESSION["locaplic"]."/admin1/php/conexao.php"); | |
| 24 | +/***************************************************************/ | |
| 25 | +if (\admin\php\funcoesAdmin\verificaOperacaoSessao ( "admin/html/arvore" ) === false) { | |
| 26 | + header ( "HTTP/1.1 403 Vc nao pode realizar essa operacao" ); | |
| 7 | 27 | exit (); |
| 8 | 28 | } |
| 9 | - | |
| 10 | 29 | include "../../head.php"; |
| 11 | 30 | ?> |
| 12 | 31 | <div class="container-fluid migalha" > |
| ... | ... | @@ -29,8 +48,7 @@ include "../../head.php"; |
| 29 | 48 | <h4>O usuário e a senha devem estar cadastrados em i3geo/ms_configura.php</h4> |
| 30 | 49 | </div> |
| 31 | 50 | <div class="well"> |
| 32 | - <form class="form" role="form" method="post" action="exec.php"> | |
| 33 | - <?php include("../../templates/login.php");?> | |
| 51 | + <form class="form" role="form" method="post" action="index.php"> | |
| 34 | 52 | <div class="form-group"> |
| 35 | 53 | <div class="radio"> |
| 36 | 54 | <label> <input name="tipo" value="todos" type="radio" required>todas as miniaturas |
| ... | ... | @@ -77,6 +95,514 @@ include "../../head.php"; |
| 77 | 95 | t.removeClass('hidden'); |
| 78 | 96 | $.material.init(); |
| 79 | 97 | }); |
| 80 | - </script> | |
| 98 | +</script> | |
| 99 | +<?php | |
| 100 | +// | |
| 101 | +//no caso do programa ser utilizado via URL | |
| 102 | +// | |
| 103 | +if(empty($_POST["tipo"])){ | |
| 104 | + echo "</body></html>"; | |
| 105 | + exit; | |
| 106 | +} | |
| 107 | +?> | |
| 108 | +<div class="container"> | |
| 109 | + <div class="row center-block"> | |
| 110 | + <div class="col-sm-12"> | |
| 111 | + <div class="row"> | |
| 112 | + <div class="col-md-12"> | |
| 113 | + <div class="well"> | |
| 114 | + <?php | |
| 115 | + error_reporting (E_ALL); | |
| 116 | + $versao = \admin\php\funcoesAdmin\versao(); | |
| 117 | + $versao = $versao["principal"]; | |
| 118 | + | |
| 119 | + $tipo = $_POST["tipo"]; | |
| 120 | + if($tipo == "mini" || $tipo == "todos" || $tipo == "grande"){ | |
| 121 | + ms_ResetErrorList(); | |
| 122 | + if (ob_get_level() == 0){ | |
| 123 | + ob_start(); | |
| 124 | + } | |
| 125 | + error_reporting (E_ALL); | |
| 126 | + $arqs = listaArquivos("../../../temas",true,array("map")); | |
| 127 | + $arqs = $arqs["arquivos"]; | |
| 128 | + sort($arqs); | |
| 129 | + foreach ($arqs as $arq){ | |
| 130 | + $arq = str_replace(" ","xxxx",$arq); | |
| 131 | + $temp = explode(".",$arq); | |
| 132 | + if(file_exists($_SESSION["locaplic"].'/temas/'.$arq) && $temp[(count($temp) - 1)] == "map" ){ | |
| 133 | + echo "<div 'class=well'><h4>$arq</h4>"; | |
| 134 | + if($tipo == "mini" || $tipo == "todos"){ | |
| 135 | + if(!file_exists($_SESSION["locaplic"].'/temas/miniaturas/'.$arq.'.mini.png')){ | |
| 136 | + verificaMiniatura($arq,"mini"); | |
| 137 | + } | |
| 138 | + } | |
| 139 | + if($tipo == "grande" || $tipo == "todos"){ | |
| 140 | + if(!file_exists($_SESSION["locaplic"].'/temas/miniaturas/'.$arq.'.grande.png')){ | |
| 141 | + verificaMiniatura($arq,"grande"); | |
| 142 | + } | |
| 143 | + } | |
| 144 | + echo "</div>"; | |
| 145 | + } | |
| 146 | + ob_flush(); flush(); sleep(1); | |
| 147 | + } | |
| 148 | + ob_end_flush(); | |
| 149 | + } | |
| 150 | + ?> | |
| 151 | + </div> | |
| 152 | + </div> | |
| 153 | + </div> | |
| 154 | + </div> | |
| 155 | + </div> | |
| 156 | +</div> | |
| 81 | 157 | </body> |
| 82 | 158 | </html> |
| 159 | +<?php | |
| 160 | +// | |
| 161 | +//se tipo for igual a "admin", as imagens são gravadas em i3geo/temas/miniaturas | |
| 162 | +// | |
| 163 | +function verificaMiniatura($map,$tipo,$admin=false) | |
| 164 | +{ | |
| 165 | + global $versao,$base; | |
| 166 | + $postgis_mapa = $_SESSION["postgis_mapa"]; | |
| 167 | + $locaplic = $_SESSION["locaplic"]; | |
| 168 | + if($versao == ""){ | |
| 169 | + $versao = \admin\php\funcoesAdmin\versao(); | |
| 170 | + $versao = $versao["principal"]; | |
| 171 | + } | |
| 172 | + ms_ResetErrorList(); | |
| 173 | + $tema = ""; | |
| 174 | + $map = str_replace("\\","/",$map); | |
| 175 | + $map = basename($map); | |
| 176 | + $extensao = ".map"; | |
| 177 | + if (file_exists($_SESSION["locaplic"].'/temas/'.$map)){ | |
| 178 | + $tema = $_SESSION["locaplic"].'/temas/'.$map; | |
| 179 | + } | |
| 180 | + else{ | |
| 181 | + if (file_exists($_SESSION["locaplic"].'/temas/'.$map.'.gvp')){ | |
| 182 | + $extensao = ".gvp"; | |
| 183 | + } | |
| 184 | + $tema = $_SESSION["locaplic"].'/temas/'.$map.$extensao; | |
| 185 | + } | |
| 186 | + if ($tema != ""){ | |
| 187 | + if(isset($base) && $base != ""){ | |
| 188 | + if(file_exists($base)) | |
| 189 | + {$f = $base;} | |
| 190 | + else | |
| 191 | + {$f = $_SESSION["locaplic"]."/aplicmap/".$base.".map";} | |
| 192 | + if(!file_exists($base)){ | |
| 193 | + echo "<div class='alert alert-danger'>ARQUIVO $base NÂO FOI ENCONTRADO. CORRIJA ISSO EM ms_configura.php"; | |
| 194 | + exit; | |
| 195 | + } | |
| 196 | + } | |
| 197 | + else{ | |
| 198 | + $f = ""; | |
| 199 | + if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')){ | |
| 200 | + $f = $_SESSION["locaplic"]."/aplicmap/geral1windowsv".$versao.".map"; | |
| 201 | + } | |
| 202 | + else{ | |
| 203 | + if($f == "" && file_exists('/var/www/i3geo/aplicmap/geral1debianv'.$versao.'.map')){ | |
| 204 | + $f = "/var/www/i3geo/aplicmap/geral1debianv".$versao.".map"; | |
| 205 | + } | |
| 206 | + if($f == "" && file_exists('/var/www/html/i3geo/aplicmap/geral1fedorav'.$versao.'.map')){ | |
| 207 | + $f = "/var/www/html/i3geo/aplicmap/geral1fedorav".$versao.".map"; | |
| 208 | + } | |
| 209 | + if($f == "" && file_exists('/opt/www/html/i3geo/aplicmap/geral1fedorav'.$versao.'.map')){ | |
| 210 | + $f = "/opt/www/html/i3geo/aplicmap/geral1v".$versao.".map"; | |
| 211 | + } | |
| 212 | + if($f == ""){ | |
| 213 | + $f = $_SESSION["locaplic"]."/aplicmap/geral1v".$versao.".map"; | |
| 214 | + } | |
| 215 | + } | |
| 216 | + } | |
| 217 | + $mapa = ms_newMapObj($f); | |
| 218 | + if($extensao == ".map"){ | |
| 219 | + if(@ms_newMapObj($tema)){ | |
| 220 | + $nmapa = ms_newMapObj($tema); | |
| 221 | + } | |
| 222 | + else{ | |
| 223 | + echo "<div class='alert alert-danger'>erro no arquivo $tema </div>"; | |
| 224 | + return; | |
| 225 | + } | |
| 226 | + $dados = ""; | |
| 227 | + $numlayers = $nmapa->numlayers; | |
| 228 | + for ($i=0;$i < $numlayers;$i++){ | |
| 229 | + $layern = $nmapa->getlayer($i); | |
| 230 | + $layern->set("status",MS_DEFAULT); | |
| 231 | + cloneInlineSymbol($layern,$nmapa,$mapa); | |
| 232 | + ms_newLayerObj($mapa, $layern); | |
| 233 | + autoClasses($layern,$mapa,$_SESSION["locaplic"]); | |
| 234 | + if ($layern->data == ""){ | |
| 235 | + $dados = $layern->connection; | |
| 236 | + } | |
| 237 | + else{ | |
| 238 | + $dados = $layern->data; | |
| 239 | + } | |
| 240 | + $pegarext = $layern->name; | |
| 241 | + } | |
| 242 | + if (isset($postgis_mapa)){ | |
| 243 | + if ($postgis_mapa != ""){ | |
| 244 | + $numlayers = $mapa->numlayers; | |
| 245 | + for ($i=0;$i < $numlayers;$i++){ | |
| 246 | + $layern = $mapa->getlayer($i); | |
| 247 | + if (!empty($postgis_mapa)){ | |
| 248 | + if ($layern->connectiontype == MS_POSTGIS){ | |
| 249 | + $lcon = $layern->connection; | |
| 250 | + if (($lcon == " ") || ($lcon == "") || (in_array($lcon,array_keys($postgis_mapa)))){ | |
| 251 | + if(($lcon == " ") || ($lcon == "")) //para efeitos de compatibilidade | |
| 252 | + {$layern->set("connection",$postgis_mapa);} | |
| 253 | + else{ | |
| 254 | + $layern->set("connection",$postgis_mapa[$lcon]); | |
| 255 | + } | |
| 256 | + } | |
| 257 | + } | |
| 258 | + } | |
| 259 | + } | |
| 260 | + } | |
| 261 | + } | |
| 262 | + //zoomTemaMiniatura($pegarext,$mapa); | |
| 263 | + } | |
| 264 | + if ($tipo == "mini" || $tipo == "todos"){ | |
| 265 | + $mapa->setsize(50,50); | |
| 266 | + $sca = $mapa->scalebar; | |
| 267 | + $sca->set("status",MS_OFF); | |
| 268 | + $objImagemM = @$mapa->draw(); | |
| 269 | + //if ($objImagemM == "" || $objImagemM == MS_FAILURE) | |
| 270 | + //{echo "Problemas ao gerar o mapa<br>";return;} | |
| 271 | + $weboM = $mapa->web; | |
| 272 | + $urlM = $weboM->imageurl."/".$map; | |
| 273 | + } | |
| 274 | + if ($tipo == "grande" || $tipo == "todos"){ | |
| 275 | + $mapa->setsize(300,300); | |
| 276 | + $sca = $mapa->scalebar; | |
| 277 | + $sca->set("status",MS_OFF); | |
| 278 | + $objImagemG = @$mapa->draw(); | |
| 279 | + $weboG = $mapa->web; | |
| 280 | + $urlG = $weboG->imageurl."/".$map; | |
| 281 | + } | |
| 282 | + if($tipo=="mini" || $tipo == "todos"){ | |
| 283 | + if (!$objImagemM){ | |
| 284 | + echo "Problemas ao gerar o mapa<br>"; | |
| 285 | + $error = ""; | |
| 286 | + $error = ms_GetErrorObj(); | |
| 287 | + while($error && $error->code != MS_NOERR){ | |
| 288 | + echo "<div class='alert alert-danger'>Error in %s: %s</div>", $error->routine, $error->message; | |
| 289 | + $error = $error->next(); | |
| 290 | + } | |
| 291 | + return; | |
| 292 | + } | |
| 293 | + if($objImagemM->imagepath == ""){ | |
| 294 | + echo "<div class='alert alert-danger'>Erro IMAGEPATH vazio</div>";return; | |
| 295 | + } | |
| 296 | + $nomecM = ($objImagemM->imagepath).$map.".mini.png"; | |
| 297 | + $objImagemM->saveImage($nomecM); | |
| 298 | + } | |
| 299 | + if($tipo=="grande" || $tipo == "todos"){ | |
| 300 | + if (!$objImagemG){ | |
| 301 | + echo "<div class='alert alert-danger'>Problemas ao gerar o mapa</div>"; | |
| 302 | + $error = ""; | |
| 303 | + $error = ms_GetErrorObj(); | |
| 304 | + while($error && $error->code != MS_NOERR){ | |
| 305 | + echo "<div class='alert alert-danger'>Error in %s: %s</div>", $error->routine, $error->message; | |
| 306 | + $error = $error->next(); | |
| 307 | + } | |
| 308 | + return; | |
| 309 | + } | |
| 310 | + if($objImagemG->imagepath == ""){ | |
| 311 | + echo "<div class='alert alert-danger'>Erro IMAGEPATH vazio</div>";return; | |
| 312 | + } | |
| 313 | + $nomecG = ($objImagemG->imagepath).$map.".grande.png"; | |
| 314 | + $objImagemG->saveImage($nomecG); | |
| 315 | + } | |
| 316 | + if($admin === false){ | |
| 317 | + if($tipo=="mini" || $tipo == "todos") | |
| 318 | + {echo "<img class='img-thumbnail' src='".$urlM.".mini.png' />";} | |
| 319 | + if($tipo=="grande" || $tipo == "todos") | |
| 320 | + {echo "<img class='img-thumbnail' src='".$urlG.".grande.png' />";} | |
| 321 | + } | |
| 322 | + // | |
| 323 | + //copia a imagem | |
| 324 | + // | |
| 325 | + if($admin === true){ | |
| 326 | + $dir = $_SESSION["locaplic"]."/temas/miniaturas"; | |
| 327 | + $mini = $dir."/".$map.".map.mini.png"; | |
| 328 | + $grande = $dir."/".$map.".map.grande.png"; | |
| 329 | + if(file_exists($mini)) | |
| 330 | + {unlink($mini);} | |
| 331 | + if(file_exists($grande)) | |
| 332 | + {unlink($grande);} | |
| 333 | + copy(($objImagemG->imagepath).$map.".grande.png",$grande); | |
| 334 | + copy(($objImagemM->imagepath).$map.".mini.png",$mini); | |
| 335 | + } | |
| 336 | + } | |
| 337 | +} | |
| 338 | +function zoomTemaMiniatura($nomelayer,&$mapa) | |
| 339 | +{ | |
| 340 | + $layer = $mapa->getlayerbyname($nomelayer); | |
| 341 | + if($layer->data == "" && $layer->connection == "") | |
| 342 | + {return;} | |
| 343 | + $prjMapa = $mapa->getProjection(); | |
| 344 | + $prjTema = $layer->getProjection(); | |
| 345 | + $extatual = $mapa->extent; | |
| 346 | + $ret = $layer->getmetadata("extensao"); | |
| 347 | + if($layer->type > 2 && $ret == "") | |
| 348 | + {return;} | |
| 349 | + $ct = $layer->connectiontype; | |
| 350 | + if(($ret == "") && ($ct != 1)) | |
| 351 | + {return;} | |
| 352 | + if ($ret == ""){ | |
| 353 | + $ret = $layer->getextent(); | |
| 354 | + //reprojeta o retangulo | |
| 355 | + if (($prjTema != "") && ($prjMapa != $prjTema)){ | |
| 356 | + $projInObj = ms_newprojectionobj($prjTema); | |
| 357 | + $projOutObj = ms_newprojectionobj($prjMapa); | |
| 358 | + $ret->project($projInObj, $projOutObj); | |
| 359 | + } | |
| 360 | + $extatual->setextent($ret->minx,$ret->miny,$ret->maxx,$ret->maxy); | |
| 361 | + } | |
| 362 | + else{ | |
| 363 | + $ret = explode(" ",$ret); | |
| 364 | + $extatual->setextent($ret[0],$ret[1],$ret[2],$ret[3]); | |
| 365 | + } | |
| 366 | +} | |
| 367 | +function listaArquivos($diretorio,$seguro=false,$permitido="") | |
| 368 | +{ | |
| 369 | + $docroot = $_SERVER["DOCUMENT_ROOT"]; | |
| 370 | + if (!is_dir($diretorio)){ | |
| 371 | + $diretorio = "../".$diretorio; | |
| 372 | + } | |
| 373 | + if (is_dir($diretorio)){ | |
| 374 | + $dirs = array(); | |
| 375 | + $arqs = array(); | |
| 376 | + $nomes = array(); | |
| 377 | + $urls = array(); | |
| 378 | + $exts = array(); | |
| 379 | + $d = dir($diretorio); | |
| 380 | + while (($nd = $d->read()) != FALSE) | |
| 381 | + { | |
| 382 | + if ($nd != "." && $nd != ".."){ | |
| 383 | + $ext = explode(".",$nd); | |
| 384 | + if (count($ext)>1){ | |
| 385 | + if($seguro == true){ | |
| 386 | + $buscar = $ext[1]; | |
| 387 | + //$permitido = array("png","PNG","jpg","JPG","tif","tiff","TIF","TIFF","shp","SHP","img"); | |
| 388 | + if(in_array($buscar,$permitido)){ | |
| 389 | + $arqs[] = $nd; | |
| 390 | + $nomes[] = basename($nd); | |
| 391 | + $exts[] = $ext[1]; | |
| 392 | + $url = ""; | |
| 393 | + | |
| 394 | + if(strpos($diretorio,$docroot) === true || strpos($diretorio,$docroot) === 0){ | |
| 395 | + $url = str_replace($docroot,"",$diretorio."/".$nd); | |
| 396 | + } | |
| 397 | + $urls[] = $url; | |
| 398 | + } | |
| 399 | + } | |
| 400 | + else{ | |
| 401 | + $arqs[] = $nd; | |
| 402 | + $nomes[] = basename($nd); | |
| 403 | + $urls = ""; | |
| 404 | + $exts[] = $ext[1]; | |
| 405 | + } | |
| 406 | + } | |
| 407 | + if (count($ext)==1){ | |
| 408 | + $dirs[] = $nd; | |
| 409 | + } | |
| 410 | + } | |
| 411 | + } | |
| 412 | + sort($dirs); | |
| 413 | + return array("diretorios"=>$dirs,"arquivos"=>$arqs,"nomes"=>$nomes,"urls"=>$urls,"extensoes"=>$exts); | |
| 414 | + } | |
| 415 | + else | |
| 416 | + {return "erro";} | |
| 417 | +} | |
| 418 | +function cloneInlineSymbol($layern, $nmapa, $mapa) { | |
| 419 | + $numclasses = $layern->numclasses; | |
| 420 | + for($ci = 0; $ci < $numclasses; $ci ++) { | |
| 421 | + $classe = $layern->getclass ( $ci ); | |
| 422 | + $numestilos = $classe->numstyles; | |
| 423 | + for($ei = 0; $ei < $numestilos; $ei ++) { | |
| 424 | + $estilo = $classe->getstyle ( $ei ); | |
| 425 | + if ($estilo->symbolname != "") { | |
| 426 | + $nomesimbolo = $estilo->symbolname; | |
| 427 | + $simbolo = $nmapa->getSymbolObjectById ( $nmapa->getSymbolByName ( $nomesimbolo ) ); | |
| 428 | + if ($simbolo->inmapfile == MS_TRUE || file_exists ( $nomesimbolo )) { | |
| 429 | + $simbolon = new symbolObj ( $mapa, $nomesimbolo ); | |
| 430 | + $simbolon->set ( "inmapfile", MS_TRUE ); | |
| 431 | + | |
| 432 | + $simbolon->setImagePath ( $simbolo->imagepath ); | |
| 433 | + $simbolon->setPoints ( $simbolo->getPointsArray () ); | |
| 434 | + // $simbolon->setPattern($simbolo->getPatternArray()); | |
| 435 | + $simbolon->set ( "type", $simbolo->type ); | |
| 436 | + // $simbolon->set("antialias",$simbolo->antialias); | |
| 437 | + $simbolon->set ( "character", $simbolo->character ); | |
| 438 | + $simbolon->set ( "filled", $simbolo->filled ); | |
| 439 | + | |
| 440 | + // $simbolon->set("font",$simbolo->font); | |
| 441 | + // $simbolon->set("position",$simbolo->position); | |
| 442 | + $simbolon->set ( "sizex", $simbolo->sizex ); | |
| 443 | + $simbolon->set ( "sizey", $simbolo->sizey ); | |
| 444 | + $simbolon->set ( "transparent", $simbolo->transparent ); | |
| 445 | + $simbolon->set ( "transparentcolor", $simbolo->transparentcolor ); | |
| 446 | + // $simbolon->set("anchorpoint",$simbolo->anchorpoint); | |
| 447 | + } | |
| 448 | + } | |
| 449 | + } | |
| 450 | + } | |
| 451 | +} | |
| 452 | +function autoClasses(&$nlayer, $mapa, $locaplic = null) { | |
| 453 | + $postgis_mapa = $_SESSION ["postgis_mapa"]; | |
| 454 | + ; | |
| 455 | + $substituicon = "nao"; | |
| 456 | + if ($nlayer->connectiontype == MS_POSTGIS) { | |
| 457 | + if ($nlayer->connection == " ") { | |
| 458 | + $nlayer->set ( "connection", $postgis_mapa ); | |
| 459 | + $substituicon = "sim"; | |
| 460 | + } | |
| 461 | + } | |
| 462 | + // | |
| 463 | + // gera classes automaticamente (temas vetoriais) | |
| 464 | + if ($nlayer->getmetadata ( "classesitem" ) != "") { | |
| 465 | + $itemnome = $nlayer->getmetadata ( "classesnome" ); | |
| 466 | + $itemid = $nlayer->getmetadata ( "classesitem" ); | |
| 467 | + $itemcor = $nlayer->getmetadata ( "classescor" ); | |
| 468 | + $itemsimbolo = $nlayer->getmetadata ( "classesimbolo" ); | |
| 469 | + $itemtamanho = $nlayer->getmetadata ( "classestamanho" ); | |
| 470 | + $classeoriginal = $nlayer->getclass ( 0 ); | |
| 471 | + // | |
| 472 | + // pega a extensao geografica que devera ser utilizada | |
| 473 | + // | |
| 474 | + $prjMapa = $mapa->getProjection (); | |
| 475 | + $prjTema = $nlayer->getProjection (); | |
| 476 | + $ret = $nlayer->getmetadata ( "extensao" ); | |
| 477 | + if ($ret == "") { | |
| 478 | + $ret = $nlayer->getextent (); | |
| 479 | + // reprojeta o retangulo | |
| 480 | + if (($prjTema != "") && ($prjMapa != $prjTema)) { | |
| 481 | + $projInObj = ms_newprojectionobj ( $prjTema ); | |
| 482 | + $projOutObj = ms_newprojectionobj ( $prjMapa ); | |
| 483 | + $ret->project ( $projInObj, $projOutObj ); | |
| 484 | + } | |
| 485 | + } else { | |
| 486 | + $temp = explode ( " ", $ret ); | |
| 487 | + $ret = ms_newRectObj (); | |
| 488 | + $ret->setextent ( $temp [0], $temp [1], $temp [2], $temp [3] ); | |
| 489 | + } | |
| 490 | + // | |
| 491 | + $sopen = $nlayer->open (); | |
| 492 | + if ($sopen == MS_FAILURE) { | |
| 493 | + return "erro"; | |
| 494 | + } | |
| 495 | + | |
| 496 | + $status = $nlayer->whichShapes ( $ret ); | |
| 497 | + $parametrosClasses = array (); | |
| 498 | + if ($status == 0) { | |
| 499 | + while ( $shape = $nlayer->nextShape () ) { | |
| 500 | + $id = trim ( $shape->values [$itemid] ); | |
| 501 | + if (! $parametrosClasses [$id]) { | |
| 502 | + $nome = ""; | |
| 503 | + if ($itemnome != "") | |
| 504 | + $nome = trim ( $shape->values [$itemnome] ); | |
| 505 | + $cor = ""; | |
| 506 | + if ($itemcor != "") | |
| 507 | + $cor = explode ( ",", trim ( $shape->values [$itemcor] ) ); | |
| 508 | + if (count ( $cor ) != 3) | |
| 509 | + $cor = explode ( " ", trim ( $shape->values [$itemcor] ) ); | |
| 510 | + $tamanho = ""; | |
| 511 | + if ($itemtamanho != "") | |
| 512 | + $tamanho = trim ( $shape->values [$itemtamanho] ); | |
| 513 | + $simbolo = ""; | |
| 514 | + if ($itemsimbolo != "") | |
| 515 | + $simbolo = trim ( $shape->values [$itemsimbolo] ); | |
| 516 | + $parametrosClasses [$id] = array ( | |
| 517 | + "nome" => $nome, | |
| 518 | + "cor" => $cor, | |
| 519 | + "tamanho" => $tamanho, | |
| 520 | + "simbolo" => $simbolo | |
| 521 | + ); | |
| 522 | + } | |
| 523 | + } | |
| 524 | + $fechou = $nlayer->close (); | |
| 525 | + // echo "<pre>";var_dump($parametrosClasses); | |
| 526 | + if (count ( $parametrosClasses ) > 0) { | |
| 527 | + $ids = array_keys ( $parametrosClasses ); | |
| 528 | + for($i = 0; $i < count ( $parametrosClasses ); ++ $i) { | |
| 529 | + $p = $parametrosClasses [$ids [$i]]; | |
| 530 | + // echo "<pre>";var_dump($p); | |
| 531 | + $nclasse = ms_newClassObj ( $nlayer, $classeoriginal ); | |
| 532 | + if ($p ["nome"] != "") | |
| 533 | + $nclasse->set ( "name", $p ["nome"] ); | |
| 534 | + $estilo = $nclasse->getstyle ( 0 ); | |
| 535 | + if ($p ["cor"] != "") { | |
| 536 | + $cor = $p ["cor"]; | |
| 537 | + $ncor = $estilo->color; | |
| 538 | + if ($ncor == "") | |
| 539 | + $ncor = $estilo->outlinecolor; | |
| 540 | + $ncor->setrgb ( $cor [0], $cor [1], $cor [2] ); | |
| 541 | + } | |
| 542 | + if ($p ["tamanho"] != "") | |
| 543 | + $estilo->set ( "size", $p ["tamanho"] ); | |
| 544 | + if ($p ["simbolo"] != "") | |
| 545 | + $estilo->set ( "symbolname", $p ["simbolo"] ); | |
| 546 | + $strE = "('[" . $itemid . "]'eq'" . $ids [$i] . "')"; | |
| 547 | + $nclasse->setexpression ( $strE ); | |
| 548 | + } | |
| 549 | + $classeoriginal->set ( "status", MS_DELETE ); | |
| 550 | + } | |
| 551 | + } | |
| 552 | + if ($substituicon == "sim") { | |
| 553 | + $nlayer->set ( "connection", " " ); | |
| 554 | + } | |
| 555 | + } | |
| 556 | + $pf = $nlayer->getmetadata ( "palletefile" ); | |
| 557 | + if ($pf != "") { | |
| 558 | + if (! file_exists ( $pf )) { | |
| 559 | + return; | |
| 560 | + } | |
| 561 | + $ps = $nlayer->getmetadata ( "palletesteps" ); | |
| 562 | + if ($ps == "") | |
| 563 | + $ps = 8; | |
| 564 | + // | |
| 565 | + // pega os valores do arquivo | |
| 566 | + // | |
| 567 | + $rules = array (); | |
| 568 | + $abre = fopen ( $pf, "r" ); | |
| 569 | + $paletteRules = array (); | |
| 570 | + while ( ! feof ( $abre ) ) { | |
| 571 | + $line = trim ( fgets ( $abre ) ); | |
| 572 | + $pos = strpos ( $line, "#" ); | |
| 573 | + if ($pos === false || $pos > 0) { | |
| 574 | + $paletteEntry = explode ( " ", $line ); | |
| 575 | + $rules [] = array ( | |
| 576 | + "v0" => $paletteEntry [0], | |
| 577 | + "v1" => $paletteEntry [1], | |
| 578 | + "r0" => $paletteEntry [2], | |
| 579 | + "g0" => $paletteEntry [3], | |
| 580 | + "b0" => $paletteEntry [4], | |
| 581 | + "r1" => $paletteEntry [5], | |
| 582 | + "g1" => $paletteEntry [6], | |
| 583 | + "b1" => $paletteEntry [7] | |
| 584 | + ); | |
| 585 | + } | |
| 586 | + } | |
| 587 | + fclose ( $abre ); | |
| 588 | + foreach ( $rules as $rule ) { | |
| 589 | + $delta = ceil ( ($rule ["v1"] - $rule ["v0"]) / $ps ); | |
| 590 | + $legenda = true; | |
| 591 | + for($value = $rule ["v0"]; $value < $rule ["v1"]; $value += $delta) { | |
| 592 | + $class = ms_newClassObj ( $nlayer ); | |
| 593 | + $style = ms_newStyleObj ( $class ); | |
| 594 | + if ($legenda) { | |
| 595 | + $class->set ( name, round ( $value, 0 ) ); | |
| 596 | + $legenda = true; | |
| 597 | + } | |
| 598 | + $expression = "([pixel] > " . round ( $value, 0 ) . " AND [pixel] <= " . round ( $value + $delta, 0 ) . ")"; | |
| 599 | + $class->setExpression ( $expression ); | |
| 600 | + $rgb = getRGBpallete ( $rule, $value ); | |
| 601 | + $style->color->setRGB ( $rgb [0], $rgb [1], $rgb [2] ); | |
| 602 | + } | |
| 603 | + } | |
| 604 | + } | |
| 605 | + return; | |
| 606 | +} | |
| 607 | +?> | |
| 608 | + | ... | ... |
admin1/menu.js
| ... | ... | @@ -67,8 +67,6 @@ menuPrincipal = [ |
| 67 | 67 | html: "<a href='" + i3GEO.configura.locaplic + "/admin1/upload/shp2pg/index.php' >"+$trad("shp2pg",i3GEOadmin.menup.dicionario)+"</a>" |
| 68 | 68 | },{ |
| 69 | 69 | html: "<a href='" + i3GEO.configura.locaplic + "/admin1/upload/csv2pg/index.php' >"+$trad("csv2pg",i3GEOadmin.menup.dicionario)+"</a>" |
| 70 | - },{ | |
| 71 | - html: "<a href='" + i3GEO.configura.locaplic + "/admin1/upload/simbolo/index.php' >"+$trad("uploadSimbolo",i3GEOadmin.menup.dicionario)+"</a>" | |
| 72 | 70 | } |
| 73 | 71 | ]},{ |
| 74 | 72 | html: $trad("editaMapfile",i3GEOadmin.menup.dicionario), | ... | ... |