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>2008-08-04 04:11:03 +0400
committermattpiwik <matthieu.aubry@gmail.com>2008-08-04 04:11:03 +0400
commit2854426e8609e0f9e3ceac2e27327532bf00a408 (patch)
tree5214705435461179efecb331075a9830a21a5594 /core/DataTable/Filter/Pattern.php
parent42b52b6d8a88b3fa4c4f3978c4e7bf00b1eac778 (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/Pattern.php')
-rw-r--r--core/DataTable/Filter/Pattern.php44
1 files changed, 44 insertions, 0 deletions
diff --git a/core/DataTable/Filter/Pattern.php b/core/DataTable/Filter/Pattern.php
new file mode 100644
index 0000000000..aabccd1911
--- /dev/null
+++ b/core/DataTable/Filter/Pattern.php
@@ -0,0 +1,44 @@
+<?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: Pattern.php 444 2008-04-11 13:38:22Z johmathe $
+ *
+ * @package Piwik_DataTable
+ */
+
+/**
+ * Delete all rows for which the given $columnToFilter do not contain the $patternToSearch
+ * This filter is to be used on columns containing strings.
+ * Exemple: fron the keyword report, keep only the rows for which the label contains "piwik"
+ *
+ * @package Piwik_DataTable
+ * @subpackage Piwik_DataTable_Filter
+ */
+class Piwik_DataTable_Filter_Pattern extends Piwik_DataTable_Filter
+{
+ private $columnToFilter;
+ private $patternToSearch;
+
+ public function __construct( $table, $columnToFilter, $patternToSearch )
+ {
+ parent::__construct($table);
+ $this->patternToSearch = $patternToSearch;
+ $this->columnToFilter = $columnToFilter;
+ $this->filter();
+ }
+
+ protected function filter()
+ {
+ foreach($this->table->getRows() as $key => $row)
+ {
+ if( stripos($row->getColumn($this->columnToFilter), $this->patternToSearch) === false)
+ {
+ $this->table->deleteRow($key);
+ }
+ }
+ }
+}
+