1 | <?php |
---|
2 | /** |
---|
3 | * |
---|
4 | * Sistema Automatizado para la Planificación Estratégico-Situacional en la Administración Pública Venezolana |
---|
5 | * @file ente_planificador_hierarchical_handler_field_ente_childrens.inc |
---|
6 | * Drupal part Module ente_planificador_hierarchical module |
---|
7 | * Copyright 2015 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 - Msc. Juan Vizcarrondo |
---|
27 | * @date 2015-02-14 // (año-mes-dia) |
---|
28 | * @version 0.2 // (0.1) |
---|
29 | * |
---|
30 | */ |
---|
31 | |
---|
32 | /** |
---|
33 | * Field handler to present a hierarchical ente childrens. |
---|
34 | */ |
---|
35 | class ente_planificador_hierarchical_handler_field_links_proyectos extends views_handler_field { |
---|
36 | function construct() { |
---|
37 | parent::construct(); |
---|
38 | $this->additional_fields['nid'] = 'nid'; |
---|
39 | } |
---|
40 | function query() { |
---|
41 | $this->ensure_my_table(); |
---|
42 | $this->add_additional_fields(); |
---|
43 | } |
---|
44 | |
---|
45 | function render($values) { |
---|
46 | global $user; |
---|
47 | static $fecha; |
---|
48 | if (!isset($fecha)) { |
---|
49 | $current_time = time(); |
---|
50 | $tipo_plan = 'proyectos_operativos_formular'; |
---|
51 | $fecha = FALSE; |
---|
52 | $ente = usuario_tiene_ente($user->uid); |
---|
53 | $ente_planificador = 0; |
---|
54 | if ($ente && $ente->nid) { |
---|
55 | $ente_planificador = ente_planificador_leer_ente_planificadores($ente->nid); |
---|
56 | } |
---|
57 | $mi_fecha = ente_planificador_user_acceso_proceso($tipo_plan, $ente_planificador); |
---|
58 | if ($mi_fecha[1] + 86399 > $current_time && $mi_fecha[0] < $current_time) { |
---|
59 | $fecha = TRUE; |
---|
60 | } |
---|
61 | } |
---|
62 | $nid = $values->{$this->aliases['nid']}; |
---|
63 | $node_load = node_load($nid); |
---|
64 | if ($node_load && $node_load->type == 'proyectos_operativos') { |
---|
65 | $links = array(); |
---|
66 | drupal_alter('proyecto_obtiene_links', $links, $node_load, $fecha); |
---|
67 | return theme('item_list', $links); |
---|
68 | } |
---|
69 | return; |
---|
70 | } |
---|
71 | } |
---|