Commit a53338dc1138fa3edf23c39fe12bd20f1dd8e870
1 parent
6af0c999
Exists in
master
and in
7 other branches
Remoção da biblioteca class.CSVHandler
Showing
10 changed files
with
457 additions
and
322 deletions
Show diff stats
admin/html/admin.css
... | ... | @@ -134,6 +134,15 @@ input { |
134 | 134 | height: 20px; |
135 | 135 | } |
136 | 136 | |
137 | +.download { | |
138 | + background-image: URL('../imagens/download.png'); | |
139 | + background-repeat: no-repeat; | |
140 | + background-position: 0px 0px; | |
141 | + cursor: pointer; | |
142 | + width: 20px; | |
143 | + height: 20px; | |
144 | +} | |
145 | + | |
137 | 146 | .sobe { |
138 | 147 | background-image: URL('../imagens/34.png'); |
139 | 148 | background-repeat: no-repeat; | ... | ... |
890 Bytes
admin/js/estat_tipo_regiao.js
... | ... | @@ -54,8 +54,12 @@ function montaTabela(dados){ |
54 | 54 | formatRel = function(elCell, oRecord, oColumn){ |
55 | 55 | elCell.innerHTML = "<div class=editar style='text-align:center' ></div>"; |
56 | 56 | }, |
57 | + formatShp = function(elCell, oRecord, oColumn){ | |
58 | + elCell.innerHTML = "<div class=download style='text-align:center' ></div>"; | |
59 | + }, | |
57 | 60 | myColumnDefs = [ |
58 | 61 | {key:"excluir",label:"excluir",formatter:formatExclui}, |
62 | + {key:"shapefile",label:"shapefile",formatter:formatShp}, | |
59 | 63 | {key:"rel",label:"agregações",formatter:formatRel}, |
60 | 64 | {key:"mais",label:"editar",formatter:formatMais}, |
61 | 65 | {label:"código",key:"codigo_tipo_regiao", formatter:formatTexto}, |
... | ... | @@ -119,6 +123,13 @@ function montaTabela(dados){ |
119 | 123 | $recordid = record.getId(); |
120 | 124 | pegaDadosAgregacoes(record.getData('codigo_tipo_regiao')); |
121 | 125 | } |
126 | + if (column.key == 'shapefile'){ | |
127 | + if(window.confirm("Confirma o download?")){ | |
128 | + record = this.getRecord(target); | |
129 | + sUrl = "../php/metaestat.php?funcao=regiao2shp&codigo_tipo_regiao="+record.getData('codigo_tipo_regiao'); | |
130 | + window.open(sUrl,"blank"); | |
131 | + } | |
132 | + } | |
122 | 133 | } |
123 | 134 | ); |
124 | 135 | }; | ... | ... |
admin/php/classe_metaestat.php
... | ... | @@ -1479,6 +1479,27 @@ class Metaestat{ |
1479 | 1479 | $sql .= "ORDER BY nome"; |
1480 | 1480 | return $this->execSQL($sql,$codigo_tipo_periodo); |
1481 | 1481 | } |
1482 | + /* | |
1483 | + Function: listaDimensaoRegiao | |
1484 | + | |
1485 | + Lista a dimensao de uma tabela contendo as regioes | |
1486 | + | |
1487 | + */ | |
1488 | + function listaPropGeoRegiao($codigo_tipo_regiao){ | |
1489 | + //st_dimension returns 0 for POINT, 1 for LINESTRING, 2 for POLYGON | |
1490 | + $regiao = $this->listaTipoRegiao($codigo_tipo_regiao); | |
1491 | + $c = $this->listaConexao($regiao["codigo_estat_conexao"],true); | |
1492 | + $dbh = new PDO('pgsql:dbname='.$c["bancodedados"].';user='.$c["usuario"].';password='.$c["senha"].';host='.$c["host"].';port='.$c["porta"]); | |
1493 | + $c = $regiao["colunageo"]; | |
1494 | + $sql = "select st_dimension(".$regiao["colunageo"].") as st_dimension from ".$regiao["esquemadb"].".".$regiao["tabela"]." limit 1"; | |
1495 | + $q = $dbh->query($sql,PDO::FETCH_ASSOC); | |
1496 | + $r = array(); | |
1497 | + if($q){ | |
1498 | + $r = $q->fetchAll(); | |
1499 | + $r = $r[0]; | |
1500 | + } | |
1501 | + return $r; | |
1502 | + } | |
1482 | 1503 | /* |
1483 | 1504 | Function: listaTipoRegiao |
1484 | 1505 | |
... | ... | @@ -1614,17 +1635,18 @@ class Metaestat{ |
1614 | 1635 | function obtemDadosTabelaDB($codigo_estat_conexao,$nome_esquema,$nome_tabela,$geo="nao"){ |
1615 | 1636 | $desccolunas = $this->descreveColunasTabela($codigo_estat_conexao, $nome_esquema, $nome_tabela); |
1616 | 1637 | $colunas = array(); |
1638 | + $colsql = array(); | |
1617 | 1639 | foreach($desccolunas as $d){ |
1618 | - if($geo == "sim"){ | |
1640 | + if($d["type"] != "geometry" && $d["type"] != "geography"){ | |
1619 | 1641 | $colunas[] = $d["field"]; |
1642 | + $colsql[] = $d["field"]; | |
1620 | 1643 | } |
1621 | - else{ | |
1622 | - if($d["type"] != "geometry" && $d["type"] != "geography"){ | |
1623 | - $colunas[] = $d["field"]; | |
1624 | - } | |
1644 | + elseif($geo == "sim"){ | |
1645 | + $colunas[] = $d["field"]; | |
1646 | + $colsql[] = "ST_AsText(".$d["field"].") as ".$d["field"]; | |
1625 | 1647 | } |
1626 | 1648 | } |
1627 | - $dados = $this->execSQLDB($codigo_estat_conexao,"SELECT ".implode(",",$colunas)." from ".$nome_esquema.".".$nome_tabela ); | |
1649 | + $dados = $this->execSQLDB($codigo_estat_conexao,"SELECT ".implode(",",$colsql)." from ".$nome_esquema.".".$nome_tabela ); | |
1628 | 1650 | $linhas = array(); |
1629 | 1651 | foreach($dados as $d){ |
1630 | 1652 | $l = array(); |
... | ... | @@ -2089,5 +2111,83 @@ class Metaestat{ |
2089 | 2111 | } |
2090 | 2112 | return array("ok"); |
2091 | 2113 | } |
2114 | + function regiao2shp($codigo_tipo_regiao){ | |
2115 | + $regiao = $this->listaTipoRegiao($codigo_tipo_regiao); | |
2116 | + $dados = $this->obtemDadosTabelaDB($regiao["codigo_estat_conexao"],$regiao["esquemadb"],$regiao["tabela"],"sim"); | |
2117 | + $tipol = $this->listaPropGeoRegiao($codigo_tipo_regiao); | |
2118 | + include_once(__DIR__."/../../classesphp/classe_shp.php"); | |
2119 | + $s = new SHP(); | |
2120 | + //st_dimension returns 0 for POINT, 1 for LINESTRING, 2 for POLYGON | |
2121 | + //echo MS_SHP_POINT.", ".MS_SHP_ARC.", ".MS_SHP_POLYGON.", ".MS_SHP_MULTIPOINT; | |
2122 | + //1, 3, 5, 8 | |
2123 | + $conv[0] = 1; | |
2124 | + $conv[1] = 3; | |
2125 | + $conv[2] = 5; | |
2126 | + //cria as colunas | |
2127 | + $cni = 0; | |
2128 | + foreach($dados["colunas"] as $t){ | |
2129 | + $temp = strtoupper($t["field"]); | |
2130 | + if(strlen($temp) > 10){ | |
2131 | + $temp = substr($t["field"],0,8).($cni++); | |
2132 | + } | |
2133 | + if($t["type"] == "varchar" || $t["type"] == "char" || $t["type"] == "character varying" || $t["type"] == "character" || $t["type"] == "text"){ | |
2134 | + $def[] = array($temp,"C","254"); | |
2135 | + } | |
2136 | + else{ | |
2137 | + if($t["lengthvar"] < 0){ | |
2138 | + $t["lengthvar"] = 0; | |
2139 | + } | |
2140 | + $def[] = array($temp,"N", $t["length"],$t["lengthvar"]); | |
2141 | + } | |
2142 | + } | |
2143 | + $nomeshp = $this->dir_tmp."/regiao$codigo_tipo_regiao"."_".$this->nomeRandomico(); | |
2144 | + $dbaseExiste = false; | |
2145 | + if(function_exists("dbase_create")){ | |
2146 | + $dbaseExiste = true; | |
2147 | + } | |
2148 | + //para manipular dbf | |
2149 | + if($dbaseExiste == false){ | |
2150 | + if(file_exists($this->locaplic."/pacotes/phpxbase/api_conversion.php")) | |
2151 | + {include_once($this->locaplic."/pacotes/phpxbase/api_conversion.php");} | |
2152 | + else | |
2153 | + {include_once "../pacotes/phpxbase/api_conversion.php";} | |
2154 | + $db = xbase_create($nomeshp.".dbf", $def); | |
2155 | + } | |
2156 | + else | |
2157 | + {$db = dbase_create($nomeshp.".dbf", $def);} | |
2158 | + $dbname = $nomeshp.".dbf"; | |
2159 | + $reg = array(); | |
2160 | + $novoshpf = ms_newShapefileObj($nomeshp.".shp", $conv[$tipol["st_dimension"]]); | |
2161 | + $cols = $dados["colunas"]; | |
2162 | + $nc = count($dados["colunas"]); | |
2163 | + foreach($dados["linhas"] as $l){ | |
2164 | + $reg = array(); | |
2165 | + for($i=0;$i<$nc;$i++){ | |
2166 | + if($cols[$i]["type"] != "geometry" && $cols[$i]["type"] != "geography"){ | |
2167 | + $reg[] = $l[$i]; | |
2168 | + } | |
2169 | + else{ | |
2170 | + $reg[] = 0; | |
2171 | + if($cols[$i]["field"] == $regiao["colunageo"]){ | |
2172 | + $shape = ms_shapeObjFromWkt($l[$i]); | |
2173 | + } | |
2174 | + } | |
2175 | + } | |
2176 | + $novoshpf->addShape($shape); | |
2177 | + if($dbaseExiste == false){ | |
2178 | + xbase_add_record($db,$reg); | |
2179 | + } | |
2180 | + else{ | |
2181 | + dbase_add_record($db,$reg); | |
2182 | + } | |
2183 | + } | |
2184 | + if($this->dbaseExiste == false){ | |
2185 | + xbase_close($db); | |
2186 | + } | |
2187 | + else{ | |
2188 | + dbase_close($db); | |
2189 | + } | |
2190 | + return $nomeshp; | |
2191 | + } | |
2092 | 2192 | } |
2093 | 2193 | ?> |
2094 | 2194 | \ No newline at end of file | ... | ... |
admin/php/metaestat.php
... | ... | @@ -83,7 +83,8 @@ $funcoesEdicao = array( |
83 | 83 | "INSERIRDADOS", |
84 | 84 | "MANTEMDADOSREGIAO", |
85 | 85 | "SALVAATRIBUTOSMEDIDAVARIAVEL", |
86 | - "EXCLUIATRIBUTOSMEDIDAVARIAVEL" | |
86 | + "EXCLUIATRIBUTOSMEDIDAVARIAVEL", | |
87 | + "REGIAO2SHP" | |
87 | 88 | ); |
88 | 89 | if(in_array(strtoupper($funcao),$funcoesEdicao)){ |
89 | 90 | //se a funcao esta no array eh feita a verificacao se o usuario esta logado e se ele esta em um grupo que |
... | ... | @@ -1422,5 +1423,32 @@ switch (strtoupper($funcao)) |
1422 | 1423 | retornaJSON($resultado); |
1423 | 1424 | exit; |
1424 | 1425 | break; |
1426 | + case "REGIAO2SHP": | |
1427 | + $m = new Metaestat(); | |
1428 | + $shp = $m->regiao2shp($codigo_tipo_regiao); | |
1429 | + include(__DIR__."/../../pacotes/kmlmapserver/classes/zip.class.php"); | |
1430 | + | |
1431 | + $handle = fopen($shp.".shp", "r"); | |
1432 | + $contentsshp = fread($handle, filesize($shp.".shp")); | |
1433 | + fclose($handle); | |
1434 | + | |
1435 | + $handle = fopen($shp.".shp", "r"); | |
1436 | + $contentsdbf = fread($handle, filesize($shp.".dbf")); | |
1437 | + fclose($handle); | |
1438 | + | |
1439 | + $handle = fopen($shp.".shp", "r"); | |
1440 | + $contentsshx = fread($handle, filesize($shp.".shx")); | |
1441 | + fclose($handle); | |
1442 | + | |
1443 | + $ziper = new zipfile(); | |
1444 | + $ziper->addFile($contentsshp, basename($shp).'.shp'); | |
1445 | + $ziper->addFile($contentsshx, basename($shp).'.shx'); | |
1446 | + $ziper->addFile($contentsdbf, basename($shp).'.dbf'); | |
1447 | + $arq = $shp.".zip"; | |
1448 | + $ziper->output($arq); | |
1449 | + $dirtmp = basename(dirname($arq)); | |
1450 | + $d = "/ms_tmp/".basename($arq); | |
1451 | + echo "<html><script> window.location.assign('$d'); </script></html>"; | |
1452 | + break; | |
1425 | 1453 | } |
1426 | 1454 | ?> |
1427 | 1455 | \ No newline at end of file | ... | ... |
classesphp/classe_shp.php
... | ... | @@ -86,37 +86,38 @@ $tema - nome do tema |
86 | 86 | |
87 | 87 | $ext - extensao geográfica que será aplicada ao mapa |
88 | 88 | */ |
89 | - function __construct($map_file,$tema="",$locaplic="",$ext="") | |
90 | - { | |
91 | - if (!function_exists('ms_newMapObj')) {return false;} | |
92 | - if($locaplic == ""){ | |
93 | - $locaplic = __DIR__."/.."; | |
94 | - } | |
95 | - if(file_exists($locaplic."/funcoes_gerais.php")){ | |
96 | - include_once($locaplic."/funcoes_gerais.php"); | |
97 | - } | |
98 | - else{ | |
99 | - include_once(__DIR__."/funcoes_gerais.php"); | |
100 | - } | |
101 | - $this->v = versao(); | |
89 | + function __construct($map_file="",$tema="",$locaplic="",$ext=""){ | |
90 | + if (!function_exists('ms_newMapObj')){return false;} | |
91 | + if($locaplic == ""){ | |
92 | + include (__DIR__."/../ms_configura.php"); | |
93 | + } | |
94 | + if(!function_exists("corRGB")){ | |
95 | + include_once(__DIR__."/funcoes_gerais.php"); | |
96 | + } | |
97 | + $this->v = versao(); | |
102 | 98 | $this->v = $this->v["principal"]; |
103 | 99 | $this->dbaseExiste = false; |
104 | 100 | if(function_exists("dbase_create")) |
105 | 101 | {$this->dbaseExiste = true;} |
106 | - | |
107 | - $this->locaplic = $locaplic; | |
108 | - $this->mapa = ms_newMapObj($map_file); | |
109 | - $this->arquivo = $map_file; | |
110 | - $this->tema = $tema; | |
111 | - if($tema != "" && @$this->mapa->getlayerbyname($tema)) | |
112 | - { | |
113 | - $this->layer = $this->mapa->getlayerbyname($tema); | |
114 | - } | |
115 | - $this->nome = $tema; | |
116 | - if($ext && $ext != ""){ | |
117 | - $e = explode(" ",$ext); | |
118 | - $extatual = $this->mapa->extent; | |
119 | - $extatual->setextent((min($e[0],$e[2])),(min($e[1],$e[3])),(max($e[0],$e[2])),(max($e[1],$e[3]))); | |
102 | + $this->locaplic = $locaplic; | |
103 | + | |
104 | + if($map_file != ""){ | |
105 | + $this->mapa = ms_newMapObj($map_file); | |
106 | + $this->arquivo = $map_file; | |
107 | + $this->tema = $tema; | |
108 | + if($tema != "" && @$this->mapa->getlayerbyname($tema)){ | |
109 | + $this->layer = $this->mapa->getlayerbyname($tema); | |
110 | + } | |
111 | + $this->nome = $tema; | |
112 | + if($ext && $ext != ""){ | |
113 | + $e = explode(" ",$ext); | |
114 | + $extatual = $this->mapa->extent; | |
115 | + $extatual->setextent((min($e[0],$e[2])),(min($e[1],$e[3])),(max($e[0],$e[2])),(max($e[1],$e[3]))); | |
116 | + } | |
117 | + } | |
118 | + else{ | |
119 | + $this->mapa = ""; | |
120 | + $this->arquivo = $dir_tmp."/".nomeRandomico(); | |
120 | 121 | } |
121 | 122 | } |
122 | 123 | /* |
... | ... | @@ -126,8 +127,10 @@ Salva o mapfile atual |
126 | 127 | */ |
127 | 128 | function salva() |
128 | 129 | { |
129 | - if (connection_aborted()){exit();} | |
130 | - $this->mapa->save($this->arquivo); | |
130 | + if (connection_aborted()){ | |
131 | + exit(); | |
132 | + } | |
133 | + $this->mapa->save($this->arquivo); | |
131 | 134 | } |
132 | 135 | /* |
133 | 136 | function: criaSHPvazio |
... | ... | @@ -136,17 +139,30 @@ Cria um shape file do tipo pontual vazio no diretório local |
136 | 139 | |
137 | 140 | Parameter: |
138 | 141 | |
139 | -$tituloTema - título do novo tema | |
142 | +$tituloTema - (opcional) titulo do novo tema | |
143 | + | |
144 | +$nomeshp - (opcional) nome do arquivo que sera criado | |
145 | + | |
146 | +$def - (opcional) array com as definicoes das colunas que serao criadas no DBF | |
147 | + | |
148 | +$tipol - (opcional) tipo de shape conforme as constantes definidas no Mapserver MS_SHP_ | |
140 | 149 | |
141 | 150 | return: |
151 | + | |
142 | 152 | Nome do tema criado. |
143 | 153 | */ |
144 | - function criaSHPvazio($tituloTema="") | |
145 | - { | |
146 | - $diretorio = dirname($this->arquivo); | |
154 | + function criaSHPvazio($tituloTema="",$nomeshp="",$def="",$tipol=""){ | |
147 | 155 | $novonomelayer = nomeRandomico(); |
148 | - $nomeshp = $diretorio."/".$novonomelayer; | |
149 | - $def[] = array("ID","C","50"); | |
156 | + if($nomeshp == ""){ | |
157 | + $diretorio = dirname($this->arquivo); | |
158 | + $nomeshp = $diretorio."/".$novonomelayer; | |
159 | + } | |
160 | + if($def == ""){ | |
161 | + $def[] = array("ID","C","50"); | |
162 | + } | |
163 | + if($tipol == ""){ | |
164 | + $tipol = MS_SHP_POINT; | |
165 | + } | |
150 | 166 | if($this->dbaseExiste == false){ |
151 | 167 | if(file_exists($this->locaplic."/pacotes/phpxbase/api_conversion.php")) |
152 | 168 | {include_once($this->locaplic."/pacotes/phpxbase/api_conversion.php");} |
... | ... | @@ -155,31 +171,35 @@ Nome do tema criado. |
155 | 171 | $db = xbase_create($nomeshp.".dbf", $def); |
156 | 172 | xbase_close($db); |
157 | 173 | } |
158 | - else | |
159 | - { | |
174 | + else{ | |
160 | 175 | $db = dbase_create($nomeshp.".dbf", $def); |
161 | 176 | dbase_close($db); |
162 | 177 | } |
163 | - $tipol = MS_SHP_POINT; | |
164 | - $l = criaLayer($this->mapa,MS_LAYER_POINT,MS_DEFAULT,"Ins","SIM"); | |
165 | - $novoshpf = ms_newShapefileObj($nomeshp, $tipol); | |
178 | + $novoshpf = ms_newShapefileObj($nomeshp, MS_SHP_POINT); | |
166 | 179 | $novoshpf = ms_newShapefileObj($nomeshp.".shp", -2); |
167 | - if($tituloTema == "") | |
168 | - {$tituloTema = $novonomelayer." pontos";} | |
169 | - $l->setmetadata("tema",$tituloTema); | |
170 | - $l->setmetadata("TEMALOCAL","SIM"); | |
171 | - $l->setmetadata("DOWNLOAD","sim"); | |
172 | - $l->set("data",$nomeshp); | |
173 | - $l->set("name",$novonomelayer); | |
174 | - $classe = $l->getclass(0); | |
175 | - $estilo = $classe->getstyle(0); | |
176 | - $estilo->set("symbolname","ponto"); | |
177 | - $estilo->set("size",6); | |
178 | - $cor = $estilo->color; | |
179 | - $cor->setrgb(255,210,0); | |
180 | - $cor = $estilo->outlinecolor; | |
181 | - $cor->setrgb(255,0,0); | |
182 | - return($novonomelayer); | |
180 | + | |
181 | + if($this->mapa != ""){ | |
182 | + if($tituloTema == "") | |
183 | + {$tituloTema = $novonomelayer." pontos";} | |
184 | + $l = criaLayer($this->mapa,MS_LAYER_POINT,MS_DEFAULT,"Ins","SIM"); | |
185 | + $l->setmetadata("tema",$tituloTema); | |
186 | + $l->setmetadata("TEMALOCAL","SIM"); | |
187 | + $l->setmetadata("DOWNLOAD","sim"); | |
188 | + $l->set("data",$nomeshp); | |
189 | + $l->set("name",$novonomelayer); | |
190 | + $classe = $l->getclass(0); | |
191 | + $estilo = $classe->getstyle(0); | |
192 | + $estilo->set("symbolname","ponto"); | |
193 | + $estilo->set("size",6); | |
194 | + $cor = $estilo->color; | |
195 | + $cor->setrgb(255,210,0); | |
196 | + $cor = $estilo->outlinecolor; | |
197 | + $cor->setrgb(255,0,0); | |
198 | + return($novonomelayer); | |
199 | + } | |
200 | + else{ | |
201 | + return ($nomeshp); | |
202 | + } | |
183 | 203 | } |
184 | 204 | /* |
185 | 205 | function: insereSHP | ... | ... |
exemplos/index.html
... | ... | @@ -0,0 +1,193 @@ |
1 | +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/strict.dtd"> | |
2 | +<html> | |
3 | +<head> | |
4 | +<meta http-equiv="Category" content="i3Geo Mapa interativo MMA geoprocessamento sig mobile"> | |
5 | +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> | |
6 | + | |
7 | +<title>i3GEO - OpenLayers</title> | |
8 | + | |
9 | +</head> | |
10 | +<body id="i3geo" style="background-color:white"> | |
11 | +<table id='mst' summary="" style='display:none;' width=100% cellspacing='0'> | |
12 | + <tr style="border:0px"> | |
13 | + <td id="barraSuperior" style="background-image:url('../imagens/visual/default/cabeca.png');height:10px"></td> | |
14 | + </tr> | |
15 | + <tr> | |
16 | + <td id="contemMenu" style="text-align:right;border-width:0pt 0pt 1px;border-color:rgb(240,240,240)"> | |
17 | + <!--menu suspenso--> | |
18 | + <div id="menus" ></div> | |
19 | + </td> | |
20 | + </tr> | |
21 | + <tr> | |
22 | + <td style="vertical-align:top;border-width:0px;"> | |
23 | + <table width="100%" style="vertical-align:top;border-width:0px"> | |
24 | + <tr> | |
25 | + <td class=verdeclaro id=contemImg > | |
26 | + <div id=corpoMapa style="position:relative;background-image:url('../imagens/i3geo1bw.jpg');"></div> | |
27 | + </td> | |
28 | + </tr> | |
29 | + </table> | |
30 | + </td> | |
31 | + </tr> | |
32 | + <tr> | |
33 | + <td> | |
34 | + <table width=100% > | |
35 | + <tr> | |
36 | + <td class=tdbranca > | |
37 | + <!-- | |
38 | + Nesse div são incluídos os ícones que permitem ao usuário modificar o visual de cores dos ícones | |
39 | + <div id=visual ></div> | |
40 | + --> | |
41 | + <!-- botão de compartilhamento em redes sociais --> | |
42 | + <div id=i3GEOcompartilhar style="text-align:left;border-top:1px solid rgb(250,250,250);padding-top:1px" ></div> | |
43 | + <!-- aqui será incluído o contador de tempo quando o temporizador de redesenho do mapa estiver ativo --> | |
44 | + <div id=tempoRedesenho style=color:green;background-color:black;width:50px;display:none ></div> | |
45 | + </td> | |
46 | + <td class=tdbranca > | |
47 | + <!-- aqui será incluída a escala numérica --> | |
48 | + <div id=escala style="text-align:right;" ></div> | |
49 | + </td> | |
50 | + <td class=tdbranca > | |
51 | + <!-- aqui será incluído o gadget que mostra a coordenada geográfica da posição do mouse --> | |
52 | + <div id=localizarxy style="text-align:left;font-size:10px;display:inline-table"></div> | |
53 | + </td> | |
54 | + <!-- aqui serão incluídas as bandeiras que permitem a troca de idioma --> | |
55 | + <td class=tdbranca > | |
56 | + <div id=seletorIdiomas ></div> | |
57 | + </td> | |
58 | + </tr> | |
59 | + </table> | |
60 | + </td> | |
61 | + </tr> | |
62 | + <tr style="border:0px"> | |
63 | + <td id="barraInferior" style="background-image:url('../imagens/visual/default/rodape.png');height:10px"></td> | |
64 | + </tr> | |
65 | +</table> | |
66 | +<center> | |
67 | +<table id="i3GEOlogoMarca" style='box-shadow:0 1px 13px gray;border-radius:5px;'> | |
68 | + <tr> | |
69 | + <td><center><h1 style="font-weight:normal;font-size:10px;font-family: Verdana, Arial, Helvetica, sans-serif;"><div id=versaoi3geo ></div><h2 style="font-weight:normal;font-size:10px;font-family: Verdana, Arial, Helvetica, sans-serif;">i3Geo - Software livre para criação de mapas interativos e geoprocessamento<h3 style="font-weight:normal;font-size:10px;font-family: Verdana, Arial, Helvetica, sans-serif;">Baseado no Mapserver, é licenciado sob GPL e integra o Portal do Software Público Brasileiro</h3></h2></h1></td> | |
70 | + </tr> | |
71 | + <tr> | |
72 | + <td style="padding:10px;"><center><img alt="" style="width:560px;height:81px" src='../imagens/logo_inicio.png' ></td> | |
73 | + </tr> | |
74 | + <tr> | |
75 | + <td><center> | |
76 | + <!-- | |
77 | + <script id="ohloh" type="text/javascript" src="http://www.ohloh.net/p/150688/widgets/project_users.js?style=red"></script> | |
78 | + --> | |
79 | + </td> | |
80 | + </tr> | |
81 | +</table> | |
82 | + | |
83 | +<div id="i3GEOguiaMovel" style="position:absolute;display:block;border:0px solid white;text-align:left;z-index:2000;background-color:none"> | |
84 | + <img id="i3GEOguiaMovelPuxador" onclick='i3GEO.guias.guiaMovel.abreFecha()' style='z-index:2;border:solid 0px white;left:0px;position:absolute;top:0px' width='0px' src='../imagens/openbars.png' > | |
85 | + <div id="i3GEOguiaMovelMolde" style="box-shadow:-2px 0 2px gray;border-radius:5px 0px 0px 5px;position:absolute;display:none;border:0px solid white;text-align:left;z-index:1000;background-color:gray"> | |
86 | + <div id="i3GEOguiaMovelIcones" style='overflow:none;left:0px;display:none;position:absolute;top:0px;text-align:center;height:0px;width:0px;border:solid 0px white;background-color:white' ></div> | |
87 | + <div id="i3GEOguiaMovelConteudo" style='overflow:auto;display:none;position:absolute;border-color:gray;border-width:0px 0 0px 0px;left:0px;height:0px;background-color:white'> | |
88 | + <div id='guia1obj' style='display:none;' > | |
89 | + <!-- Esta div acrescenta a opção de busca rápida, caso vc queira colocá-la em um lugar específico --> | |
90 | + <div style='left:5px;top:10px;' id=buscaRapida ></div> | |
91 | + <!-- Esta div acrescenta a lista de propriedades do mapa --> | |
92 | + <div id=listaPropriedades style='top:15px;' ></div> | |
93 | + <!-- Esta div acrescenta a lista de de camadas do tipo 'baselayers' específicas da interface Openlayers. Veja também a opção i3GEO.Interface.openlayers.GADGETS.LayerSwitcher --> | |
94 | + <div id=listaLayersBase style='top:15px;'></div> | |
95 | + <!-- Esta div acrescenta a lista de de camadas disponíveis no mapa atual --> | |
96 | + <div id=listaTemas style='top:15px;'></div> | |
97 | + </div> | |
98 | + <div id='guia2obj' style='display:none;'>Aguarde...<img alt="" src="../imagens/branco.gif" width=248 /></div> | |
99 | + <div id='guia4obj' style='display:none;text-align:left'><div id='legenda' style='text-align:left'></div></div> | |
100 | + <div id='guia5obj' style='display:none;text-align:left'><div id='banners' style='overflow:auto;text-align:left'>Aguarde...</div></div> | |
101 | + </div> | |
102 | + </div> | |
103 | +</div> | |
104 | + | |
105 | +<script src="../classesjs/i3geo.js"></script> | |
106 | +<script src="../pacotes/openlayers/OpenLayers211.js.php"></script> | |
107 | +<!-- estilo necessário para a ferramenta de edição --> | |
108 | +<style> | |
109 | +.olControlEditingToolbar1 div { | |
110 | + background-image:url(../mashups/openlayers.png); | |
111 | + background-repeat:no-repeat; | |
112 | + float:right; | |
113 | + right: 0px; | |
114 | + height:29px; | |
115 | + margin:2px; | |
116 | + width:29px; | |
117 | + cursor:pointer; | |
118 | +} | |
119 | +</style> | |
120 | +<script> | |
121 | +// | |
122 | +//nao mostra o menu de administracao | |
123 | +// | |
124 | +i3GEO.gadgets.PARAMETROS.mostraMenuSuspenso.permiteLogin = false; | |
125 | + | |
126 | +// | |
127 | +i3GEO.configura.locaplic = i3GEO.util.protocolo()+"://"+window.location.host+"/i3geo"; | |
128 | +i3GEO.configura.autotamanho = false; | |
129 | +i3GEO.Interface.ATUAL = "openlayers"; | |
130 | +i3GEO.Interface.IDCORPO = "contemImg"; | |
131 | +i3GEO.Interface.openlayers.GADGETS = { | |
132 | + PanZoomBar:true, | |
133 | + PanZoom:false, | |
134 | + LayerSwitcher:true, | |
135 | + ScaleLine:true, | |
136 | + OverviewMap:false | |
137 | + }; | |
138 | +i3GEO.Interface.openlayers.TILES = true; | |
139 | +i3GEO.gadgets.PARAMETROS.mostraMenuSuspenso.finaliza = 'if($i("omenudataInterface1")){i3GEOoMenuBar.getMenuItem("omenudataInterface1").cfg.setProperty("text", " ");}' | |
140 | +i3GEO.cria(); | |
141 | +i3GEO.configura.mapaRefDisplay = "none"; | |
142 | +i3GEO.barraDeBotoes.TIPO = "olhodepeixe"; | |
143 | +i3GEO.barraDeBotoes.OFFSET = -3; | |
144 | +i3GEO.configura.oMenuData["submenus"]["janelas"] = []; | |
145 | +i3GEO.ajuda.ATIVAJANELA = false; | |
146 | +i3GEO.idioma.IDSELETOR = "seletorIdiomas"; | |
147 | +i3GEO.Interface.ATIVAMENUCONTEXTO = false; | |
148 | +i3GEO.arvoreDeTemas.TIPOBOTAO = "radio"; | |
149 | + | |
150 | +i3GEO.arvoreDeTemas.OPCOESADICIONAIS.comentarios = true; | |
151 | +i3GEO.arvoreDeCamadas.VERIFICAABRANGENCIATEMAS = true; | |
152 | +i3GEO.arvoreDeCamadas.MOSTRALISTAKML = false; | |
153 | +i3GEO.mapa.AUTORESIZE = true; | |
154 | +i3GEO.guias.TIPO = "movel"; | |
155 | +i3GEO.guias.guiaMovel.config.topGuiaMovel = 0; | |
156 | +OpenLayers.ImgPath = "../pacotes/openlayers/img/"; | |
157 | +(function(){ | |
158 | + var oce = new OpenLayers.Layer.ArcGIS93Rest( | |
159 | + "ESRI Ocean Basemap", | |
160 | + "http://server.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer/export", | |
161 | + {format:"jpeg"}, | |
162 | + {isBaseLayer:true,visibility:false} | |
163 | + ); | |
164 | + var ims = new OpenLayers.Layer.ArcGIS93Rest( | |
165 | + "ESRI Imagery World 2D", | |
166 | + "http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer/export", | |
167 | + {format:"jpeg"}, | |
168 | + {isBaseLayer:true,visibility:false} | |
169 | + ); | |
170 | + var wsm = new OpenLayers.Layer.ArcGIS93Rest( | |
171 | + "ESRI World Street Map", | |
172 | + "http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer/export", | |
173 | + {format:"jpeg"}, | |
174 | + {isBaseLayer:true,visibility:false} | |
175 | + ); | |
176 | + var bra = new OpenLayers.Layer.WMS( | |
177 | + "Base carto MMA", | |
178 | + "http://mapas.mma.gov.br/cgi-bin/mapserv?map=/opt/www/html/webservices/baseraster.map", | |
179 | + {layers:"baseraster",srs:"EPSG:4618",format:"image/png",isBaseLayer:false}, | |
180 | + {isBaseLayer:true,visibility:false} | |
181 | + ); | |
182 | + i3GEO.Interface.openlayers.LAYERSADICIONAIS = [oce,ims,wsm,bra]; | |
183 | +})(); | |
184 | +i3GEO.finaliza = function(){ | |
185 | + if($i("i3GEOlogoMarca")) | |
186 | + {$i("i3GEOlogoMarca").style.display = "none";} | |
187 | + i3GEO.mapa.insereDobraPagina("googlemaps","../imagens/dobragooglemaps.png"); | |
188 | +} | |
189 | +i3GEO.arvoreDeTemas.OPCOESADICIONAIS.navegacaoDir = true; | |
190 | +i3GEO.inicia(); | |
191 | +</script> | |
192 | +</body> | |
193 | +</html> | ... | ... |
ferramentas/uploaddbf/upload.php
... | ... | @@ -46,49 +46,51 @@ if (isset($_FILES['i3GEOuploaddbffile']['name'])) |
46 | 46 | if($i3GEOuploaddbftipoarquivo != "dbf"){ |
47 | 47 | if($i3GEOuploaddbftipoarquivo == "csvpv"){$separador = ";";} |
48 | 48 | if($i3GEOuploaddbftipoarquivo == "csvv"){$separador = ",";} |
49 | - include_once("../../pacotes/classesphp/class.CSVHandler.php"); | |
50 | 49 | include_once "../../pacotes/phpxbase/api_conversion.php"; |
51 | - $csv = new CSVHandler($dirmap."/".$_FILES['i3GEOuploaddbffile']['name'],$separador,"record"); | |
52 | - $dados = $csv->ReadCSV(); | |
50 | + include_once("../../pacotes/parsecsv/parsecsv.lib.php"); | |
51 | + $csv = new parseCSV(); | |
52 | + $csv->delimiter = $separador; | |
53 | + $dados = $csv->parse($dirmap."/".$_FILES['i3GEOuploaddbffile']['name']); | |
53 | 54 | $conta = 0; |
54 | 55 | $xy = array(); |
55 | - foreach($csv->HeaderData as $i) | |
56 | - { | |
56 | + $colunas = array_keys($csv->data[0]); | |
57 | + foreach($colunas as $i){ | |
57 | 58 | $i = strtoupper($i); |
58 | 59 | $i = trim($i); |
59 | - if(($i != $nomex) && ($i != $nomey)) | |
60 | - { | |
60 | + if(($i != $nomex) && ($i != $nomey)){ | |
61 | 61 | $i = str_replace("_","",$i); |
62 | 62 | $i = str_replace("-","",$i); |
63 | - $i= substr($i, 0, 7); | |
64 | - $def[] = array($i.$conta,"C","255"); | |
63 | + if(strlen($i) > 10){ | |
64 | + $i= substr($i, 0, 7).$conta++; | |
65 | + } | |
66 | + $def[] = array($i,"C","255"); | |
65 | 67 | } |
66 | - else | |
67 | - {$def[] = array($i,"C","255");} | |
68 | - $conta++; | |
68 | + else{ | |
69 | + $def[] = array($i,"C","255"); | |
70 | + } | |
71 | + } | |
72 | + if(!function_exists("dbase_create")){ | |
73 | + xbase_create($dirmap."/".$nome.".dbf", $def); | |
69 | 74 | } |
70 | - if(!function_exists("dbase_create")) | |
71 | - {xbase_create($dirmap."/".$nome.".dbf", $def);} | |
72 | - else | |
73 | - {dbase_create($dirmap."/".$nome.".dbf", $def);} | |
74 | - $db=xbase_open($dirmap."/".$nome.".dbf",2); | |
75 | - foreach($dados as $d){ | |
75 | + else{ | |
76 | + dbase_create($dirmap."/".$nome.".dbf", $def); | |
77 | + } | |
78 | + $db=xbase_open($dirmap."/".$nome.".dbf",2); | |
79 | + foreach($csv->data as $d){ | |
76 | 80 | $reg = array(); |
77 | - foreach($d as $i) | |
78 | - {$reg[] = $i;} | |
79 | - xbase_add_record($db,$reg); | |
81 | + foreach($d as $i){ | |
82 | + $reg[] = $i; | |
83 | + } | |
84 | + xbase_add_record($db,$reg); | |
80 | 85 | } |
81 | 86 | xbase_close($db); |
82 | 87 | } |
83 | 88 | echo "<p>Arquivo enviado. Criando shape file...</p>"; |
84 | - | |
85 | 89 | $novoshpf = ms_newShapefileObj($nomeshp, MS_SHP_POINT); |
86 | 90 | $novoshpf->free(); |
87 | 91 | $shapefileObj = ms_newShapefileObj($nomeshp,-2); |
88 | - if($i3GEOuploaddbftipoarquivo != "dbf") | |
89 | - { | |
90 | - foreach($dados as $d) | |
91 | - { | |
92 | + if($i3GEOuploaddbftipoarquivo != "dbf"){ | |
93 | + foreach($csv->data as $d){ | |
92 | 94 | $poPoint = ms_newpointobj(); |
93 | 95 | $poPoint->setXY($d[$i3GEOuploaddbfnomex],$d[$i3GEOuploaddbfnomey]); |
94 | 96 | $shapefileObj->addpoint($poPoint); |
... | ... | @@ -108,7 +110,7 @@ if (isset($_FILES['i3GEOuploaddbffile']['name'])) |
108 | 110 | $shapefileObj->addpoint($poPoint); |
109 | 111 | } |
110 | 112 | } |
111 | - $shapefileObj->free(); | |
113 | + $shapefileObj->free(); | |
112 | 114 | $novolayer = ms_newLayerObj($mapa); |
113 | 115 | $novolayer->set("data",$nomeshp); |
114 | 116 | $novolayer->set("name",basename($nomeshp)); |
... | ... | @@ -116,7 +118,7 @@ if (isset($_FILES['i3GEOuploaddbffile']['name'])) |
116 | 118 | $novolayer->setmetadata("DOWNLOAD","SIM"); |
117 | 119 | $novolayer->setmetadata("TEMALOCAL","SIM"); |
118 | 120 | $novolayer->setmetadata("CLASSE","SIM"); |
119 | - $novolayer->setmetadata("TEXTO","NAO"); | |
121 | + $novolayer->setmetadata("TEXTO","NAO"); | |
120 | 122 | $novolayer->set("type",MS_LAYER_POINT); |
121 | 123 | $novolayer->setfilter(""); |
122 | 124 | $classe = ms_newClassObj($novolayer); | ... | ... |
pacotes/classesphp/class.CSVHandler.php
... | ... | @@ -1,231 +0,0 @@ |
1 | -<?php | |
2 | -# This program is free software; you can redistribute it and/or modify | |
3 | -# it under the terms of the GNU Library General Public License as published by | |
4 | -# the Free Software Foundation either version 2 of the License, or | |
5 | - | |
6 | -//===================================================================================================================== | |
7 | -//classdef CSVHandler 0.91 :: CSV Handling Wrapper | |
8 | -//===================================================================================================================== | |
9 | -# | |
10 | -# | |
11 | -# Copyright (C) 2005 by Andreas M?ller | |
12 | - | |
13 | -class CSVHandler { | |
14 | - var $Separator; // | |
15 | - var $DataFile; | |
16 | - var $DataKey; | |
17 | - var $HeaderData; // | |
18 | - var $ItemsList; // | |
19 | - var $Items_Count; | |
20 | - var $color; | |
21 | - var $RecordsList; | |
22 | - | |
23 | -// Standard User functions | |
24 | - function CSVHandler($Filename, $Separator, $KeyFieldName) { //Constructor | |
25 | - $this->DataFile=$Filename; | |
26 | - $this->DataKey=$KeyFieldName; | |
27 | - $this->Separator=$Separator; | |
28 | - $this->color="#FFFFFF"; | |
29 | - } | |
30 | - function ReadCSV() { //read data into this->ItemsList and return it in an array | |
31 | - $this->Items_Count=0; | |
32 | - $this->ItemsList=array(); | |
33 | - $Item=array(); | |
34 | - $fp = fopen ($this->DataFile,"r"); | |
35 | - $this->HeaderData = fgetcsv ($fp, 3000, $this->Separator); | |
36 | - while ($DataLine = fgetcsv ($fp, 3000, $this->Separator)) { | |
37 | - for($i=0;$i<count($this->HeaderData);$i++){ | |
38 | - $Item[$this->HeaderData[$i]]=$DataLine[$i]; | |
39 | - } | |
40 | - array_push($this->ItemsList,$Item); | |
41 | - $this->Items_Count++; | |
42 | - } | |
43 | - fclose($fp); | |
44 | - return ($this->ItemsList); | |
45 | - } | |
46 | - function Select($needle,$column="all") { //get items in a sort of SQL Select query and return them in an array | |
47 | - $this->ReadCSV(); | |
48 | - if($needle=="*") { | |
49 | - $result=$this->ItemsList; | |
50 | - } else { | |
51 | - $result=array(); | |
52 | - if($column=="all") { | |
53 | - while(list($key,$line)=each($this->ItemsList)) { | |
54 | - if (stristr(implode("",$line),$needle)) array_push($result,$line); | |
55 | - } | |
56 | - } else { | |
57 | - while(list($key,$line)=each($this->ItemsList)) { | |
58 | - if (stristr($line[$column],$needle)) array_push($result,$line); | |
59 | - } | |
60 | - } | |
61 | - } | |
62 | - return ($result); | |
63 | - } | |
64 | - function ListAll() { //prints a list of all Data | |
65 | - $Data=$this->ReadCSV(); | |
66 | - reset ($this->ItemsList); | |
67 | - reset ($this->HeaderData); | |
68 | - $HHeaders=""; | |
69 | - $HData=""; | |
70 | - while(list($HKey,$HVal)=each($this->HeaderData)) { //Create Headers Line | |
71 | - $HHeaders.=$this->HTTD($HVal); | |
72 | - } | |
73 | - $HHeaders=$this->HTTR($HHeaders); | |
74 | - while(list($LineKey,$LineVal)=each($this->ItemsList)) { //Read Data Lines | |
75 | - $HDataLine=""; | |
76 | - while(list($DataKey,$DataVal)=each($LineVal)) { //Dissect one Data Line | |
77 | - $HDataLine.=$this->HTTD($DataVal); | |
78 | - } | |
79 | - $HData.=$this->HTTR($HDataLine); //and add HTML to Data | |
80 | - } | |
81 | - print ($this->HTPage($this->HTTable($HHeaders.$HData))); | |
82 | - } | |
83 | - function GetValues($field) { //Fetch all values of a specified field and return values in array | |
84 | - $Data=$this->ReadCSV(); | |
85 | - $values=array(); | |
86 | - while(list($key,$val)=each($this->ItemsList)) { | |
87 | - if(!in_array($val[$field],$values)) array_push($values,$val[$field]); | |
88 | - } | |
89 | - sort($values); | |
90 | - return $values; | |
91 | - } | |
92 | - function Edit() { //All edit function in one Table | |
93 | - $Data=$this->ReadCSV(); | |
94 | - if(isset($_POST['commit'])) { | |
95 | - $this->Update($_POST[$this->DataKey],$_POST); | |
96 | - $Data=$this->ReadCSV(); | |
97 | - } | |
98 | - if(isset($_POST['add'])) { | |
99 | - $this->Add($_POST[$this->DataKey],$_POST); | |
100 | - $Data=$this->ReadCSV(); | |
101 | - } | |
102 | - if(isset($_POST['delete'])) { | |
103 | - $this->Delete($_POST[$this->DataKey]); | |
104 | - $Data=$this->ReadCSV(); | |
105 | - } | |
106 | - $PAGE=$this->EditList(); | |
107 | - print $PAGE; | |
108 | - } | |
109 | - | |
110 | -// Administration Area | |
111 | - function Update($key,$data) { //Updating Item "key" with "data" named array | |
112 | - $this->ReadCSV(); | |
113 | - for($i=0;$i<count($this->ItemsList);$i++) { | |
114 | - If($this->ItemsList[$i][$this->DataKey]==$key){ | |
115 | - while(list($key,$val)=each($this->HeaderData)) { | |
116 | - if(isset($data[$val])) $this->ItemsList[$i][$val]=$data[$val]; | |
117 | - } | |
118 | - } | |
119 | - } | |
120 | - $this->WriteData(); | |
121 | - return($this->ItemsList); | |
122 | - } | |
123 | - function Add($key,$data) { //add an Item "key" with "data" named array | |
124 | - $this->ReadCSV(); | |
125 | - $NewLine=array(); | |
126 | - $NewItem=array($this->DataKey=>$key); | |
127 | - while(list($key,$val)=each($this->HeaderData)) { | |
128 | - if(isset($data[$val])) { | |
129 | - $NewItem[$val]=$data[$val]; | |
130 | - } else { | |
131 | - $NewItem[$val]=$data[$val]=""; | |
132 | - } | |
133 | - } | |
134 | - array_push($this->ItemsList,$NewItem); | |
135 | - $this->WriteData(); | |
136 | - return($this->ItemsList); | |
137 | - } | |
138 | - function EditList() { //returns Editor's List of Items | |
139 | - reset ($this->ItemsList); | |
140 | - reset ($this->HeaderData); | |
141 | - $HHeaders=$this->HTTD(" "); | |
142 | - $HData=""; | |
143 | - while(list($HKey,$HVal)=each($this->HeaderData)) { //Create Headers Line | |
144 | - $HHeaders.=$this->HTTD($HVal); | |
145 | - } | |
146 | - $HHeaders=$this->HTTR($HHeaders); | |
147 | - while(list($LineKey,$LineVal)=each($this->ItemsList)) { //Read Data Lines | |
148 | - $HDataLine=""; | |
149 | - while(list($DataKey,$DataVal)=each($LineVal)) { //Dissect one Data Line | |
150 | - $HDataLine.=$this->HTInput($DataKey,$DataVal); | |
151 | - } | |
152 | - $HData.=$this->HTForm($LineVal[$this->DataKey],$this->HTTR($this->HTButton("commit").$HDataLine.$this->HTButton("delete"))); //and add HTML to Data | |
153 | - } | |
154 | - $HDataLine=""; | |
155 | - reset($this->HeaderData); | |
156 | - while(list($DataKey,$DataVal)=each($this->HeaderData)) { // Add an extra Line for Adding a record | |
157 | - $HDataLine.=$this->HTInput($DataVal,""); | |
158 | - } | |
159 | - $HData.=$this->HTForm($LineVal[$this->DataKey],$this->HTTR($this->HTButton("add").$HDataLine)); //and add HTML to Data | |
160 | - return($this->HTPage($this->HTTable($HHeaders.$HData))); | |
161 | - } | |
162 | - function Delete($DeleteKey) { //Remove Item "Key" from the file | |
163 | - $inter=array(); | |
164 | - while(list($key,$val)=each($this->ItemsList)) { | |
165 | - If($val[$this->DataKey]!=$DeleteKey) array_push($inter,$val); | |
166 | - } | |
167 | - $this->ItemsList=$inter; | |
168 | - $this->WriteData(); | |
169 | - return($this->ItemsList); | |
170 | - } | |
171 | - function WriteData() { //writing contents of ItemList to Datafile | |
172 | - reset($this->ItemsList); | |
173 | - $Output=implode($this->Separator, $this->HeaderData)."\n"; | |
174 | - while(list($key,$val)=each($this->ItemsList)) { | |
175 | - for($i=0;$i<count($this->HeaderData);$i++){ | |
176 | - $writekey=$this->HeaderData[$i]; | |
177 | - $writeitem[$writekey]=$val[$writekey]; | |
178 | - } | |
179 | - $Output.=implode($this->Separator, $writeitem)."\n"; | |
180 | - } | |
181 | - $fp = fopen ($this->DataFile,"w"); | |
182 | - flock($fp,2); | |
183 | - fputs($fp,$Output); | |
184 | - flock($fp,3); | |
185 | - fclose($fp); | |
186 | - } | |
187 | - | |
188 | -// Accessory HTML output functions | |
189 | - function HTPage($value) { // Places $value into BODY of HTML Page | |
190 | - $result = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n"; | |
191 | - $result.="<html><head><title>".$this->DataFile." Editor</title>\n"; | |
192 | - $result.="<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n"; | |
193 | - $result.="<style type=\"text/css\">"; | |
194 | - $result.="<!-- td { margin: 0px; padding: 0px; border: 1px solid #003399; } --></style></head>\n"; | |
195 | - $result.="<body>\n".$value."</body>\n</html>"; | |
196 | - return $result; | |
197 | - } | |
198 | - function HTForm($item,$data) { //places $data into form $item | |
199 | - return "<form name=\"".$item."\" method=\"post\">\n".$data."</form>\n"; | |
200 | - } | |
201 | - function HTTable($value) { //places $value into TABLE | |
202 | - return "<table width=\"96%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n".$value."</table>\n"; | |
203 | - } | |
204 | - function HTTR($value) { //places $value into TR | |
205 | - $this->SRotate(); | |
206 | - return "<tr>\n".$value."</tr>\n"; | |
207 | - } | |
208 | - function HTTD($value) { // places $value into TD | |
209 | - return "<td bgcolor=\"".$this->color."\">".$value."</td>\n"; | |
210 | - } | |
211 | - function HTInput($field,$value) { //returns TD input field | |
212 | - $Olen=strlen($value); | |
213 | - if($Olen<3) { | |
214 | - $Ilen=12; | |
215 | - } else { | |
216 | - $Ilen=$Olen; | |
217 | - } | |
218 | - return "<td bgcolor=\"".$this->color."\"><input name=\"".$field."\" type=\"text\" id=\"".$field."\" value=\"".$value."\" size=\"".$Ilen."\"></td>\n"; | |
219 | - } | |
220 | - function HTButton($value) { // returns "$value" button | |
221 | - return "<td><input name=\"".$value."\" type=\"submit\" id=\"".$value."\" value=\"".$value."\"></td>\n"; | |
222 | - } | |
223 | - function SRotate() { //rotating colors for more readability of tables | |
224 | - if($this->color=="#FFFFFF") { | |
225 | - $this->color="#CCEEFF"; | |
226 | - } else { | |
227 | - $this->color="#FFFFFF"; | |
228 | - } | |
229 | - } | |
230 | -} | |
231 | -?> |