function casetracker_views_handler_filter_case::query in Case Tracker 7
Same name and namespace in other branches
- 6 includes/casetracker_views_handler_filter_case.inc \casetracker_views_handler_filter_case::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::query
File
- includes/
casetracker_views_handler_filter_case.inc, line 6
Class
- casetracker_views_handler_filter_case
- Filter to only show casetracker cases.
Code
function query() {
$case_types = array_filter(variable_get('casetracker_case_node_types', array(
'casetracker_basic_case',
)));
if (!empty($case_types)) {
//$placeholders = db_placeholders($case_types, 'varchar');
$placeholders = $this
->placeholder();
$table = $this->query
->ensure_table('node');
//$this->query->add_where($this->options['group'], "$table.type IN ($placeholders)", $case_types);
$this->query
->add_where_expression($this->options['group'], "{$table}.type IN ({$placeholders})", array(
$placeholders => $case_types,
));
}
else {
$this->query
->add_where($this->options['group'], "FALSE");
$msg = t('You have no node types which are acting as cases.');
if (user_access('administer case tracker')) {
$msg .= ' ' . l(t('Configure case tracker.'), 'admin/config/casetracker');
}
drupal_set_message($msg, 'warning');
}
}