1 | <?php |
---|
2 | |
---|
3 | /** |
---|
4 | * |
---|
5 | * Sistema Automatizado para la Planificación Estratégico-Situacional en la Administración Pública Venezolana |
---|
6 | * @file handler_field_ente_organismo_publ.inc |
---|
7 | * Drupal part Module to install ente planificador module |
---|
8 | * Copyright 2011 Sistema Automatizado para la Planificación Estratégico-Situacional en la Administración Pública Venezolana (CENDITEL) |
---|
9 | * |
---|
10 | * This program is free software; you can redistribute it and/or modify |
---|
11 | * it under the terms of the GNU General Public License as published by |
---|
12 | * the Free Software Foundation; either version 2 of the License, or |
---|
13 | * (at your option) any later version. |
---|
14 | * |
---|
15 | * This program is distributed in the hope that it will be useful, |
---|
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
18 | * GNU General Public License for more details. |
---|
19 | * |
---|
20 | * You should have received a copy of the GNU General Public License |
---|
21 | * along with this program; if not, write to the Free Software |
---|
22 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
---|
23 | * |
---|
24 | * Probado con un servidor Apache 2.0, |
---|
25 | * Postgresql version 7.4.7 y 8.1 mysql 5.0.32 y PHP version 4.3.11 y 5.2.0-8 |
---|
26 | * |
---|
27 | * @author Cenditel Merida - Ing. Jose Puentes |
---|
28 | * @date 2014-11-19 // (año-mes-dia) |
---|
29 | * @version 0.2 // (0.1) |
---|
30 | * |
---|
31 | */ |
---|
32 | |
---|
33 | /** |
---|
34 | * Generar filtro por organismo Prublico en views |
---|
35 | */ |
---|
36 | class views_handler_filter_ente_nivel extends views_handler_filter_many_to_one { |
---|
37 | function get_value_options() { } |
---|
38 | function value_form(&$form, &$form_state) { |
---|
39 | $niveles = proyectos_operativos_nueva_etapa_nivel_planificacion(); |
---|
40 | $form['value']['nivel'] = array( |
---|
41 | '#type' =>'select', |
---|
42 | '#options' => $niveles, |
---|
43 | '#default_value' => $this->value['value'], |
---|
44 | ); |
---|
45 | } |
---|
46 | function query() { |
---|
47 | $aid = explode('_',$this->field); |
---|
48 | $aid = $aid[1]; |
---|
49 | $this->ensure_my_table(); |
---|
50 | $field = "tipo"; |
---|
51 | $upper = ''; |
---|
52 | $operation_attribute = "="; |
---|
53 | if($this->operator == 'not in') { |
---|
54 | $operation_attribute = '<>'; |
---|
55 | } |
---|
56 | if(!is_array($this->value)) { |
---|
57 | $this->value = array($this->value); |
---|
58 | } |
---|
59 | foreach ($this->value as &$value) { |
---|
60 | if ($value) { |
---|
61 | $this->query->add_where($this->options['group'], "$upper(%s) %s %d", $field, $operation_attribute, $value); |
---|
62 | } |
---|
63 | } |
---|
64 | } |
---|
65 | } |
---|