function add_filter($field, $operator, $values)
{
if (empty($values)) {
return;
}
# values must be an array
if (!is_array($values)) {
$values = array($values);
}
# check if field is defined as an available filter
if (array_key_exists($field, $this->available_filters)) {
$this->filter_options = $this->available_filters[$field];
# check if operator is allowed for that filter
#if @@operators_by_filter_type[filter_options[:type]].include? operator
# allowed_values = values & ([""] + (filter_options[:values] || []).collect {|val| val[1]})
# filters[field] = {:operator => operator, :values => allowed_values } if (allowed_values.first and !allowed_values.first.empty?) or ["o", "c", "!*", "*", "t"].include? operator
#end
$this->filters[$field] = compact('operator', 'values');
}
}