diff options
author | mattpiwik <matthieu.aubry@gmail.com> | 2008-08-04 04:11:03 +0400 |
---|---|---|
committer | mattpiwik <matthieu.aubry@gmail.com> | 2008-08-04 04:11:03 +0400 |
commit | 2854426e8609e0f9e3ceac2e27327532bf00a408 (patch) | |
tree | 5214705435461179efecb331075a9830a21a5594 /core/DataTable/Filter/ExcludeLowPopulation.php | |
parent | 42b52b6d8a88b3fa4c4f3978c4e7bf00b1eac778 (diff) |
oops i totally screwed up my last commit, deleting /modules instead of renaming it...
git-svn-id: http://dev.piwik.org/svn/trunk@587 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'core/DataTable/Filter/ExcludeLowPopulation.php')
-rw-r--r-- | core/DataTable/Filter/ExcludeLowPopulation.php | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/core/DataTable/Filter/ExcludeLowPopulation.php b/core/DataTable/Filter/ExcludeLowPopulation.php new file mode 100644 index 0000000000..cb038d6d78 --- /dev/null +++ b/core/DataTable/Filter/ExcludeLowPopulation.php @@ -0,0 +1,50 @@ +<?php +/** + * Piwik - Open source web analytics + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later + * @version $Id: ExcludeLowPopulation.php 519 2008-06-09 01:59:24Z matt $ + * + * @package Piwik_DataTable + */ + +/** + * Delete all rows that have a $columnToFilter value less than the $minimumValue + * + * For example we delete from the countries report table all countries that have less than 3 visits. + * It is very useful to exclude noise from the reports. + * You can obviously apply this filter on a percentaged column, eg. remove all countries with the column 'percent_visits' less than 0.05 + * + * @package Piwik_DataTable + * @subpackage Piwik_DataTable_Filter + */ +class Piwik_DataTable_Filter_ExcludeLowPopulation extends Piwik_DataTable_Filter +{ + static public $minimumValue; + public function __construct( $table, $columnToFilter, $minimumValue ) + { + $this->columnToFilter = $columnToFilter; + self::$minimumValue = $minimumValue; + parent::__construct($table); + $this->filter(); + } + + function filter() + { + $function = array("Piwik_DataTable_Filter_ExcludeLowPopulation", + "excludeLowPopulation"); + + $filter = new Piwik_DataTable_Filter_ColumnCallbackDeleteRow( + $this->table, + $this->columnToFilter, + $function + ); + } + + static public function excludeLowPopulation($value) + { + return $value >= self::$minimumValue; + } +} + |