2008-08-09 08:40:50 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @package sapphire
|
|
|
|
* @subpackage search
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Incomplete.
|
|
|
|
*
|
|
|
|
* @todo add to tests
|
|
|
|
*
|
|
|
|
* @package sapphire
|
|
|
|
* @subpackage search
|
|
|
|
*/
|
|
|
|
class WithinRangeFilter extends SearchFilter {
|
|
|
|
|
|
|
|
private $min;
|
|
|
|
private $max;
|
|
|
|
|
|
|
|
function setMin($min) {
|
|
|
|
$this->min = $min;
|
|
|
|
}
|
|
|
|
|
|
|
|
function setMax($max) {
|
|
|
|
$this->max = $max;
|
|
|
|
}
|
|
|
|
|
2011-09-26 05:47:54 +02:00
|
|
|
function apply(DataQuery $query) {
|
2008-10-05 21:20:35 +02:00
|
|
|
$query->where(sprintf(
|
|
|
|
"%s >= %s AND %s <= %s",
|
|
|
|
$this->getDbName(),
|
|
|
|
Convert::raw2sql($this->min),
|
|
|
|
$this->getDbName(),
|
|
|
|
Convert::raw2sql($this->max)
|
|
|
|
));
|
2008-08-09 08:40:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|