Commit ff5a8b98f27bd7fecb47855e66d5464037a16c61

Authored by Edmar Moretti
1 parent ad438f88

--no commit message

ferramentas/parametrossql/ogc.php
... ... @@ -174,7 +174,8 @@ else{
174 174 if($c["chave"] != ""){
175 175 //valores definidos no plugin como uma string
176 176 if($c["valores"] != ""){
177   - $plugin[] = explode(",",$c["valores"])[0];
  177 + $temp = explode(",",$c["valores"]);
  178 + $plugin[] = $temp[0];
178 179 }
179 180 elseif ($c["prog"] != ""){
180 181 $plugin[] = execProg($locaplic."/".$c["prog"]);
... ... @@ -182,7 +183,8 @@ else{
182 183 }
183 184 }
184 185 $plugin = implode(",",$plugin);
185   - }
  186 + }
  187 + $l->setmetadata("TEMA",$l->getmetadata("TEMA")." - ".$plugin);
186 188 $valores = str_ireplace(array(" and ", " or ", "select","from","where","update","delete","insert","--"),"",$plugin);
187 189 $valores = explode(",",strip_tags($valores));
188 190 for($i = 0; $i < $n; $i++){
... ... @@ -196,7 +198,8 @@ else{
196 198 }
197 199 if($filtro != ""){
198 200 $l->setfilter($filtro);
199   - }
  201 + }
  202 +
200 203 $l->set("data",$data);
201 204 //acrecenta-se um md5 apos o nome caso seja necessario gerar cache
202 205 if($cache == true){
... ...
mashups/osm.php
... ... @@ -25,6 +25,7 @@ if($nocache == &quot;sim&quot;){
25 25 else{
26 26 $nocache = "";
27 27 }
  28 +//guarda os parametros das camadas que possuem plugins configurados
28 29 $temasPluginI3Geo = array();
29 30 //
30 31 // recupera um mapa salvo no banco de administracao
... ... @@ -241,6 +242,8 @@ if(isset($fundo) &amp;&amp; $fundo != &quot;&quot;){
241 242 //
242 243 // define quais os layers que compor&atilde;o o mapa
243 244 //
  245 +//$objOpenLayers guarda a string javascript que sera usada para criar os objetos
  246 +//layer do OpenLayers
244 247 if(isset($temas)){
245 248 $objOpenLayers = array();
246 249 }
... ... @@ -266,9 +269,9 @@ if($temas != &quot;&quot;){
266 269 //
267 270 $listaFerramentas = array("tme","storymap");
268 271 foreach($temas as $tema){
269   - //
270   - //utilzado para obter os parametros de ferramentas especificas indicadas nos metadados do LAYER
271   - //
  272 + //
  273 + //utilzado para obter os parametros de ferramentas especificas indicadas nos metadados do LAYER
  274 + //
272 275 $ferramentas = array();
273 276 if(file_exists($locaplic."/temas/".$tema.".gvp")){
274 277 include_once($locaplic."/pacotes/gvsig/gvsig2mapfile/class.gvsig2mapfile.php");
... ... @@ -303,14 +306,18 @@ if($temas != &quot;&quot;){
303 306 $layern = $maptemp->getLayer($i);
304 307 if($layern->getmetadata("PLUGINI3GEO") != ""){
305 308 //obtem os dados necessarios para iniciar o plugin
  309 + //os objetos layer (openLayers) sao criados apenas no final
  310 + //do processo, pois necessitam usar javascript e nao apenas PHP
306 311 $temasPluginI3Geo[] = array(
307 312 "name"=>$layern->name,
308 313 "tema"=>$layern->getmetadata("tema"),
309 314 "plugin"=>$layern->getmetadata("PLUGINI3GEO"),
310 315 "cache"=>strtoupper($layern->getmetadata("cache")),
311 316 "transitioneffect"=>strtoupper($layern->getmetadata("transitioneffect")),
312   - "tiles"=>strtoupper($layern->getmetadata("tiles"))
  317 + "tiles"=>strtoupper($layern->getmetadata("tiles")),
  318 + "posicaoLayer"=>count($objOpenLayers)
313 319 );
  320 + $objOpenLayers[] = "";
314 321 }
315 322 else{
316 323 $layersNomes[] = $layern->name;
... ... @@ -712,9 +719,30 @@ i3GEO.editorOL.mapa = new OpenLayers.Map(
712 719 if(i3GEO.configura.locaplic === ""){
713 720 i3GEO.configura.locaplic = "../";
714 721 }
715   -
  722 +//faz a inclusao das camadas que possuem plugins
  723 +//veja o codigo PHP abaixo da funcao
  724 +//a variavel i3GEO.editorOL.layersIniciais ja contem a entrada para o layer
  725 +//mas vazia. Isso e necessario para incluir a camada na ordem correta
  726 +function adicionaPluginI3geo(camada,visivel,indice){
  727 + if(!camada.cache){
  728 + camada["cache"] = "NAO";
  729 + }
  730 + var n, i, l = i3GEO.pluginI3geo.layerMashup("openlayers",camada,"4326");
  731 + n = l.length;
  732 + for(i = 0; i < n; i++){
  733 + if(l[i].displayInLayerSwitcher === true){
  734 + l[i].setVisibility(visivel);
  735 + }
  736 + if(l[i] != true){
  737 + i3GEO.editorOL.layersIniciais[indice] = l[i];
  738 + }
  739 + }
  740 +}
716 741 <?php
717 742 //camadas plugin
  743 + //cria o javascript que faz a inclusao das camadas
  744 + //configuradas com plugins do i3geo
  745 + //a variavel $temasPluginI3Geo e definida no inicio do PHP
718 746 foreach ($temasPluginI3Geo as $t){
719 747 //var_dump($temasPluginI3Geo);exit;
720 748 //cria um objeto javascript para iniciar o plugin
... ... @@ -725,28 +753,10 @@ if(i3GEO.configura.locaplic === &quot;&quot;){
725 753 if(in_array($t["name"],$visiveis)){
726 754 $visivel = "true";
727 755 }
728   - echo "adicionaPluginI3geo(camada,$visivel);\n";
729   - }
730   - ?>
731   - i3GEO.editorOL.inicia();
732   -
733   - function adicionaPluginI3geo(camada,visivel){
734   - if(!camada.cache){
735   - camada["cache"] = "NAO";
736   - }
737   - var l = i3GEO.pluginI3geo.layerMashup("openlayers",camada,"4326"),
738   - n,
739   - i;
740   - n = l.length;
741   - for(i = 0; i < n; i++){
742   - if(l[i].displayInLayerSwitcher === true){
743   - l[i].setVisibility(visivel);
744   - }
745   - if(l[i] != true){
746   - i3GEO.editorOL.layersIniciais.push(l[i]);
747   - }
748   - }
  756 + echo "adicionaPluginI3geo(camada,".$visivel.",".$t["posicaoLayer"].");\n";
749 757 }
  758 +?>
  759 +i3GEO.editorOL.inicia();
750 760 </script>
751 761 </body>
752 762 </html>
... ...