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,7 +438,7 @@ class Atributos | ||
438 | else{ | 438 | else{ |
439 | $alias = $items; | 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 | $res_count = count($shapes); | 442 | $res_count = count($shapes); |
443 | $resultadoFinal[] = array("totalSelecionados"=>$res_count,"itens"=>$items,"alias"=>$alias); | 443 | $resultadoFinal[] = array("totalSelecionados"=>$res_count,"itens"=>$items,"alias"=>$alias); |
444 | $registros = array(); | 444 | $registros = array(); |
@@ -451,6 +451,11 @@ class Atributos | @@ -451,6 +451,11 @@ class Atributos | ||
451 | } | 451 | } |
452 | if ($tipolista == "selecionados"){ | 452 | if ($tipolista == "selecionados"){ |
453 | $chk = "CHECKED"; | 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 | if ($fim != ""){ | 459 | if ($fim != ""){ |
455 | if (($res_count >= $fim) && ($fim < $res_count)){ | 460 | if (($res_count >= $fim) && ($fim < $res_count)){ |
456 | $res_count = $fim; | 461 | $res_count = $fim; |
@@ -458,7 +463,7 @@ class Atributos | @@ -458,7 +463,7 @@ class Atributos | ||
458 | } | 463 | } |
459 | for ($i = $inicio; $i < $res_count; ++$i){ | 464 | for ($i = $inicio; $i < $res_count; ++$i){ |
460 | $valitem = array(); | 465 | $valitem = array(); |
461 | - $shape = $shapes[$i]; | 466 | + $shape = $s[$i]; |
462 | $indx = $shape->index; | 467 | $indx = $shape->index; |
463 | foreach ($items as $item){ | 468 | foreach ($items as $item){ |
464 | $valori = trim($shape->values[$item]); | 469 | $valori = trim($shape->values[$item]); |
@@ -483,12 +488,8 @@ class Atributos | @@ -483,12 +488,8 @@ class Atributos | ||
483 | } | 488 | } |
484 | if ($tipolista == "tudo"){ | 489 | if ($tipolista == "tudo"){ |
485 | //ini_set('memory_limit', '500M'); | 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 | $chk = ""; | 492 | $chk = ""; |
491 | - | ||
492 | if (@$this->layer->queryByrect($this->mapa->extent) == MS_SUCCESS){ | 493 | if (@$this->layer->queryByrect($this->mapa->extent) == MS_SUCCESS){ |
493 | $res_count = $this->layer->getNumresults(); | 494 | $res_count = $this->layer->getNumresults(); |
494 | $totalGeral = $res_count; | 495 | $totalGeral = $res_count; |
classesphp/funcoes_gerais.php
@@ -2465,7 +2465,7 @@ function retornaShapesMapext($objLayer,$objMapa){ | @@ -2465,7 +2465,7 @@ function retornaShapesMapext($objLayer,$objMapa){ | ||
2465 | $objLayer->close(); | 2465 | $objLayer->close(); |
2466 | return $shapes; | 2466 | return $shapes; |
2467 | } | 2467 | } |
2468 | -function retornaShapesSelecionados($objLayer,$map_file,$objMapa){ | 2468 | +function retornaShapesSelecionados($objLayer,$map_file,$objMapa,$indexado=false){ |
2469 | $shapes = array(); | 2469 | $shapes = array(); |
2470 | $qyfile = dirname($map_file)."/".$objLayer->name.".php"; | 2470 | $qyfile = dirname($map_file)."/".$objLayer->name.".php"; |
2471 | 2471 | ||
@@ -2497,14 +2497,21 @@ function retornaShapesSelecionados($objLayer,$map_file,$objMapa){ | @@ -2497,14 +2497,21 @@ function retornaShapesSelecionados($objLayer,$map_file,$objMapa){ | ||
2497 | 2497 | ||
2498 | for ($i = 0; $i < $res_count; ++$i) | 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 | else{ | 2504 | else{ |
2503 | $result = $objLayer->getResult($i); | 2505 | $result = $objLayer->getResult($i); |
2504 | $shp_index = $result->shapeindex; | 2506 | $shp_index = $result->shapeindex; |
2505 | $shape = $objLayer->getfeature($shp_index,-1); | 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 | $fechou = $objLayer->close(); | 2516 | $fechou = $objLayer->close(); |
2510 | } | 2517 | } |
@@ -2520,7 +2527,12 @@ function retornaShapesSelecionados($objLayer,$map_file,$objMapa){ | @@ -2520,7 +2527,12 @@ function retornaShapesSelecionados($objLayer,$map_file,$objMapa){ | ||
2520 | while ($shape = $objLayer->nextShape()) | 2527 | while ($shape = $objLayer->nextShape()) |
2521 | { | 2528 | { |
2522 | if(in_array($shape->index,$listaDeIndices)){ | 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 | $objLayer->close(); | 2538 | $objLayer->close(); |