function getlocations_fields_handler_argument_postcode::query in Get Locations 7
Same name and namespace in other branches
- 7.2 modules/getlocations_fields/handlers/getlocations_fields_handler_argument_postcode.inc \getlocations_fields_handler_argument_postcode::query()
Set up the query for this argument.
The argument sent may be found at $this->argument.
Overrides views_handler_argument::query
File
- modules/
getlocations_fields/ handlers/ getlocations_fields_handler_argument_postcode.inc, line 54 - getlocations_fields_handler_argument_postcode.inc @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL
Class
- getlocations_fields_handler_argument_postcode
- Argument handler to accept post code
Code
function query($group_by = FALSE) {
$value = FALSE;
if ($this->options['type'] == 'postal_code' && isset($this->argument)) {
$value = getlocations_apoclean($this->argument);
}
if ($value) {
$alias = $this->table_alias ? $this->table_alias : $this->table;
$field = $alias . '.' . $this->real_field;
if ($this->options['operator'] == 'equal') {
$this->query
->add_where($group_by, $field, $value, 'LIKE');
}
elseif ($this->options['operator'] == 'not_equal') {
$this->query
->add_where($group_by, $field, $value, 'NOT LIKE');
}
elseif ($this->options['operator'] == 'begin_with') {
$this->query
->add_where($group_by, $field, db_like($value) . '%', 'LIKE');
}
elseif ($this->options['operator'] == 'not_begin_with') {
$this->query
->add_where($group_by, $field, db_like($value) . '%', 'NOT LIKE');
}
elseif ($this->options['operator'] == 'end_with') {
$this->query
->add_where($group_by, $field, '%' . db_like($value), 'LIKE');
}
elseif ($this->options['operator'] == 'not_end_with') {
$this->query
->add_where($group_by, $field, '%' . db_like($value), 'NOT LIKE');
}
elseif ($this->options['operator'] == 'contain') {
$this->query
->add_where($group_by, $field, '%' . db_like($value) . '%', 'LIKE');
}
elseif ($this->options['operator'] == 'not_contain') {
$this->query
->add_where($group_by, $field, '%' . db_like($value) . '%', 'NOT LIKE');
}
}
}