2008-08-11 01:29:30 +02:00
|
|
|
<?php
|
|
|
|
/**
|
2012-04-12 08:02:46 +02:00
|
|
|
* @package framework
|
2008-08-11 01:29:30 +02:00
|
|
|
* @subpackage search
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Checks if a value is in a given set.
|
|
|
|
* SQL syntax used: Column IN ('val1','val2')
|
2012-09-06 09:54:44 +02:00
|
|
|
* @deprecated 3.1 Use ExactMatchFilter instead
|
2008-08-11 01:29:30 +02:00
|
|
|
*
|
2012-04-12 08:02:46 +02:00
|
|
|
* @package framework
|
2010-04-23 02:11:41 +02:00
|
|
|
* @subpackage search
|
2008-08-11 01:29:30 +02:00
|
|
|
*/
|
|
|
|
class ExactMatchMultiFilter extends SearchFilter {
|
2012-09-20 09:26:05 +02:00
|
|
|
function __construct($fullName, $value = false, array $modifiers = array()) {
|
2012-09-06 09:54:44 +02:00
|
|
|
Deprecation::notice('3.1', 'Use ExactMatchFilter instead.');
|
2012-09-20 09:26:05 +02:00
|
|
|
parent::__construct($fullName, $value, $modifiers);
|
2012-09-06 09:54:44 +02:00
|
|
|
}
|
2008-08-11 01:29:30 +02:00
|
|
|
|
2011-03-21 09:37:55 +01:00
|
|
|
public function apply(DataQuery $query) {
|
2012-09-06 09:54:44 +02:00
|
|
|
if (!is_array($this->getValue())) {
|
2008-08-11 05:39:14 +02:00
|
|
|
$values = explode(',',$this->getValue());
|
2012-09-06 09:54:44 +02:00
|
|
|
} else {
|
|
|
|
$values = $this->getValue();
|
2008-08-11 05:39:14 +02:00
|
|
|
}
|
2012-09-20 09:26:05 +02:00
|
|
|
$filter = new ExactMatchFilter($this->getFullName(), $values, $this->getModifiers());
|
2012-09-06 09:54:44 +02:00
|
|
|
return $filter->apply($query);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function applyOne(DataQuery $query) {
|
|
|
|
/* NO OP */
|
|
|
|
}
|
|
|
|
|
|
|
|
public function exclude(DataQuery $query) {
|
|
|
|
if (!is_array($this->getValue())) {
|
|
|
|
$values = explode(',',$this->getValue());
|
|
|
|
} else {
|
|
|
|
$values = $this->getValue();
|
2008-08-11 01:29:30 +02:00
|
|
|
}
|
2012-09-20 09:26:05 +02:00
|
|
|
$filter = new ExactMatchFilter($this->getFullName(), $values, $this->getModifiers());
|
2012-09-06 09:54:44 +02:00
|
|
|
return $filter->exclude($query);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function excludeOne(DataQuery $query) {
|
|
|
|
/* NO OP */
|
2008-08-11 01:29:30 +02:00
|
|
|
}
|
|
|
|
|
2008-08-11 02:03:57 +02:00
|
|
|
public function isEmpty() {
|
2012-09-06 09:54:44 +02:00
|
|
|
return $this->getValue() === array() || $this->getValue() === null || $this->getValue() === '';
|
2008-08-11 02:03:57 +02:00
|
|
|
}
|
2008-08-11 01:29:30 +02:00
|
|
|
}
|