diff options
author | diosmosis <benakamoorthi@fastmail.fm> | 2013-10-22 09:57:33 +0400 |
---|---|---|
committer | diosmosis <benakamoorthi@fastmail.fm> | 2013-10-22 09:57:54 +0400 |
commit | 777fa7f0b8963dc3ea5e0d47b1da3ec85cf93eb7 (patch) | |
tree | c4ce14f444222c26d0f2998f96ff0e6a66a6e102 /core/DataTable/Filter/Truncate.php | |
parent | 66add89b764c709869c1b4976a4a447a4e61be4c (diff) |
Refs #4200, move AddSummaryRow logic to Truncate, change AddSummaryRow logic to just add a summary row and fix bug in FrontController.
Diffstat (limited to 'core/DataTable/Filter/Truncate.php')
-rw-r--r-- | core/DataTable/Filter/Truncate.php | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/core/DataTable/Filter/Truncate.php b/core/DataTable/Filter/Truncate.php index 56aa4ea5b2..c803653a2d 100644 --- a/core/DataTable/Filter/Truncate.php +++ b/core/DataTable/Filter/Truncate.php @@ -13,6 +13,7 @@ namespace Piwik\DataTable\Filter; use Piwik\DataTable\Filter; use Piwik\DataTable; use Piwik\DataTable\Manager; +use Piwik\DataTable\Row; /** * @package Piwik @@ -47,14 +48,12 @@ class Truncate extends Filter public function filter($table) { $this->addSummaryRow($table); - $table->filter('ReplaceSummaryRowLabel'); + $table->queueFilter('ReplaceSummaryRowLabel'); if ($this->filterRecursive) { foreach ($table->getRows() as $row) { if ($row->isSubtableLoaded()) { - $idSubTable = $row->getIdSubDataTable(); - $subTable = Manager::getInstance()->getTable($idSubTable); - $subTable->filter('Truncate', array($this->truncateAfter)); + $this->filter($row->getSubtable()); } } } @@ -65,14 +64,14 @@ class Truncate extends Filter $table->filter('Sort', array($this->columnToSortByBeforeTruncating, 'desc')); - if ($table->getRowsCount() <= $this->startRowToSummarize + 1) { + if ($table->getRowsCount() <= $this->truncateAfter + 1) { return; } $rows = $table->getRows(); $count = $table->getRowsCount(); $newRow = new Row(); - for ($i = $this->startRowToSummarize; $i < $count; $i++) { + for ($i = $this->truncateAfter; $i < $count; $i++) { if (!isset($rows[$i])) { // case when the last row is a summary row, it is not indexed by $cout but by DataTable::ID_SUMMARY_ROW $summaryRow = $table->getRowFromId(DataTable::ID_SUMMARY_ROW); @@ -88,7 +87,7 @@ class Truncate extends Filter $newRow->setColumns(array('label' => $this->labelSummaryRow) + $newRow->getColumns()); if ($this->deleteRows) { - $table->filter('Limit', array(0, $this->startRowToSummarize)); + $table->filter('Limit', array(0, $this->truncateAfter)); } $table->addSummaryRow($newRow); unset($rows); |