You are here

public function views_handler_filter_node_version_count::op_between in Views (for Drupal 7) 7.3

Overrides views_handler_filter_numeric::op_between

File

modules/node/views_handler_filter_node_version_count.inc, line 18
Definition of views_handler_filter_node_version_count.

Class

views_handler_filter_node_version_count
Filter to handle dates stored as a timestamp.

Code

public function op_between($field) {
  if ($this->operator == 'between') {
    $this->query
      ->add_where_expression($this->options['group'], '(SELECT COUNT(vid) FROM {node_revision} WHERE nid = {' . $this->table_alias . '}.nid) BETWEEN :min AND :max', array(
      ':min' => $this->value['min'],
      ':max' => $this->value['max'],
    ));
  }
  else {
    $this->query
      ->add_where_expression($this->options['group'], '((SELECT COUNT(vid) FROM {node_revision} WHERE nid = {' . $this->table_alias . '}.nid) <= :min OR (SELECT COUNT(vid) FROM {node_revision} WHERE nid = {' . $this->table_alias . '}.nid) >= :max)', array(
      ':min' => $this->value['min'],
      ':max' => $this->value['max'],
    ));
  }
}