00001 <?php
00002
00003 define ('FILTER_OPERATOR_EQUAL', '=');
00004
00005 define ('FILTER_OPERATOR_LIKE', 'LIKE');
00006
00007 define ('FILTER_OPERATOR_GREATER', '>');
00008
00009 define ('FILTER_OPERATOR_GREATER_OR_EQUAL', '>=');
00010
00011 define ('FILTER_OPERATOR_LESS', '<');
00012
00013 define ('FILTER_OPERATOR_LESS_OR_EQUAL', '<=');
00014
00015 define ('FILTER_OPERATOR_NOT', '<>');
00016
00017 define ('FILTER_OPERATOR_NOT_NULL', 'IS NOT NULL');
00018
00019 define('FILTER_COLUMN_TYPE_TEXT', 'text');
00020 define('FILTER_COLUMN_TYPE_CURRENCY', 'currency');
00021 define('FILTER_COLUMN_TYPE_NUMERIC', 'numeric');
00022 define('FILTER_COLUMN_TYPE_DATE', 'date');
00023
00024 require_once dirname(__FILE__) . '/dbfilter.cls.php';
00025
00026
00027
00028
00029
00030
00031
00032 class DBFilterColumn extends DBFilter {
00033
00034
00035
00036 private $column;
00037
00038
00039
00040
00041 private $value;
00042
00043
00044
00045
00046 private $operator;
00047
00048
00049
00050
00051
00052
00053
00054
00055 public function __construct($column, $value, $title, $operator = '=') {
00056 $this->column = $column;
00057 $this->value = $value;
00058 $this->operator = $operator;
00059
00060 parent::__construct($title);
00061 }
00062
00063 public function get_column() {
00064 return $this->column;
00065 }
00066
00067 public function get_value() {
00068 return $this->value;
00069 }
00070
00071 public function apply($query) {
00072 $column = trim($this->column);
00073 if (empty($column)) {
00074 return;
00075 }
00076
00077 $value = $this->preprocess_value($this->value, $this->operator);
00078 $query->add_where($column, $this->operator, $value);
00079 }
00080 }