1 | <?php |
---|
2 | /** |
---|
3 | * |
---|
4 | * Sistema Automatizado para la Planificación Estratégico-Situacional en la Administración Pública Venezolana |
---|
5 | * @file proyecto_operativo_seguimiento_views_handler_filter_sid.inc |
---|
6 | * Drupal part Module ente_planificador_hierarchical module |
---|
7 | * Copyright 2017 Sistema Automatizado para la Planificación Estratégico-Situacional en la Administración Pública Venezolana (CENDITEL) |
---|
8 | * |
---|
9 | * This program is free software; you can redistribute it and/or modify |
---|
10 | * it under the terms of the GNU General Public License as published by |
---|
11 | * the Free Software Foundation; either version 2 of the License, or |
---|
12 | * (at your option) any later version. |
---|
13 | * |
---|
14 | * This program is distributed in the hope that it will be useful, |
---|
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
17 | * GNU General Public License for more details. |
---|
18 | * |
---|
19 | * You should have received a copy of the GNU General Public License |
---|
20 | * along with this program; if not, write to the Free Software |
---|
21 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
---|
22 | * |
---|
23 | * Probado con un servidor Apache 2.0, |
---|
24 | * Postgresql version 7.4.7 y 8.1 mysql 5.0.32 y PHP version 4.3.11 y 5.2.0-8 |
---|
25 | * |
---|
26 | * @author Cenditel Merida - PHD. Juan Vizcarrondo |
---|
27 | * @date 2017-05-04 // (año-mes-dia) |
---|
28 | * @version 0.2 // (0.1) |
---|
29 | * |
---|
30 | */ |
---|
31 | |
---|
32 | |
---|
33 | /** |
---|
34 | * Filter by state. |
---|
35 | */ |
---|
36 | class proyecto_operativo_seguimiento_views_handler_filter_mes extends views_handler_filter_in_operator { |
---|
37 | var $value_form_type = 'select'; |
---|
38 | function get_value_options() { |
---|
39 | if (!isset($this->value_options)) { |
---|
40 | $this->value_title = t('Month Seguimiento'); |
---|
41 | $meses = array( |
---|
42 | 1 => t('January'), |
---|
43 | 2 => t('February'), |
---|
44 | 3 => t('March'), |
---|
45 | 4 => t('April'), |
---|
46 | 5 => t('May'), |
---|
47 | 6 => t('June'), |
---|
48 | 7 => t('July'), |
---|
49 | 8 => t('August'), |
---|
50 | 9 => t('September'), |
---|
51 | 10 => t('Octuber'), |
---|
52 | 11 => t('November'), |
---|
53 | 12 => t('December'), |
---|
54 | ); |
---|
55 | $this->value_options = $meses; |
---|
56 | } |
---|
57 | } |
---|
58 | function query() { |
---|
59 | if (empty($this->value)) { |
---|
60 | return; |
---|
61 | } |
---|
62 | $this->ensure_my_table(); |
---|
63 | $placeholder = !empty($this->definition['numeric']) ? '%d' : "'%s'"; |
---|
64 | |
---|
65 | if (count($this->value) == 1) { |
---|
66 | $this->operator = ($this->operator == 'in') ? '= ' : '!= '; |
---|
67 | $in = !empty($this->definition['numeric']) ? '%d' : "'%s'"; |
---|
68 | } |
---|
69 | else { |
---|
70 | $replace = array_fill(0, sizeof($this->value), $placeholder); |
---|
71 | $in = ' (' . implode(", ", $replace) . ')'; |
---|
72 | } |
---|
73 | $this->query->add_where($this->options['group'], $this->table_alias . '.mes ' . $this->operator . $in, $this->value); |
---|
74 | } |
---|
75 | } |
---|