1 | <?php |
---|
2 | // $Id: workflow_views_handler_filter_sid.inc,v 1.1 2008/09/18 02:49:25 jvandyk Exp $ |
---|
3 | |
---|
4 | /** |
---|
5 | * @file |
---|
6 | * Provide views filter handler for workflow.module. |
---|
7 | */ |
---|
8 | |
---|
9 | /** |
---|
10 | * Filter by state. |
---|
11 | */ |
---|
12 | class ente_planificador_hierarchical_proyecto_views_handler_filter_sid extends views_handler_filter_in_operator { |
---|
13 | |
---|
14 | |
---|
15 | |
---|
16 | var $value_form_type = 'select'; |
---|
17 | |
---|
18 | function get_value_options() { |
---|
19 | if (!isset($this->value_options)) { |
---|
20 | $this->value_title = t('Workflow Proyecto state'); |
---|
21 | |
---|
22 | $proyecto_wf = _proyectos_operativos_reformula_obtiene_estados(); |
---|
23 | $states = $proyecto_wf['states']; |
---|
24 | $this->value_options = $states; |
---|
25 | } |
---|
26 | } |
---|
27 | |
---|
28 | function query() { |
---|
29 | if (empty($this->value)) { |
---|
30 | return; |
---|
31 | } |
---|
32 | $this->ensure_my_table(); |
---|
33 | $placeholder = !empty($this->definition['numeric']) ? '%d' : "'%s'"; |
---|
34 | |
---|
35 | if (count($this->value) == 1) { |
---|
36 | $this->operator = ($this->operator == 'in') ? '= ' : '!= '; |
---|
37 | $in = !empty($this->definition['numeric']) ? '%d' : "'%s'"; |
---|
38 | } |
---|
39 | else { |
---|
40 | $replace = array_fill(0, sizeof($this->value), $placeholder); |
---|
41 | $in = ' (' . implode(", ", $replace) . ')'; |
---|
42 | } |
---|
43 | $this->query->add_where($this->options['group'], $this->table_alias . '.sid ' . $this->operator . $in, $this->value); |
---|
44 | } |
---|
45 | |
---|
46 | |
---|
47 | |
---|
48 | |
---|
49 | /* |
---|
50 | var $value_form_type = 'select'; |
---|
51 | |
---|
52 | function get_value_options() { |
---|
53 | if (!isset($this->value_options)) { |
---|
54 | $this->value_title = t('Workflow Proyecto state'); |
---|
55 | |
---|
56 | $proyecto_wf = _proyectos_operativos_reformula_obtiene_estados(); |
---|
57 | $states = $proyecto_wf['states']; |
---|
58 | $this->value_options = $states; |
---|
59 | } |
---|
60 | } |
---|
61 | |
---|
62 | function query() { |
---|
63 | if (empty($this->value)) { |
---|
64 | return; |
---|
65 | } |
---|
66 | $this->ensure_my_table(); |
---|
67 | $placeholder = !empty($this->definition['numeric']) ? '%d' : "'%s'"; |
---|
68 | |
---|
69 | if (count($this->value) == 1) { |
---|
70 | $this->operator = ($this->operator == 'in') ? '= ' : '!= '; |
---|
71 | $in = !empty($this->definition['numeric']) ? '%d' : "'%s'"; |
---|
72 | } |
---|
73 | else { |
---|
74 | $replace = array_fill(0, sizeof($this->value), $placeholder); |
---|
75 | $in = ' (' . implode(", ", $replace) . ')'; |
---|
76 | } |
---|
77 | $this->query->add_where($this->options['group'], "$this->table_alias.$this->real_field " . $this->operator . $in, $this->value); |
---|
78 | } |
---|
79 | */ |
---|
80 | } |
---|