Commit 2a546d47960b80bd46c6f81cf1fef476a0c94f79
1 parent
7a6b493a
Exists in
master
and in
7 other branches
Altera a ferramenta de linha do tempo para que o gráfico mova automaticamente pa…
…ra a última data carregada no conjunto de dados
Showing
2 changed files
with
13 additions
and
3 deletions
Show diff stats
classesphp/graficos.php
| ... | ... | @@ -495,8 +495,13 @@ function dadosLinhaDoTempo($map_file,$tema,$ext="") |
| 495 | 495 | $itemlink = $layer->getmetadata("ltempoitemlink"); |
| 496 | 496 | $itens[] = $itemlink; |
| 497 | 497 | } |
| 498 | + $converteE = "sim"; | |
| 499 | + if($layer->getmetadata("ltempoconvencode") != ""){ | |
| 500 | + $converteE = $layer->getmetadata("ltempoconvencode"); | |
| 501 | + } | |
| 498 | 502 | $dados = pegaValoresM($map,$layer,$itens,$exclui,$selecionados,true,true); |
| 499 | 503 | $eventos = array(); |
| 504 | + $anos = array(); | |
| 500 | 505 | foreach($dados as $dado){ |
| 501 | 506 | if($itemi == "") |
| 502 | 507 | {$image = '';} |
| ... | ... | @@ -512,7 +517,7 @@ function dadosLinhaDoTempo($map_file,$tema,$ext="") |
| 512 | 517 | else {$link = $dado[$link];} |
| 513 | 518 | $titulo = $dado[$itemtitulo]; |
| 514 | 519 | $desc = $dado[$itemdescricao]; |
| 515 | - if (function_exists("mb_convert_encoding")){ | |
| 520 | + if(function_exists("mb_convert_encoding") && $converteE == "sim"){ | |
| 516 | 521 | $titulo = mb_convert_encoding($titulo,"UTF-8","ISO-8859-1"); |
| 517 | 522 | $desc = mb_convert_encoding($desc,"UTF-8","ISO-8859-1"); |
| 518 | 523 | } |
| ... | ... | @@ -526,6 +531,8 @@ function dadosLinhaDoTempo($map_file,$tema,$ext="") |
| 526 | 531 | 'image'=>$image, |
| 527 | 532 | 'link'=>$link |
| 528 | 533 | ); |
| 534 | + $anos[] = $fim; | |
| 535 | + $anos[] = $dado[$iteminicio]; | |
| 529 | 536 | } |
| 530 | 537 | } |
| 531 | 538 | //echo "<pre>"; |
| ... | ... | @@ -533,7 +540,9 @@ function dadosLinhaDoTempo($map_file,$tema,$ext="") |
| 533 | 540 | "dateTimeFormat"=>$layer->getmetadata("ltempoformatodata"), |
| 534 | 541 | "wikiURL"=>"", |
| 535 | 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 | 173 | $i("totaleventos").innerHTML = retorno.data.events.length+" eventos"; |
| 174 | 174 | tl = Timeline.create(tl_el, bandInfos, Timeline.HORIZONTAL); |
| 175 | 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 | 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 | 180 | cpJSON.call(p,"void",retorna); | ... | ... |