<?php
 for($i=$displayMatrixDetails['colsTotalsTh']['y'];$i<$displayMatrixDetails['colsTotalsTh']['y']+$displayMatrixDetails['colsTotalsTh']['height'];$i++) { $someDeletion=false; for($j=0;$j<$displayMatrixDetails['finish']['x'];$j++) { if ($pivotDisplayMatrix[$i][$j]['totals']) { if ($pivotTotalsDetails['disable']['cols'][ $pivotDisplayMatrix[$i][$j]['totals'] ]) { unset($pivotDisplayMatrix[$i][$j]); $someDeletion=true; } } } if ($someDeletion) { $displayMatrixDetails['finish']['height']--; } } for($j=$displayMatrixDetails['rowsTotalsTh']['x'];$j<$displayMatrixDetails['rowsTotalsTh']['x']+$displayMatrixDetails['rowsTotalsTh']['width'];$j++) { $someDeletion=false; for($i=0;$i<$displayMatrixDetails['finish']['y'];$i++) { if ($pivotDisplayMatrix[$i][$j]['totals']) { if ($pivotTotalsDetails['disable']['rows'][ $pivotDisplayMatrix[$i][$j]['totals'] ]) { unset($pivotDisplayMatrix[$i][$j]); $someDeletion=true; } } } if ($someDeletion) { $displayMatrixDetails['finish']['width']--; } } unset($pivotDisplayMatrix[$displayMatrixDetails['finish']['y']][$displayMatrixDetails['finish']['x']]); for($i=$displayMatrixDetails['colsTotalsTh']['y'];$i<$displayMatrixDetails['colsTotalsTh']['y']+$displayMatrixDetails['colsTotalsTh']['height'];$i++) { if (!$pivotDisplayMatrix[$i]) { for($j=$i+1;$j<$displayMatrixDetails['colsTotalsTh']['y']+$displayMatrixDetails['colsTotalsTh']['height'];$j++) { if ($pivotDisplayMatrix[$j]) { $pivotDisplayMatrix[$i]=$pivotDisplayMatrix[$j]; $pivotDisplayMatrix[$j]= []; break; } } } } $colsTotalsHeight=0; for($i=$displayMatrixDetails['colsTotalsTh']['y'];$i<$displayMatrixDetails['colsTotalsTh']['y']+$displayMatrixDetails['colsTotalsTh']['height'];$i++) { if ($pivotDisplayMatrix[$i]) { $colsTotalsHeight++; } else { unset($pivotDisplayMatrix[$i]); } } $displayMatrixDetails['colsTotalsTh']['height']=$colsTotalsHeight; for($j=$displayMatrixDetails['rowsTotalsTh']['x'];$j<$displayMatrixDetails['rowsTotalsTh']['x']+$displayMatrixDetails['rowsTotalsTh']['width'];$j++) { if (!$pivotDisplayMatrix[0][$j]) { for($j2=$j+1;$j2<$displayMatrixDetails['rowsTotalsTh']['x']+$displayMatrixDetails['rowsTotalsTh']['width'];$j2++) { if ($pivotDisplayMatrix[0][$j2]) { for($i=0;$i<$displayMatrixDetails['finish']['y'];$i++) { if ($pivotDisplayMatrix[$i][$j2]) { $pivotDisplayMatrix[$i][$j]=$pivotDisplayMatrix[$i][$j2]; unset($pivotDisplayMatrix[$i][$j2]); } } break; } } } } $rowsTotalsWidth=0; for($j=$displayMatrixDetails['rowsTotalsTh']['x'];$j<$displayMatrixDetails['rowsTotalsTh']['x']+$displayMatrixDetails['rowsTotalsTh']['width'];$j++) { if ($pivotDisplayMatrix[0][$j]) { $rowsTotalsWidth++; } } $displayMatrixDetails['rowsTotalsTh']['width']=$rowsTotalsWidth; if (!$displayMatrixDetails['finish']['width'] or !$displayMatrixDetails['finish']['height']) { unset( $pivotDisplayMatrix [$displayMatrixDetails['finish']['y']] [$displayMatrixDetails['finish']['x']] ); } else { unset($pivotDisplayMatrix[$displayMatrixDetails['finish']['y']][$displayMatrixDetails['finish']['x']]['colspan']); unset($pivotDisplayMatrix[$displayMatrixDetails['finish']['y']][$displayMatrixDetails['finish']['x']]['rowspan']); $pivotDisplayMatrix[$displayMatrixDetails['finish']['y']][$displayMatrixDetails['finish']['x']]['region']="finish"; $pivotDisplayMatrix[$displayMatrixDetails['finish']['y']][$displayMatrixDetails['finish']['x']]['content']=''; if ($displayMatrixDetails['finish']['width']>1) $pivotDisplayMatrix[$displayMatrixDetails['finish']['y']][$displayMatrixDetails['finish']['x']]['colspan']=$displayMatrixDetails['finish']['width']; if ($displayMatrixDetails['finish']['height']>1) $pivotDisplayMatrix[$displayMatrixDetails['finish']['y']][$displayMatrixDetails['finish']['x']]['rowspan']=$displayMatrixDetails['finish']['height']; } ?>