Commit 181864dbcf81b7bd86c78bdfc48c09239f659e1c
1 parent
369860d5
Exists in
master
and in
7 other branches
Correção na listagem de elementos selecionados na ferramenta tabela
Showing
2 changed files
with
25 additions
and
12 deletions
Show diff stats
classesphp/classe_atributos.php
| ... | ... | @@ -438,7 +438,7 @@ class Atributos |
| 438 | 438 | else{ |
| 439 | 439 | $alias = $items; |
| 440 | 440 | } |
| 441 | - $shapes = retornaShapesSelecionados($this->layer,$this->arquivo,$this->mapa); | |
| 441 | + $shapes = retornaShapesSelecionados($this->layer,$this->arquivo,$this->mapa,true); | |
| 442 | 442 | $res_count = count($shapes); |
| 443 | 443 | $resultadoFinal[] = array("totalSelecionados"=>$res_count,"itens"=>$items,"alias"=>$alias); |
| 444 | 444 | $registros = array(); |
| ... | ... | @@ -451,6 +451,11 @@ class Atributos |
| 451 | 451 | } |
| 452 | 452 | if ($tipolista == "selecionados"){ |
| 453 | 453 | $chk = "CHECKED"; |
| 454 | + //cria um novo array apenas para funcionar no contador | |
| 455 | + $s = array(); | |
| 456 | + foreach($shapes as $shape){ | |
| 457 | + $s[] = $shape; | |
| 458 | + } | |
| 454 | 459 | if ($fim != ""){ |
| 455 | 460 | if (($res_count >= $fim) && ($fim < $res_count)){ |
| 456 | 461 | $res_count = $fim; |
| ... | ... | @@ -458,7 +463,7 @@ class Atributos |
| 458 | 463 | } |
| 459 | 464 | for ($i = $inicio; $i < $res_count; ++$i){ |
| 460 | 465 | $valitem = array(); |
| 461 | - $shape = $shapes[$i]; | |
| 466 | + $shape = $s[$i]; | |
| 462 | 467 | $indx = $shape->index; |
| 463 | 468 | foreach ($items as $item){ |
| 464 | 469 | $valori = trim($shape->values[$item]); |
| ... | ... | @@ -483,12 +488,8 @@ class Atributos |
| 483 | 488 | } |
| 484 | 489 | if ($tipolista == "tudo"){ |
| 485 | 490 | //ini_set('memory_limit', '500M'); |
| 486 | - $shp_atual = array(); | |
| 487 | - for ($i = 0; $i < $res_count;++$i){ | |
| 488 | - $shp_atual[$i] = $shapes[$i];; | |
| 489 | - } | |
| 491 | + $shp_atual = $shapes; | |
| 490 | 492 | $chk = ""; |
| 491 | - | |
| 492 | 493 | if (@$this->layer->queryByrect($this->mapa->extent) == MS_SUCCESS){ |
| 493 | 494 | $res_count = $this->layer->getNumresults(); |
| 494 | 495 | $totalGeral = $res_count; | ... | ... |
classesphp/funcoes_gerais.php
| ... | ... | @@ -2465,7 +2465,7 @@ function retornaShapesMapext($objLayer,$objMapa){ |
| 2465 | 2465 | $objLayer->close(); |
| 2466 | 2466 | return $shapes; |
| 2467 | 2467 | } |
| 2468 | -function retornaShapesSelecionados($objLayer,$map_file,$objMapa){ | |
| 2468 | +function retornaShapesSelecionados($objLayer,$map_file,$objMapa,$indexado=false){ | |
| 2469 | 2469 | $shapes = array(); |
| 2470 | 2470 | $qyfile = dirname($map_file)."/".$objLayer->name.".php"; |
| 2471 | 2471 | |
| ... | ... | @@ -2497,14 +2497,21 @@ function retornaShapesSelecionados($objLayer,$map_file,$objMapa){ |
| 2497 | 2497 | |
| 2498 | 2498 | for ($i = 0; $i < $res_count; ++$i) |
| 2499 | 2499 | { |
| 2500 | - if($versao == 6) | |
| 2501 | - {$shape = $objLayer->getShape($objLayer->getResult($i));} | |
| 2500 | + if($versao == 6){ | |
| 2501 | + $shape = $objLayer->getShape($objLayer->getResult($i)); | |
| 2502 | + $shp_index = $shape->index; | |
| 2503 | + } | |
| 2502 | 2504 | else{ |
| 2503 | 2505 | $result = $objLayer->getResult($i); |
| 2504 | 2506 | $shp_index = $result->shapeindex; |
| 2505 | 2507 | $shape = $objLayer->getfeature($shp_index,-1); |
| 2506 | 2508 | } |
| 2507 | - $shapes[] = $shape; | |
| 2509 | + if($indexado == true){ | |
| 2510 | + $shapes[$shp_index] = $shape; | |
| 2511 | + } | |
| 2512 | + else{ | |
| 2513 | + $shapes[] = $shape; | |
| 2514 | + } | |
| 2508 | 2515 | } |
| 2509 | 2516 | $fechou = $objLayer->close(); |
| 2510 | 2517 | } |
| ... | ... | @@ -2520,7 +2527,12 @@ function retornaShapesSelecionados($objLayer,$map_file,$objMapa){ |
| 2520 | 2527 | while ($shape = $objLayer->nextShape()) |
| 2521 | 2528 | { |
| 2522 | 2529 | if(in_array($shape->index,$listaDeIndices)){ |
| 2523 | - $shapes[] = $shape; | |
| 2530 | + if($indexado == true){ | |
| 2531 | + $shapes[$shape->index] = $shape; | |
| 2532 | + } | |
| 2533 | + else{ | |
| 2534 | + $shapes[] = $shape; | |
| 2535 | + } | |
| 2524 | 2536 | } |
| 2525 | 2537 | } |
| 2526 | 2538 | $objLayer->close(); | ... | ... |