diff options
author | mattpiwik <matthieu.aubry@gmail.com> | 2012-10-13 12:05:55 +0400 |
---|---|---|
committer | mattpiwik <matthieu.aubry@gmail.com> | 2012-10-13 12:05:55 +0400 |
commit | ae9741a49593e195ca128095c999464caca74995 (patch) | |
tree | 819226d63158c2cd38c20f168f451041521cace0 /core/DataTable/Filter/Pattern.php | |
parent | 034adf1ae3d2bd1e9287916213a41e693c859ff1 (diff) |
filter_pattern= will now work on metadata columns. This will be useful for example, if we wanted to select only a number of "countries", from the UserCountry.getCity API, we could do the following: &filter_column=country&filter_pattern=de|fr|es|it|nl
It will filter and only return only the Cities, which belong to the country specified. This will work ,because rows have a metadata <country>
Refs #1652
git-svn-id: http://dev.piwik.org/svn/trunk@7173 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'core/DataTable/Filter/Pattern.php')
-rw-r--r-- | core/DataTable/Filter/Pattern.php | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/core/DataTable/Filter/Pattern.php b/core/DataTable/Filter/Pattern.php index a640800bf1..9174203a25 100644 --- a/core/DataTable/Filter/Pattern.php +++ b/core/DataTable/Filter/Pattern.php @@ -75,8 +75,13 @@ class Piwik_DataTable_Filter_Pattern extends Piwik_DataTable_Filter //instead search must handle // - negative search with -piwik // - exact match with "" - // see (?!pattern) A subexpression that performs a negative lookahead search, which matches the search string at any point where a string not matching pattern begins. - if( !self::match($this->patternToSearch, $this->patternToSearchQuoted, $row->getColumn($this->columnToFilter), $this->invertedMatch)) + // see (?!pattern) A subexpression that performs a negative lookahead search, which matches the search string at any point where a string not matching pattern begins. + $value = $row->getColumn($this->columnToFilter); + if($value === false) + { + $value = $row->getMetadata($this->columnToFilter); + } + if( !self::match($this->patternToSearch, $this->patternToSearchQuoted, $value, $this->invertedMatch)) { $table->deleteRow($key); } |