1 | <?php |
---|
2 | /** |
---|
3 | * Sistema Automatizado para la Planificación Estratégico-Situacional en la Administración Pública Venezolana |
---|
4 | * @file proyecto_operativo_seguimiento.module |
---|
5 | * Drupal part Module to code proyectos operativos module |
---|
6 | * Copyright 2012 Sistema Automatizado para la Planificación Estratégico-Situacional en la Administración Pública Venezolana (CENDITEL) |
---|
7 | * |
---|
8 | * This program is free software; you can redistribute it and/or modify |
---|
9 | * it under the terms of the GNU General Public License as published by |
---|
10 | * the Free Software Foundation; either version 2 of the License, or |
---|
11 | * (at your option) any later version. |
---|
12 | * |
---|
13 | * This program is distributed in the hope that it will be useful, |
---|
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
16 | * GNU General Public License for more details. |
---|
17 | * |
---|
18 | * You should have received a copy of the GNU General Public License |
---|
19 | * along with this program; if not, write to the Free Software |
---|
20 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
---|
21 | * |
---|
22 | * @author CENDITEL Merida - Ing. Diego Uzcategui |
---|
23 | * @date 2013-02-07 // (anno-mes-dia) |
---|
24 | * @version 0.1 |
---|
25 | * |
---|
26 | */ |
---|
27 | |
---|
28 | /** |
---|
29 | * Pagina que muestra el historial de cambios de estados |
---|
30 | * revisado 1 abril 2013 |
---|
31 | */ |
---|
32 | function historial_cambiodeestado_seg_proyecto_page($node, $mes=0) { |
---|
33 | |
---|
34 | $meses = array( |
---|
35 | 0 => t('January'), |
---|
36 | 1 => t('February'), |
---|
37 | 2 => t('March'), |
---|
38 | 3 => t('April'), |
---|
39 | 4 => t('May'), |
---|
40 | 5 => t('June'), |
---|
41 | 6 => t('July'), |
---|
42 | 7 => t('August'), |
---|
43 | 8 => t('September'), |
---|
44 | 9 => t('Octuber'), |
---|
45 | 10 => t('November'), |
---|
46 | 11 => t('December'), |
---|
47 | ); |
---|
48 | |
---|
49 | drupal_set_title(t('Historial de cambios de estados del Seguimiento de Proyecto para el mes '.$meses[$mes])); |
---|
50 | |
---|
51 | $output = ''; |
---|
52 | $output .= '<br>'; |
---|
53 | |
---|
54 | $tablas = array(); |
---|
55 | |
---|
56 | $header = array(); |
---|
57 | $header[] = array('data' => t('Accionado')); |
---|
58 | $header[] = array('data' => t('Fecha')); |
---|
59 | $header[] = array('data' => t('Actor')); |
---|
60 | $header[] = array('data' => t('Comentario')); |
---|
61 | $header[] = array('data' => t('Transición de Estados')); |
---|
62 | |
---|
63 | $query = "SELECT id_seg from {seguimiento_proyecto} where nid=%d and mes=%d";//consulta seguimiento |
---|
64 | $queryResult = db_query ( $query, $node->nid, $mes); |
---|
65 | $seg_proyecto = db_fetch_object ( $queryResult ); |
---|
66 | |
---|
67 | $query2 = "SELECT * from {seguimiento_proyecto_transiciones_estados} where id_seg=%d order by date desc";//consulta seguimiento |
---|
68 | $queryResult2 = db_query ( $query2, $seg_proyecto->id_seg); |
---|
69 | |
---|
70 | $estados = _obtener_estados_seguimiento_mes(); |
---|
71 | |
---|
72 | $rows = array(); |
---|
73 | while ( $transiciones_estado_seg = db_fetch_object ( $queryResult2 )) |
---|
74 | { |
---|
75 | $row = array(); |
---|
76 | |
---|
77 | $estado_anterior = isset($transiciones_estado_seg->estado_ant)? $transiciones_estado_seg->estado_ant : '-'; |
---|
78 | $estado_anterior_nombre = $estados['states'][$estado_anterior]; |
---|
79 | |
---|
80 | $estado_actual = isset($transiciones_estado_seg->estado)? $transiciones_estado_seg->estado : '-'; |
---|
81 | $estado_actual_nombre = $estados['states'][$estado_actual]; |
---|
82 | |
---|
83 | $nombre_accion = _nombres_estado_y_transiciones($estado_actual_nombre); |
---|
84 | $accionado = $nombre_accion['accionado']; |
---|
85 | $row[] = array('data' => $accionado,); |
---|
86 | |
---|
87 | $fecha_cambio_estado = isset($transiciones_estado_seg->date)? $transiciones_estado_seg->date : '-'; |
---|
88 | $fecha_formato_cambio_estado = format_date($fecha_cambio_estado); |
---|
89 | $row[] = array('data' => $fecha_formato_cambio_estado,); |
---|
90 | |
---|
91 | $usuario = isset($transiciones_estado_seg->uid)? $transiciones_estado_seg->uid : '-'; |
---|
92 | $nodo_usuario = node_load($usuario); |
---|
93 | $row[] = array('data' => $nodo_usuario->name,); |
---|
94 | |
---|
95 | $comentario = isset($transiciones_estado_seg->comentario)? $transiciones_estado_seg->comentario : '-'; |
---|
96 | $row[] = array('data' => $comentario,); |
---|
97 | |
---|
98 | $row[] = array('data' => $estado_anterior_nombre.' => '.$estado_actual_nombre,); |
---|
99 | |
---|
100 | $rows[] = $row; |
---|
101 | |
---|
102 | } |
---|
103 | |
---|
104 | $tablas[]= theme('table', $header, $rows); |
---|
105 | |
---|
106 | if (count($tablas)) { |
---|
107 | |
---|
108 | $output .= '<fieldset><legend>Historial transiciones de cambio de estado del seguimiento del Proyecto</legend>'; |
---|
109 | $output .= implode('', $tablas).'</fieldset>'; |
---|
110 | } |
---|
111 | |
---|
112 | return $output; |
---|
113 | } |
---|