Commit 2a546d47960b80bd46c6f81cf1fef476a0c94f79

Authored by Edmar Moretti
1 parent 7a6b493a

Altera a ferramenta de linha do tempo para que o gráfico mova automaticamente pa…

…ra a última data carregada no conjunto de dados
classesphp/graficos.php
@@ -495,8 +495,13 @@ function dadosLinhaDoTempo($map_file,$tema,$ext="") @@ -495,8 +495,13 @@ function dadosLinhaDoTempo($map_file,$tema,$ext="")
495 $itemlink = $layer->getmetadata("ltempoitemlink"); 495 $itemlink = $layer->getmetadata("ltempoitemlink");
496 $itens[] = $itemlink; 496 $itens[] = $itemlink;
497 } 497 }
  498 + $converteE = "sim";
  499 + if($layer->getmetadata("ltempoconvencode") != ""){
  500 + $converteE = $layer->getmetadata("ltempoconvencode");
  501 + }
498 $dados = pegaValoresM($map,$layer,$itens,$exclui,$selecionados,true,true); 502 $dados = pegaValoresM($map,$layer,$itens,$exclui,$selecionados,true,true);
499 $eventos = array(); 503 $eventos = array();
  504 + $anos = array();
500 foreach($dados as $dado){ 505 foreach($dados as $dado){
501 if($itemi == "") 506 if($itemi == "")
502 {$image = '';} 507 {$image = '';}
@@ -512,7 +517,7 @@ function dadosLinhaDoTempo($map_file,$tema,$ext="") @@ -512,7 +517,7 @@ function dadosLinhaDoTempo($map_file,$tema,$ext="")
512 else {$link = $dado[$link];} 517 else {$link = $dado[$link];}
513 $titulo = $dado[$itemtitulo]; 518 $titulo = $dado[$itemtitulo];
514 $desc = $dado[$itemdescricao]; 519 $desc = $dado[$itemdescricao];
515 - if (function_exists("mb_convert_encoding")){ 520 + if(function_exists("mb_convert_encoding") && $converteE == "sim"){
516 $titulo = mb_convert_encoding($titulo,"UTF-8","ISO-8859-1"); 521 $titulo = mb_convert_encoding($titulo,"UTF-8","ISO-8859-1");
517 $desc = mb_convert_encoding($desc,"UTF-8","ISO-8859-1"); 522 $desc = mb_convert_encoding($desc,"UTF-8","ISO-8859-1");
518 } 523 }
@@ -526,6 +531,8 @@ function dadosLinhaDoTempo($map_file,$tema,$ext="") @@ -526,6 +531,8 @@ function dadosLinhaDoTempo($map_file,$tema,$ext="")
526 'image'=>$image, 531 'image'=>$image,
527 'link'=>$link 532 'link'=>$link
528 ); 533 );
  534 + $anos[] = $fim;
  535 + $anos[] = $dado[$iteminicio];
529 } 536 }
530 } 537 }
531 //echo "<pre>"; 538 //echo "<pre>";
@@ -533,7 +540,9 @@ function dadosLinhaDoTempo($map_file,$tema,$ext=&quot;&quot;) @@ -533,7 +540,9 @@ function dadosLinhaDoTempo($map_file,$tema,$ext=&quot;&quot;)
533 "dateTimeFormat"=>$layer->getmetadata("ltempoformatodata"), 540 "dateTimeFormat"=>$layer->getmetadata("ltempoformatodata"),
534 "wikiURL"=>"", 541 "wikiURL"=>"",
535 "wikiSection"=>"", 542 "wikiSection"=>"",
536 - "events"=>$eventos 543 + "events"=>$eventos,
  544 + "menorano"=>min($anos),
  545 + "maiorano"=>max($anos)
537 ); 546 );
538 } 547 }
539 // 548 //
ferramentas/linhadotempo/index.php
@@ -173,7 +173,8 @@ function carregaDados(){ @@ -173,7 +173,8 @@ function carregaDados(){
173 $i("totaleventos").innerHTML = retorno.data.events.length+" eventos"; 173 $i("totaleventos").innerHTML = retorno.data.events.length+" eventos";
174 tl = Timeline.create(tl_el, bandInfos, Timeline.HORIZONTAL); 174 tl = Timeline.create(tl_el, bandInfos, Timeline.HORIZONTAL);
175 eventSource1.loadJSON(retorno.data, '.'); // The data was stored into the 175 eventSource1.loadJSON(retorno.data, '.'); // The data was stored into the
176 - tl.layout(); // display the Timeline 176 + tl.layout(); // display the Timeline
  177 + tl.getBand(0).scrollToCenter(Timeline.DateTime.parseGregorianDateTime(retorno.data.maiorano));
177 } 178 }
178 var p = window.parent.i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?funcao=dadosLinhaDoTempo&g_sid="+window.parent.i3GEO.configura.sid+"&tema="+$i("tema").value+"&ext="+window.parent.i3GEO.parametros.mapexten; 179 var p = window.parent.i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?funcao=dadosLinhaDoTempo&g_sid="+window.parent.i3GEO.configura.sid+"&tema="+$i("tema").value+"&ext="+window.parent.i3GEO.parametros.mapexten;
179 cpJSON.call(p,"void",retorna); 180 cpJSON.call(p,"void",retorna);