diff options
author | matt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105> | 2009-04-06 10:46:59 +0400 |
---|---|---|
committer | matt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105> | 2009-04-06 10:46:59 +0400 |
commit | b8bd8cf1df9efcf41cc1b057805d12a91085bfe3 (patch) | |
tree | dfeea1da48bddd1c5f0e24660e85ecafb207c74f /plugins/Actions | |
parent | 3412d1bdc71e9d5f3eed2c22df3cc4e2913af629 (diff) |
- make sure all "Others" type legends are correct on all graphs
- regression: 'label' should always be first column, prettier in API results
- translate some text in plugin + show how easy it is to translate a plugin
Diffstat (limited to 'plugins/Actions')
-rw-r--r-- | plugins/Actions/Actions.php | 28 | ||||
-rw-r--r-- | plugins/Actions/Controller.php | 16 |
2 files changed, 33 insertions, 11 deletions
diff --git a/plugins/Actions/Actions.php b/plugins/Actions/Actions.php index 66ae089813..530e30eef9 100644 --- a/plugins/Actions/Actions.php +++ b/plugins/Actions/Actions.php @@ -64,12 +64,18 @@ class Piwik_Actions extends Piwik_Plugin Piwik_AddMenu('Actions_Actions', 'Actions_SubmenuDownloads', array('module' => 'Actions', 'action' => 'getDownloads')); } - static protected $invalidSummedColumnNameToRenamedName = array( + static protected $invalidSummedColumnNameToRenamedNameForPeriodArchive = array( 'nb_uniq_visitors' => 'sum_daily_nb_uniq_visitors', 'entry_nb_uniq_visitors' => 'sum_daily_entry_nb_uniq_visitors', 'exit_nb_uniq_visitors' => 'sum_daily_exit_nb_uniq_visitors', ); + protected static $invalidSummedColumnNameToDeleteFromDayArchive = array( + 'nb_uniq_visitors', + 'entry_nb_uniq_visitors', + 'exit_nb_uniq_visitors', + ); + function archivePeriod( $notification ) { $archiveProcessing = $notification->getNotificationObject(); @@ -78,7 +84,7 @@ class Piwik_Actions extends Piwik_Plugin 'Actions_downloads', 'Actions_outlink', ); - $archiveProcessing->archiveDataTable($dataTableToSum, self::$invalidSummedColumnNameToRenamedName, $this->maximumRowsInDataTableLevelZero, $this->maximumRowsInSubDataTable, $this->columnToSortByBeforeTruncation); + $archiveProcessing->archiveDataTable($dataTableToSum, self::$invalidSummedColumnNameToRenamedNameForPeriodArchive, $this->maximumRowsInDataTableLevelZero, $this->maximumRowsInSubDataTable, $this->columnToSortByBeforeTruncation); } /** @@ -189,16 +195,19 @@ class Piwik_Actions extends Piwik_Plugin protected function archiveDayRecordInDatabase($archiveProcessing) { $dataTable = Piwik_ArchiveProcessing_Day::generateDataTable($this->actionsTablesByType[Piwik_Tracker_Action::TYPE_ACTION]); + $this->deleteInvalidSummedColumnsFromDataTable($dataTable); $s = $dataTable->getSerialized( $this->maximumRowsInDataTableLevelZero, $this->maximumRowsInSubDataTable, $this->columnToSortByBeforeTruncation ); $archiveProcessing->insertBlobRecord('Actions_actions', $s); destroy($dataTable); $dataTable = Piwik_ArchiveProcessing_Day::generateDataTable($this->actionsTablesByType[Piwik_Tracker_Action::TYPE_DOWNLOAD]); + $this->deleteInvalidSummedColumnsFromDataTable($dataTable); $s = $dataTable->getSerialized($this->maximumRowsInDataTableLevelZero, $this->maximumRowsInSubDataTable, $this->columnToSortByBeforeTruncation ); $archiveProcessing->insertBlobRecord('Actions_downloads', $s); destroy($dataTable); $dataTable = Piwik_ArchiveProcessing_Day::generateDataTable($this->actionsTablesByType[Piwik_Tracker_Action::TYPE_OUTLINK]); + $this->deleteInvalidSummedColumnsFromDataTable($dataTable); $s = $dataTable->getSerialized( $this->maximumRowsInDataTableLevelZero, $this->maximumRowsInSubDataTable, $this->columnToSortByBeforeTruncation ); $archiveProcessing->insertBlobRecord('Actions_outlink', $s); destroy($dataTable); @@ -206,6 +215,20 @@ class Piwik_Actions extends Piwik_Plugin unset($this->actionsTablesByType); } + protected function deleteInvalidSummedColumnsFromDataTable($dataTable) + { + foreach($dataTable->getRows() as $row) + { + if(($idSubtable = $row->getIdSubDataTable()) !== null) + { + foreach(self::$invalidSummedColumnNameToDeleteFromDayArchive as $name) + { + $row->deleteColumn($name); + } + $this->deleteInvalidSummedColumnsFromDataTable(Piwik_DataTable_Manager::getInstance()->getTable($idSubtable)); + } + } + } static public function getActionExplodedNames($name, $type) { if($type == Piwik_Tracker_Action::TYPE_DOWNLOAD @@ -311,7 +334,6 @@ class Piwik_Actions extends Piwik_Plugin // just to make sure php copies the last $currentTable in the $parentTable array $currentTable =& $this->actionsTablesByType; - return $rowsProcessed; } } diff --git a/plugins/Actions/Controller.php b/plugins/Actions/Controller.php index 7b36fb8263..3f5e1a945e 100644 --- a/plugins/Actions/Controller.php +++ b/plugins/Actions/Controller.php @@ -107,10 +107,10 @@ class Piwik_Actions_Controller extends Piwik_Controller $view->disableShowAllColumns(); $view->setLimit( 100 ); - $view->setColumnsToDisplay( array('label','nb_hits','nb_uniq_visitors') ); + $view->setColumnsToDisplay( array('label','nb_hits','nb_visits') ); $view->setSortedColumn( 'nb_visits', 'desc' ); $view->setColumnTranslation('nb_hits', Piwik_Translate('General_ColumnPageviews')); - $view->setColumnTranslation('nb_uniq_visitors', Piwik_Translate('General_ColumnUniquePageviews')); + $view->setColumnTranslation('nb_visits', Piwik_Translate('General_ColumnUniquePageviews')); if(Piwik_Common::getRequestVar('enable_filter_excludelowpop', '0', 'string' ) != '0') { @@ -139,9 +139,9 @@ class Piwik_Actions_Controller extends Piwik_Controller protected function configureViewDownloads($view) { - $view->setColumnsToDisplay( array('label','nb_visits', 'nb_uniq_visitors') ); - $view->setColumnTranslation('nb_visits', Piwik_Translate('Actions_ColumnDownloads')); - $view->setColumnTranslation('nb_uniq_visitors', Piwik_Translate('Actions_ColumnUniqueDownloads')); + $view->setColumnsToDisplay( array('label','nb_visits','nb_hits') ); + $view->setColumnTranslation('nb_hits', Piwik_Translate('Actions_ColumnDownloads')); + $view->setColumnTranslation('nb_visits', Piwik_Translate('Actions_ColumnUniqueDownloads')); $view->setSortedColumn( 'nb_visits','desc' ); $view->disableExcludeLowPopulation(); $view->setLimit( 15 ); @@ -149,9 +149,9 @@ class Piwik_Actions_Controller extends Piwik_Controller protected function configureViewOutlinks($view) { - $view->setColumnsToDisplay( array('label','nb_visits','nb_uniq_visitors') ); - $view->setColumnTranslation('nb_visits', Piwik_Translate('Actions_ColumnClicks')); - $view->setColumnTranslation('nb_uniq_visitors', Piwik_Translate('Actions_ColumnUniqueClicks')); + $view->setColumnsToDisplay( array('label','nb_visits','nb_hits') ); + $view->setColumnTranslation('nb_hits', Piwik_Translate('Actions_ColumnClicks')); + $view->setColumnTranslation('nb_visits', Piwik_Translate('Actions_ColumnUniqueClicks')); $view->setSortedColumn( 'nb_visits','desc' ); $view->disableExcludeLowPopulation(); $view->setLimit( 15 ); |