Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormattpiwik <matthieu.aubry@gmail.com>2010-05-20 12:49:42 +0400
committermattpiwik <matthieu.aubry@gmail.com>2010-05-20 12:49:42 +0400
commitcbcd8959500010bfe55a584cc53c33219608292a (patch)
tree1fc438c3f9acbe69e4dbcf8c86d314344ce69e32 /core/DataTable/Filter/ColumnCallbackAddColumnPercentage.php
parent49cf72f67e75681906d35d8ce7461707c7378582 (diff)
Fixes #306
- Adds new columns to the existing Pages report: Bounce rate, Average time on page, Exit rate - Adds new report: Entry pages - Adds new report: Exit pages - Adding table column inline help (on hover). Note: I don't think my metrics definitions are the best, they can be improved. anyone? I tried to add this icon: http://cdn.iconfinder.net/data/icons/uidesignicons/information.png but couldn't manage to make it look pretty (icon was either not positionned properly, or when it was positionned properly, it would appear in the dashboard even for columns that are hidden - the icon appeared out of nowhere..) git-svn-id: http://dev.piwik.org/svn/trunk@2202 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'core/DataTable/Filter/ColumnCallbackAddColumnPercentage.php')
-rw-r--r--core/DataTable/Filter/ColumnCallbackAddColumnPercentage.php51
1 files changed, 3 insertions, 48 deletions
diff --git a/core/DataTable/Filter/ColumnCallbackAddColumnPercentage.php b/core/DataTable/Filter/ColumnCallbackAddColumnPercentage.php
index f4d4ac7e01..d63d8298e3 100644
--- a/core/DataTable/Filter/ColumnCallbackAddColumnPercentage.php
+++ b/core/DataTable/Filter/ColumnCallbackAddColumnPercentage.php
@@ -25,55 +25,10 @@
* @package Piwik
* @subpackage Piwik_DataTable
*/
-class Piwik_DataTable_Filter_ColumnCallbackAddColumnPercentage extends Piwik_DataTable_Filter
+class Piwik_DataTable_Filter_ColumnCallbackAddColumnPercentage extends Piwik_DataTable_Filter_ColumnCallbackAddColumnQuotient
{
- private $columnValueToRead;
- private $columnNamePercentageToAdd;
- private $columnNameUsedAsDivisor;
- private $totalValueUsedAsDivisor;
- private $percentagePrecision;
-
- /**
- * @param Piwik_DataTable $table
- * @param string $columnValueToRead
- * @param string $columnNamePercentageToAdd
- * @param numeric|string $totalValueUsedToComputePercentageOrColumnName
- * if a numeric value is given, we use this value as the divisor to process the percentage.
- * if a string is given, this string is the column name's value used as the divisor.
- * @param int $percentagePrecision precision 0 means "11", 1 means "11.2"
- */
- public function __construct( $table, $columnValueToRead, $columnNamePercentageToAdd, $totalValueUsedToComputePercentageOrColumnName, $percentagePrecision = 0 )
+ protected function formatValue($value, $divisor)
{
- parent::__construct($table);
- $this->columnValueToRead = $columnValueToRead;
- $this->columnNamePercentageToAdd = $columnNamePercentageToAdd;
- if(is_numeric($totalValueUsedToComputePercentageOrColumnName))
- {
- $this->totalValueUsedAsDivisor = $totalValueUsedToComputePercentageOrColumnName;
- }
- else
- {
- $this->columnNameUsedAsDivisor = $totalValueUsedToComputePercentageOrColumnName;
- }
- $this->percentagePrecision = $percentagePrecision;
- $this->filter();
- }
-
- protected function filter()
- {
- foreach($this->table->getRows() as $key => $row)
- {
- $value = $row->getColumn($this->columnValueToRead);
- if(!is_null($this->totalValueUsedAsDivisor))
- {
- $divisor = $this->totalValueUsedAsDivisor;
- }
- else
- {
- $divisor = $row->getColumn($this->columnNameUsedAsDivisor);
- }
- $percentage = Piwik::getPercentageSafe($value, $divisor, $this->percentagePrecision);
- $row->addColumn($this->columnNamePercentageToAdd, $percentage);
- }
+ return Piwik::getPercentageSafe($value, $divisor, $this->quotientPrecision) . '%';
}
}