function tripal_views_handler_filter_select_string::query
2.x tripal_views_handler_filter_select_string.inc | tripal_views_handler_filter_select_string::query() |
3.x tripal_views_handler_filter_select_string.inc | tripal_views_handler_filter_select_string::query() |
1.x tripal_views_handler_filter_select_string.inc | tripal_views_handler_filter_select_string::query() |
Add this filter to the query.
Due to the nature of fapi, the value and the operator have an unintended level of indirection. You will find them in $this->operator and $this->value respectively.
Overrides views_handler_filter_string::query
File
- tripal_views/
views/ handlers/ tripal_views_handler_filter_select_string.inc, line 318 - Contains tripal_views_handler_filter_select_string Filter Handler
Class
- tripal_views_handler_filter_select_string
- This Handler provides a generic select list for any chado field that is a string The select list includes all distinct values for that field.
Code
function query() {
// make optional
// if it is not set or empty then don't restrict the query
if (!$this->value) {
return;
}
$this->ensure_my_table();
$field = $this->table_alias . "." . $this->real_field;
$table = $this->query->get_table_info($this->table);
$this->options['values_form_type'] = (isset($this->options['values_form_type'])) ? $this->options['values_form_type'] : 'textfield';
if (preg_match('/select/', $this->options['values_form_type'])) {
if (is_array($this->value)) {
if (isset($this->value['All'])) {
unset($this->value['All']);
}
if ($this->operator == '!=') {
$this->operator = 'NOT IN';
}
else {
$this->operator = 'IN';
}
}
else {
// don't allow operators other than = and !=
if ($this->operator != '!=') {
$this->operator = '=';
}
}
if ($this->value) {
$this->query->add_where($this->options['group'], $field, $this->value, $this->operator);
}
}
else {
$info = $this->operators();
if (!empty($info[$this->operator]['method'])) {
$this->{$info[$this->operator]['method']}($field);
}
}
}