2008-08-09 06:38:44 +02:00
|
|
|
<?php
|
2008-08-09 08:40:50 +02:00
|
|
|
/**
|
|
|
|
* @package sapphire
|
|
|
|
* @subpackage search
|
|
|
|
*/
|
|
|
|
|
2008-08-09 06:38:44 +02:00
|
|
|
/**
|
|
|
|
* Uses a substring match against content in column rows.
|
|
|
|
*
|
|
|
|
* @package sapphire
|
|
|
|
* @subpackage search
|
|
|
|
*/
|
|
|
|
class SubstringFilter extends SearchFilter {
|
|
|
|
|
2011-03-21 09:37:55 +01:00
|
|
|
public function apply(DataQuery $query) {
|
2011-12-09 12:49:24 +01:00
|
|
|
$this->model = $query->applyRelation($this->relation);
|
2011-04-05 13:01:57 +02:00
|
|
|
return $query->where(sprintf(
|
2008-10-05 21:20:35 +02:00
|
|
|
"LOCATE('%s', %s) != 0",
|
|
|
|
Convert::raw2sql($this->getValue()),
|
|
|
|
$this->getDbName()
|
|
|
|
));
|
2008-08-09 06:38:44 +02:00
|
|
|
}
|
2008-08-11 02:03:57 +02:00
|
|
|
|
|
|
|
public function isEmpty() {
|
|
|
|
return $this->getValue() == null || $this->getValue() == '';
|
|
|
|
}
|
2008-08-09 06:38:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
?>
|