| 1 | --- C:/DOCUME~1/WUT~1.CSI/LOCALS~1/Temp/DataTable.p-revBASE.svn002.tmp.php ÐÇÆÚÒ» ¶þÔÂ 22 11:12:38 2010
|
|---|
| 2 | +++ C:/Documents and Settings/wut.CSIP-0310117/My Documents/piwik-new/DataTable.php ÐÇÆÚÒ» ¶þÔÂ 22 11:01:45 2010
|
|---|
| 3 | @@ -147,6 +147,9 @@
|
|---|
| 4 | */
|
|---|
| 5 | protected $currentId;
|
|---|
| 6 |
|
|---|
| 7 | + protected $nextRowId = 0;//new added
|
|---|
| 8 | +
|
|---|
| 9 | +
|
|---|
| 10 | /**
|
|---|
| 11 | * Current depth level of this data table
|
|---|
| 12 | * 0 is the parent data table
|
|---|
| 13 | @@ -160,7 +163,7 @@
|
|---|
| 14 | *
|
|---|
| 15 | * @var bool
|
|---|
| 16 | */
|
|---|
| 17 | - protected $indexNotUpToDate = true;
|
|---|
| 18 | + //protected $indexNotUpToDate = true;
|
|---|
| 19 |
|
|---|
| 20 | /**
|
|---|
| 21 | * This flag sets the index to be rebuild whenever a new row is added,
|
|---|
| 22 | @@ -170,7 +173,7 @@
|
|---|
| 23 | *
|
|---|
| 24 | * @var bool
|
|---|
| 25 | */
|
|---|
| 26 | - protected $rebuildIndexContinuously = false;
|
|---|
| 27 | + //protected $rebuildIndexContinuously = false;
|
|---|
| 28 |
|
|---|
| 29 | /**
|
|---|
| 30 | * Column name of last time the table was sorted
|
|---|
| 31 | @@ -252,7 +255,7 @@
|
|---|
| 32 | */
|
|---|
| 33 | public function sort( $functionCallback, $columnSortedBy )
|
|---|
| 34 | {
|
|---|
| 35 | - $this->indexNotUpToDate = true;
|
|---|
| 36 | + //$this->indexNotUpToDate = true;
|
|---|
| 37 | $this->tableSortedBy = $columnSortedBy;
|
|---|
| 38 | usort( $this->rows, $functionCallback );
|
|---|
| 39 |
|
|---|
| 40 | @@ -414,12 +417,12 @@
|
|---|
| 41 | */
|
|---|
| 42 | public function getRowFromLabel( $label )
|
|---|
| 43 | {
|
|---|
| 44 | - $this->rebuildIndexContinuously = true;
|
|---|
| 45 | + /* $this->rebuildIndexContinuously = true;
|
|---|
| 46 | if($this->indexNotUpToDate)
|
|---|
| 47 | {
|
|---|
| 48 | $this->rebuildIndex();
|
|---|
| 49 | }
|
|---|
| 50 | -
|
|---|
| 51 | + */
|
|---|
| 52 | if($label === self::LABEL_SUMMARY_ROW
|
|---|
| 53 | && !is_null($this->summaryRow))
|
|---|
| 54 | {
|
|---|
| 55 | @@ -437,6 +440,8 @@
|
|---|
| 56 | /**
|
|---|
| 57 | * Rebuilds the index used to lookup a row by label
|
|---|
| 58 | */
|
|---|
| 59 | +
|
|---|
| 60 | + /*
|
|---|
| 61 | private function rebuildIndex()
|
|---|
| 62 | {
|
|---|
| 63 | foreach($this->rows as $id => $row)
|
|---|
| 64 | @@ -449,7 +454,7 @@
|
|---|
| 65 | }
|
|---|
| 66 | $this->indexNotUpToDate = false;
|
|---|
| 67 | }
|
|---|
| 68 | -
|
|---|
| 69 | + */
|
|---|
| 70 | /**
|
|---|
| 71 | * Returns the ith row in the array
|
|---|
| 72 | *
|
|---|
| 73 | @@ -496,17 +501,19 @@
|
|---|
| 74 | */
|
|---|
| 75 | public function addRow( Piwik_DataTable_Row $row )
|
|---|
| 76 | {
|
|---|
| 77 | - $this->rows[] = $row;
|
|---|
| 78 | - if(!$this->indexNotUpToDate
|
|---|
| 79 | - && $this->rebuildIndexContinuously)
|
|---|
| 80 | - {
|
|---|
| 81 | + $this->rows[] = $row;
|
|---|
| 82 | + //if(!$this->indexNotUpToDate
|
|---|
| 83 | + // && $this->rebuildIndexContinuously)
|
|---|
| 84 | + //{
|
|---|
| 85 | $label = $row->getColumn('label');
|
|---|
| 86 | if($label !== false)
|
|---|
| 87 | {
|
|---|
| 88 | - $this->rowsIndexByLabel[$label] = count($this->rows)-1;
|
|---|
| 89 | + //$this->rowsIndexByLabel[$label] = count($this->rows)-1;
|
|---|
| 90 | + $this->rowsIndexByLabel[$label] = $this->nextRowId;
|
|---|
| 91 | + $this->nextRowId++;
|
|---|
| 92 | }
|
|---|
| 93 | $this->indexNotUpToDate = false;
|
|---|
| 94 | - }
|
|---|
| 95 | + //}
|
|---|
| 96 | }
|
|---|
| 97 |
|
|---|
| 98 | /**
|
|---|
| 99 | @@ -816,8 +823,8 @@
|
|---|
| 100 | $rows1 = $table1->getRows();
|
|---|
| 101 | $rows2 = $table2->getRows();
|
|---|
| 102 |
|
|---|
| 103 | - $table1->rebuildIndex();
|
|---|
| 104 | - $table2->rebuildIndex();
|
|---|
| 105 | + //$table1->rebuildIndex();
|
|---|
| 106 | + //$table2->rebuildIndex();
|
|---|
| 107 |
|
|---|
| 108 | if($table1->getRowsCount() != $table2->getRowsCount())
|
|---|
| 109 | {
|
|---|