/[drupal]/contributions/modules/views/handlers/views_handler_filter_group_by_numeric.inc
ViewVC logotype

Diff of /contributions/modules/views/handlers/views_handler_filter_group_by_numeric.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1, Tue Nov 10 23:23:27 2009 UTC revision 1.1.2.1, Tue Nov 10 23:23:27 2009 UTC
# Line 0  Line 1 
1    <?php
2    // $Id: views_handler_filter_group_by_numeric.inc,v 1.7 2009/03/25 17:29:33 merlinofchaos Exp $
3    
4    /**
5     * Simple filter to handle greater than/less than filters
6     */
7    class views_handler_filter_group_by_numeric extends views_handler_filter_numeric {
8      function query() {
9        $this->ensure_my_table();
10        $field = $this->get_field();
11    
12        $info = $this->operators();
13        if (!empty($info[$this->operator]['method'])) {
14          $this->{$info[$this->operator]['method']}($field);
15        }
16      }
17      function op_between($field) {
18        if ($this->operator == 'between') {
19          $this->query->add_having($this->options['group'], "$field >= %d", $this->value['min']);
20          $this->query->add_having($this->options['group'], "$field <= %d", $this->value['max']);
21        }
22        else {
23          $this->query->add_having($this->options['group'], "$field <= %d OR $field >= %d", $this->value['min'], $this->value['max']);
24        }
25      }
26    
27      function op_simple($field) {
28        $this->query->add_having($this->options['group'], "$field $this->operator %d", $this->value['value']);
29      }
30    
31      function op_empty($field) {
32        if ($this->operator == 'empty') {
33          $operator = "IS NULL";
34        }
35        else {
36          $operator = "IS NOT NULL";
37        }
38    
39        $this->query->add_having($this->options['group'], "$field $operator");
40      }
41    
42      function ui_name() {
43        return $this->get_field(parent::ui_name());
44      }
45    }
46    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.1.2.1

  ViewVC Help
Powered by ViewVC 1.1.2