1 | <?php |
---|
2 | /** |
---|
3 | * Sistema Integral de Planificación y Presupuesto (SIPP) |
---|
4 | * @file sipp_report2.module |
---|
5 | * Drupal part Module to Sistema Integral de Planificación y Presupuesto (SIPP) |
---|
6 | * Copyright 2014 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 - Msc. Juan Vizcarrondo |
---|
23 | * @date 2014-06-09 // (año-mes-dia) |
---|
24 | * @version 0.1 // (0.1) |
---|
25 | * |
---|
26 | */ |
---|
27 | |
---|
28 | /** |
---|
29 | * Implementation of sipp_report2_consulta_partidas_fuentes_page(). |
---|
30 | * Display partidas and fuentes de financiamiento report. |
---|
31 | */ |
---|
32 | function sipp_report2_consulta_partidas_fuentes_page(){ |
---|
33 | |
---|
34 | $view = views_get_view('matriz_procesos'); |
---|
35 | $display_id = 'page_3'; |
---|
36 | $view->set_display($display_id); |
---|
37 | $view->override_path = $_GET['q']; |
---|
38 | if ($_POST['field_proyecto_unidadm_value'] && is_numeric($_POST['field_proyecto_unidadm_value'])) { |
---|
39 | $_POST['unidad_apro'] = $_POST['field_proyecto_unidadm_value']; |
---|
40 | } |
---|
41 | $view->set_exposed_input($_POST); |
---|
42 | $planificado = FALSE; |
---|
43 | $ejecutado = FALSE; |
---|
44 | $grafico = FALSE; |
---|
45 | if (isset($_POST['mostrar']) && count($_POST['mostrar'])) { |
---|
46 | foreach($_POST['mostrar'] as $mostrar){ |
---|
47 | if ($mostrar == 'planificado') { |
---|
48 | $planificado = TRUE; |
---|
49 | } |
---|
50 | elseif($mostrar == 'ejecutado') { |
---|
51 | $ejecutado = TRUE; |
---|
52 | } |
---|
53 | elseif($mostrar == 'grafico') { |
---|
54 | $grafico = TRUE; |
---|
55 | } |
---|
56 | } |
---|
57 | } |
---|
58 | if (!$planificado && !$ejecutado) { |
---|
59 | $view->set_exposed_input(array()); |
---|
60 | } |
---|
61 | $view->pre_execute(); |
---|
62 | $view->execute(); |
---|
63 | if (($planificado || $ejecutado) && count($view->result)) { |
---|
64 | $ftypes = array( |
---|
65 | 0 => t('Seleccione'), |
---|
66 | '1' => t('January'), |
---|
67 | '2' => t('February'), |
---|
68 | '3' => t('March'), |
---|
69 | '4' => t('April'), |
---|
70 | '5' => t('May'), |
---|
71 | '6' => t('June'), |
---|
72 | '7' => t('July'), |
---|
73 | '8' => t('August'), |
---|
74 | '9' => t('September'), |
---|
75 | '10' => t('Octuber'), |
---|
76 | '11' => t('November'), |
---|
77 | '12' => t('December'), |
---|
78 | ); |
---|
79 | $new_result = array(); |
---|
80 | $nids = array(); |
---|
81 | $mes_inicio = isset($_POST['mes_seguimiento_0']) && isset($ftypes[$_POST['mes_seguimiento_0'] - 1]) ? $_POST['mes_seguimiento_0'] - 1 : 0; |
---|
82 | $mes_final = isset($_POST['mes_seguimiento_1']) && isset($ftypes[$_POST['mes_seguimiento_1'] - 1]) ? $_POST['mes_seguimiento_1'] - 1 : 11; |
---|
83 | if ($mes_inicio > $mes_final) { |
---|
84 | $au = $mes_final; |
---|
85 | $mes_final = $mes_inicio; |
---|
86 | $mes_inicio = $au; |
---|
87 | } |
---|
88 | $partidas_labels = array(); |
---|
89 | $partidas = array(); |
---|
90 | $categorias = array(); |
---|
91 | $planificado_values = array(); |
---|
92 | $seguimiento_values = array(); |
---|
93 | if (isset($_POST['partidas']) && count($_POST['partidas'])) { |
---|
94 | foreach($_POST['partidas'] as $campo){ |
---|
95 | $partidas[] = $campo; |
---|
96 | if ($grafico && ($planificado || $ejecutado)) { |
---|
97 | $categorias[$campo] = check_plain($_POST['partida_label_' . $campo]); |
---|
98 | } |
---|
99 | $partidas_labels[$campo] = isset($_POST['partida_label_' . $campo])? $_POST['partida_label_' . $campo] : FALSE; |
---|
100 | } |
---|
101 | } |
---|
102 | $arreglo_label = array(); |
---|
103 | $financia = array(); |
---|
104 | if (isset($_POST['financiamiento']) && count($_POST['financiamiento'])) { |
---|
105 | foreach($_POST['financiamiento'] as $campo){ |
---|
106 | $father = isset($_POST['finaciamiento_father_' . $campo])? $_POST['finaciamiento_father_' . $campo] : FALSE; |
---|
107 | if ($father && !isset($arreglo_label[$father])) { |
---|
108 | $arreglo_label[$father] = array(); |
---|
109 | } |
---|
110 | if ($father && $_POST['finaciamiento_label_' . $campo]) { |
---|
111 | if ($grafico && $planificado) { |
---|
112 | $categorias[$campo] = check_plain($_POST['finaciamiento_label_' . $campo]); |
---|
113 | } |
---|
114 | $financia[] = $campo; |
---|
115 | $arreglo_label[$father][$campo] = $_POST['finaciamiento_label_' . $campo]; |
---|
116 | } |
---|
117 | } |
---|
118 | } |
---|
119 | $node_type = content_types('accion_especifica'); |
---|
120 | $fields = $node_type['fields']; |
---|
121 | $campos = array(); |
---|
122 | foreach($fields as $id => $field) { |
---|
123 | if ($field['module'] == 'number' && $field['multiple'] == 0 && $id != 'field_accion_esp_ponderacion') { |
---|
124 | $campos[$id] = 'SUM(a.' . $id . '_value) AS ' . $id; |
---|
125 | } |
---|
126 | } |
---|
127 | $campos_par = array(); |
---|
128 | for($j = $mes_inicio; $j <= $mes_final; $j++) { |
---|
129 | $texto = $j != 0? 'value_' . $j : 'value'; |
---|
130 | $campos_par[] = 'SUM(p.field_accion_esp_programacion_' . $texto . ')'; |
---|
131 | } |
---|
132 | $campos_partidas = implode(' + ', $campos_par); |
---|
133 | $campos_financiamiento = implode(',', $campos); |
---|
134 | $estado_aprobado = variable_get('acciones_centralizadas_state_aprobado', NULL); |
---|
135 | foreach($view->result as $i => $values) { |
---|
136 | $seguimientos = array(); |
---|
137 | if (!isset($nids[$values->nid])) { |
---|
138 | $nodo = node_load($values->nid); |
---|
139 | //SE OBTIENE EL SEGUIMIENTO POR PARTIDAS: |
---|
140 | if ($ejecutado) { |
---|
141 | $resultado = db_query('SELECT SUM(sap.comprometido) AS total_comprometido, sap.partida FROM seguimiento_aeproyecto_partida AS sap LEFT JOIN seguimiento_proyecto AS sp ON sp.id_seg = sap.id_seg LEFT JOIN {seguimiento_aeproyecto} AS saep ON saep.id_seg = sp.id_seg AND saep.mes >= %d AND saep.mes <= %d AND saep.estado = %d WHERE sp.nid = %d GROUP BY sap.partida', $mes_inicio, $mes_final, $estado_aprobado, $nodo->nid); |
---|
142 | while ($seguimiento = db_fetch_object($resultado)){ |
---|
143 | $seguimientos[$seguimiento->partida] = $seguimiento->total_comprometido; |
---|
144 | if ($grafico && $ejecutado) { |
---|
145 | if (!isset($seguimiento_values[$seguimiento->partida])) { |
---|
146 | $seguimiento_values[$seguimiento->partida] = 0; |
---|
147 | } |
---|
148 | $seguimiento_values[$seguimiento->partida] += $seguimiento->total_comprometido; |
---|
149 | } |
---|
150 | |
---|
151 | } |
---|
152 | $values->seg_partidas = $seguimientos; |
---|
153 | } |
---|
154 | $acciones = array(); |
---|
155 | if ($planificado && count($nodo->field_proyecto_accion_esp)) { |
---|
156 | foreach($nodo->field_proyecto_accion_esp as $value) { |
---|
157 | if (isset($value['nid']) && $value['nid']) { |
---|
158 | $acciones[] = $value['nid']; |
---|
159 | } |
---|
160 | } |
---|
161 | } |
---|
162 | $implode_acciones = implode(',', $acciones); |
---|
163 | if (count($financia) && count($acciones)) { |
---|
164 | $resultado = db_query('SELECT ' . $campos_financiamiento . ' FROM {content_type_accion_especifica} AS a LEFT JOIN {node} AS n ON n.nid = a.nid AND n.vid = a.vid WHERE n.nid IN (%s)', $implode_acciones); |
---|
165 | $fuente = db_fetch_object($resultado); |
---|
166 | $fuentes = array(); |
---|
167 | if ($fuente) { |
---|
168 | foreach ($financia as $field) { |
---|
169 | $varia = isset($nodo->variaciones[$field . '_' . $nodo->nid])? $nodo->variaciones[$field . '_' . $nodo->nid][0]['value'] : 0; |
---|
170 | $fuentes[$field] = $fuente->{$field} + $varia; |
---|
171 | if ($grafico && $planificado) { |
---|
172 | if (!isset($planificado_values[$field])) { |
---|
173 | $planificado_values[$field] = 0; |
---|
174 | } |
---|
175 | $planificado_values[$field] += $fuente->{$field} + $varia; |
---|
176 | } |
---|
177 | } |
---|
178 | } |
---|
179 | $values->financiamiento = $fuentes; |
---|
180 | } |
---|
181 | if (count($acciones)) { |
---|
182 | $resultado = db_query('SELECT ' . $campos_partidas . ' AS suma, p.field_accion_esp_programacion_tid FROM {content_field_accion_esp_programacion} AS p LEFT JOIN {node} AS n ON n.nid = p.nid AND n.vid = p.vid WHERE n.nid IN (%s) GROUP BY p.field_accion_esp_programacion_tid', $implode_acciones); |
---|
183 | $suma_partidas = array(); |
---|
184 | $variaciones = array(); |
---|
185 | foreach($acciones as $nid) { |
---|
186 | if (isset($nodo->variaciones['field_accion_esp_programacion_' . $nid])) { |
---|
187 | foreach($nodo->variaciones['field_accion_esp_programacion_' . $nid] as $tid => $value) { |
---|
188 | $suma = 0; |
---|
189 | for($j = $mes_inicio; $j <= $mes_final; $j++) { |
---|
190 | $texto = $j != 0? 'value_' . $j : 'value'; |
---|
191 | $suma += $value[$texto]; |
---|
192 | } |
---|
193 | if (!isset($variaciones[$tid])) { |
---|
194 | $variaciones[$tid] = 0; |
---|
195 | } |
---|
196 | $variaciones[$tid] += $suma; |
---|
197 | } |
---|
198 | } |
---|
199 | } |
---|
200 | while($partidas_load = db_fetch_object($resultado)){ |
---|
201 | $suma_partidas[$partidas_load->field_accion_esp_programacion_tid] = $partidas_load->suma + $variaciones[$partidas_load->field_accion_esp_programacion_tid]; |
---|
202 | if ($grafico && $planificado) { |
---|
203 | if (!isset($planificado_values[$partidas_load->field_accion_esp_programacion_tid])) { |
---|
204 | $planificado_values[$partidas_load->field_accion_esp_programacion_tid] = 0; |
---|
205 | } |
---|
206 | $planificado_values[$partidas_load->field_accion_esp_programacion_tid] += $suma_partidas[$partidas_load->field_accion_esp_programacion_tid]; |
---|
207 | } |
---|
208 | } |
---|
209 | $values->suma_partidas = $suma_partidas; |
---|
210 | } |
---|
211 | $nids[$values->nid] = $values->nid; |
---|
212 | $new_result[] = $values; |
---|
213 | } |
---|
214 | } |
---|
215 | $view->result = $new_result; |
---|
216 | } |
---|
217 | $texto_auxiliar = ''; |
---|
218 | if (!$planificado && !$ejecutado) { |
---|
219 | $texto_auxiliar = '<div id="campos-no-seleccionados">' . t('Debe seleccionar los datos a mostrar (Planificado y/o Ejecutado)') . '</div>'; |
---|
220 | } |
---|
221 | $output = ''; |
---|
222 | $output .= $view->render() . $texto_auxiliar; |
---|
223 | if ($grafico && count($categorias)) { |
---|
224 | $width = isset($_POST['width']) && is_numeric($_POST['width']) && $_POST['width']? $_POST['width'] : 800; |
---|
225 | $height = isset($_POST['height']) && is_numeric($_POST['height']) && $_POST['height']? $_POST['height'] : 400; |
---|
226 | $datos_grafica = array( |
---|
227 | 'labels' => $categorias, |
---|
228 | 'plan' => $planificado_values, |
---|
229 | 'exe' => $seguimiento_values, |
---|
230 | 'exe' => $seguimiento_values, |
---|
231 | 'planificado' => $planificado, |
---|
232 | 'ejecutado' => $ejecutado, |
---|
233 | 'width' => $width, |
---|
234 | 'height' => $height, |
---|
235 | ); |
---|
236 | $output .= sipp_report2_generate_graph_plan_exe_column($datos_grafica); |
---|
237 | } |
---|
238 | return $output; |
---|
239 | } |
---|
240 | |
---|
241 | /** |
---|
242 | * Implementation of sipp_report2_generate_graph_plan_exe_column(). |
---|
243 | * Display charts report |
---|
244 | */ |
---|
245 | function sipp_report2_generate_graph_plan_exe_column($datos_grafica) { |
---|
246 | $page_content = ''; |
---|
247 | $path = libraries_get_path('Highcharts-3.0.1'); |
---|
248 | $options = sipp_report2_generate_graph_plan_exe_column_options($datos_grafica); |
---|
249 | if (is_object($options)) { |
---|
250 | // Render the chart options object, and retrieve the chart id. |
---|
251 | highcharts_render($options); |
---|
252 | // Define required and optional chart container attributes. |
---|
253 | $attributes = array( |
---|
254 | // Required chart id passed by reference. |
---|
255 | 'id' => $options->chart->renderTo, |
---|
256 | // Optionally add styles or any other valid attribute. |
---|
257 | 'style' => 'height: ' . $datos_grafica['height'] . 'px;width: ' . $datos_grafica['width'] . 'px;' |
---|
258 | ); |
---|
259 | $page_content .= theme_highcharts_chart($options->chart->renderTo); |
---|
260 | $page_content .= theme('highcharts_chart', $attributes); |
---|
261 | } |
---|
262 | $path_biblioteca_Highcharts = libraries_get_path('Highcharts-3.0.1'); |
---|
263 | drupal_add_js($path_biblioteca_Highcharts . '/js/modules/exporting.js'); |
---|
264 | return $page_content; |
---|
265 | } |
---|
266 | |
---|
267 | /** |
---|
268 | * Column-basic highcharts options object. |
---|
269 | * |
---|
270 | * @see highcharts_render() |
---|
271 | */ |
---|
272 | function sipp_report2_generate_graph_plan_exe_column_options($datos_grafica) { |
---|
273 | $options = new stdClass(); |
---|
274 | // Chart. |
---|
275 | $options->chart = (object)array( |
---|
276 | 'renderTo' => 'container', |
---|
277 | 'plotBackgroundColor' => NULL, |
---|
278 | 'plotBorderWidth' => NULL, |
---|
279 | 'plotShadow' => FALSE, |
---|
280 | ); |
---|
281 | $options->chart->type = 'column'; |
---|
282 | // Title. |
---|
283 | $options->title->text = t('Reporte de Partidas y fuentes de financiamiento'); |
---|
284 | $categorias_xAxis = array(); |
---|
285 | $labels = array(); |
---|
286 | foreach($datos_grafica['labels'] as $id => $valor_opc_i){ |
---|
287 | $labels[] = $valor_opc_i; |
---|
288 | } |
---|
289 | $categorias_xAxis[] = $datos_grafica['labels']; |
---|
290 | $options->xAxis->categories = $labels; |
---|
291 | $options->yAxis->title->text = t('Monto (Bs)'); |
---|
292 | $options->yAxis->allowDecimals = FALSE; |
---|
293 | $options->tooltip->headerFormat = '<span style="font-size:10px"><b>{point.key}</b></span><table>'; |
---|
294 | //$options->tooltip->shared = 'true'; |
---|
295 | $options->tooltip->useHTML = 'true'; |
---|
296 | $options->tooltip->formatter = "function() {return '<b>'+ this.x + '</b>: '+ Highcharts.numberFormat(this.point.y, 2, '.', ',') +' Bs (' + this.series.name + ')';}"; |
---|
297 | // Plot options. |
---|
298 | $options->plotOptions->column = (object)array( |
---|
299 | 'allowPointSelect' => TRUE, |
---|
300 | 'cursor' => 'pointer', |
---|
301 | 'dataLabels' => array( |
---|
302 | 'enabled' => FALSE, |
---|
303 | ), |
---|
304 | 'showInLegend' => TRUE, |
---|
305 | ); |
---|
306 | // Series. |
---|
307 | $options->series = array(); |
---|
308 | if ($datos_grafica['planificado']) { |
---|
309 | $series = new StdClass(); |
---|
310 | $series->name = t('Planificado'); |
---|
311 | $series->data = array(); |
---|
312 | foreach($datos_grafica['labels'] as $id => $valor_opc_i){ |
---|
313 | $series->data[] = $datos_grafica['plan'][$id]; |
---|
314 | } |
---|
315 | $options->series[] = $series; |
---|
316 | } |
---|
317 | if ($datos_grafica['ejecutado']) { |
---|
318 | $series = new StdClass(); |
---|
319 | $series->name = t('Ejecutado'); |
---|
320 | $series->data = array(); |
---|
321 | foreach($datos_grafica['labels'] as $id => $valor_opc_i){ |
---|
322 | if (is_numeric($id)) { |
---|
323 | $series->data[] = $datos_grafica['exe'][$id]; |
---|
324 | } |
---|
325 | else { |
---|
326 | $series->data[] = 0; |
---|
327 | } |
---|
328 | } |
---|
329 | $options->series[] = $series; |
---|
330 | } |
---|
331 | // Diable credits. |
---|
332 | $options->credits->enabled = FALSE; |
---|
333 | return $options; |
---|
334 | } |
---|
335 | |
---|
336 | /** |
---|
337 | * Implementation of sipp_report2_consulta_proyectos_operativos_reporte_page(). |
---|
338 | * Display consulta de proyectos operativos reports |
---|
339 | */ |
---|
340 | function sipp_report2_consulta_proyectos_operativos_reporte_page(){ |
---|
341 | $view = views_get_view('matriz_procesos'); |
---|
342 | $display_id = 'page_2'; |
---|
343 | $view->set_display($display_id); |
---|
344 | $view->override_path = $_GET['q']; |
---|
345 | if ($_POST['field_proyecto_unidadm_value'] && is_numeric($_POST['field_proyecto_unidadm_value'])) { |
---|
346 | $_POST['unidad_apro'] = $_POST['field_proyecto_unidadm_value']; |
---|
347 | } |
---|
348 | $view->set_exposed_input($_POST); |
---|
349 | $view->pre_execute(); |
---|
350 | $view->execute(); |
---|
351 | if (count($view->result)) { |
---|
352 | $ftypes = array( |
---|
353 | 0 => t('Seleccione'), |
---|
354 | '1' => t('January'), |
---|
355 | '2' => t('February'), |
---|
356 | '3' => t('March'), |
---|
357 | '4' => t('April'), |
---|
358 | '5' => t('May'), |
---|
359 | '6' => t('June'), |
---|
360 | '7' => t('July'), |
---|
361 | '8' => t('August'), |
---|
362 | '9' => t('September'), |
---|
363 | '10' => t('Octuber'), |
---|
364 | '11' => t('November'), |
---|
365 | '12' => t('December'), |
---|
366 | ); |
---|
367 | $new_result = array(); |
---|
368 | $nids = array(); |
---|
369 | $mes_inicio = isset($_POST['mes_seguimiento_0']) && isset($ftypes[$_POST['mes_seguimiento_0'] - 1]) ? $_POST['mes_seguimiento_0'] - 1 : 0; |
---|
370 | $mes_final = isset($_POST['mes_seguimiento_1']) && isset($ftypes[$_POST['mes_seguimiento_1'] - 1]) ? $_POST['mes_seguimiento_1'] - 1 : 11; |
---|
371 | if ($mes_inicio > $mes_final) { |
---|
372 | $au = $mes_final; |
---|
373 | $mes_final = $mes_inicio; |
---|
374 | $mes_inicio = $au; |
---|
375 | } |
---|
376 | $form = sipp_report2_proyecto_genera_campos_form(); |
---|
377 | $views = array(); |
---|
378 | $content = node_build_content($node); |
---|
379 | $valores = array(); |
---|
380 | $title_combos = $form['#title_combos']; |
---|
381 | foreach($_POST as $id => $campos){ |
---|
382 | if (is_array($campos) && count($campos)) { |
---|
383 | foreach($campos as $campo) { |
---|
384 | if ($campo) { |
---|
385 | $valores[$id][] = $campo; |
---|
386 | } |
---|
387 | } |
---|
388 | } |
---|
389 | } |
---|
390 | foreach($view->result as $i => $values) { |
---|
391 | if (!isset($nids[$values->nid])) { |
---|
392 | $values->nodo_reporte = sipp_report2_genera_vista_nodo($values->nid, $title_combos, $valores); |
---|
393 | $nids[$values->nid] = $values->nid; |
---|
394 | $new_result[] = $values; |
---|
395 | } |
---|
396 | } |
---|
397 | $view->result = $new_result; |
---|
398 | } |
---|
399 | return $view->render(); |
---|
400 | } |
---|
401 | |
---|
402 | /** |
---|
403 | * Implementation of sipp_report2_genera_vista_nodo(). |
---|
404 | * Generate node display in consulta de proyectos report |
---|
405 | */ |
---|
406 | function sipp_report2_genera_vista_nodo($nid, $title_combos, $valores){ |
---|
407 | $node_load = node_load($nid); |
---|
408 | $content = node_build_content($node_load); |
---|
409 | $views = array(); |
---|
410 | $views['titulo'] .= '<h2>' . $node_load->titulo_asignado . '</h2>'; |
---|
411 | foreach($title_combos as $id => $campos){ |
---|
412 | if (isset($valores[$id])) { |
---|
413 | $views[$id] = !isset($views[$id]) ? '<fieldset><legend>' . $campos['title'] . '</legend>' : $views[$id]; |
---|
414 | foreach($valores[$id] as $campo) { |
---|
415 | if ($campo && isset($content->content[$campo])) { |
---|
416 | $views[$id] .= drupal_render($content->content[$campo]); |
---|
417 | } |
---|
418 | elseif($campo == 'title') { |
---|
419 | $views[$id] .= '<div class="field field-type-text field-field-nombre-proyecto"><div class="field-label">' . t('Nombre del Proyecto') . ':</div>' . '<div class="field-items">' . $node_load->titulo_asignado . '</div></div>'; |
---|
420 | } |
---|
421 | } |
---|
422 | $views[$id] .= '</fieldset>'; |
---|
423 | } |
---|
424 | else { |
---|
425 | foreach($campos as $id_campo => $campo) { |
---|
426 | if (isset($valores[$id_campo])) { |
---|
427 | $muestra = TRUE; |
---|
428 | $views[$id] = !isset($views[$id]) ? '<fieldset><legend>' . $campos['title'] . '</legend>' : $views[$id]; |
---|
429 | $views[$id] .= '<fieldset><legend>' . $campo['title'] . '</legend>'; |
---|
430 | foreach($valores[$id_campo] as $id_field) { |
---|
431 | if ($id_field && isset($content->content[$id_field])) { |
---|
432 | $views[$id] .= drupal_render($content->content[$id_field]); |
---|
433 | } |
---|
434 | elseif($id_field == 'title') { |
---|
435 | $views[$id] .= '<div class="field field-type-text field-field-nombre-proyecto"><div class="field-label">' . t('Nombre del Proyecto') .':</div>' . '<div class="field-items">' . $node_load->titulo_asignado . '</div></div>'; |
---|
436 | } |
---|
437 | } |
---|
438 | $views[$id] .= '</fieldset>'; |
---|
439 | } |
---|
440 | } |
---|
441 | if (isset($views[$id])) { |
---|
442 | $views[$id] .= '</fieldset>'; |
---|
443 | } |
---|
444 | } |
---|
445 | } |
---|
446 | $output = ''; |
---|
447 | if (count($views)) { |
---|
448 | $output = implode('', $views); |
---|
449 | } |
---|
450 | return $output; |
---|
451 | } |
---|
452 | |
---|
453 | /** |
---|
454 | * Implementation of sipp_report2_resultados_por_unidad_ejecutora_page(). |
---|
455 | * Display unidad ejecutora reports |
---|
456 | */ |
---|
457 | function sipp_report2_resultados_por_unidad_ejecutora_page(){ |
---|
458 | $view = views_get_view('matriz_procesos'); |
---|
459 | $display_id = 'page_1'; |
---|
460 | $view->set_display($display_id); |
---|
461 | $view->override_path = $_GET['q']; |
---|
462 | $view->set_exposed_input($_POST); |
---|
463 | $_POST['unidad_apro'] = $_POST['field_proyecto_unidadm_value'] && is_numeric($_POST['field_proyecto_unidadm_value']) ? $_POST['field_proyecto_unidadm_value'] : 0; |
---|
464 | $view->pre_execute(); |
---|
465 | $view->execute(); |
---|
466 | if (count($view->result)) { |
---|
467 | $ftypes = array( |
---|
468 | 0 => t('Seleccione'), |
---|
469 | '1' => t('January'), |
---|
470 | '2' => t('February'), |
---|
471 | '3' => t('March'), |
---|
472 | '4' => t('April'), |
---|
473 | '5' => t('May'), |
---|
474 | '6' => t('June'), |
---|
475 | '7' => t('July'), |
---|
476 | '8' => t('August'), |
---|
477 | '9' => t('September'), |
---|
478 | '10' => t('Octuber'), |
---|
479 | '11' => t('November'), |
---|
480 | '12' => t('December'), |
---|
481 | ); |
---|
482 | $new_result = array(); |
---|
483 | $nids = array(); |
---|
484 | $mes_inicio = isset($_POST['mes_seguimiento_0']) && isset($ftypes[$_POST['mes_seguimiento_0'] - 1]) ? $_POST['mes_seguimiento_0'] - 1 : 0; |
---|
485 | $mes_final = isset($_POST['mes_seguimiento_1']) && isset($ftypes[$_POST['mes_seguimiento_1'] - 1]) ? $_POST['mes_seguimiento_1'] - 1 : 11; |
---|
486 | if ($mes_inicio > $mes_final) { |
---|
487 | $au = $mes_final; |
---|
488 | $mes_final = $mes_inicio; |
---|
489 | $mes_inicio = $au; |
---|
490 | } |
---|
491 | foreach($view->result as $i => $values) { |
---|
492 | if (!isset($nids[$values->nid])) { |
---|
493 | $nodo = node_load($values->nid); |
---|
494 | $nids[$values->nid] = $values->nid; |
---|
495 | $seguimiento = _seguimiento_financiero_todosmes_proyecto_load_solo_datos_aprobados($nodo); |
---|
496 | $metafisica = _seguimiento_metafisica_todosmes_proyecto_load_solo_datos_aprobados($nodo); |
---|
497 | $totalCausado = 0; |
---|
498 | $asignadoMes = 0; |
---|
499 | $metatotalCausado = 0; |
---|
500 | $metaasignadoMes = 0; |
---|
501 | $totalComprometido = 0; |
---|
502 | $totalpagado = 0; |
---|
503 | for($j = $mes_inicio; $j <= $mes_final; $j++) { |
---|
504 | $asignadoMes += $seguimiento['seguimiento_financiero_todosmes'][$j]['asignadoMes']; |
---|
505 | $totalCausado += $seguimiento['seguimiento_financiero_todosmes'][$j]['causadoMes']; |
---|
506 | $totalComprometido += $seguimiento['seguimiento_financiero_todosmes'][$j]['comprometidoMes']; |
---|
507 | $totalpagado += $seguimiento['seguimiento_financiero_todosmes'][$j]['pagadoMes']; |
---|
508 | $metaasignadoMes += $metafisica['seguimiento_metafisica_todosmes'][$j]['planificadoMes']; |
---|
509 | $metatotalCausado += $metafisica['seguimiento_metafisica_todosmes'][$j]['ejecutadoMes']; |
---|
510 | } |
---|
511 | $porc_ejecucion_financiera = $asignadoMes ? (($totalCausado/$asignadoMes) *100) . '%' : 'N/A'; |
---|
512 | $porc_ejecucion_meta = $metaasignadoMes ? (($metatotalCausado/$metaasignadoMes) *100) . '%' : 'N/A'; |
---|
513 | $values->meta_asignado = $metaasignadoMes; |
---|
514 | $values->meta_causado = $metatotalCausado; |
---|
515 | $values->meta_porc = $porc_ejecucion_meta; |
---|
516 | $values->finan_asignado = $asignadoMes; |
---|
517 | $values->finan_causado = $totalCausado; |
---|
518 | $values->finan_comprometido = $totalComprometido; |
---|
519 | $values->finan_pagado = $totalpagado; |
---|
520 | $values->finan_porc = $porc_ejecucion_financiera; |
---|
521 | if ($values->proyectos_reformular_id_ref && $values->proyectos_reformular_unidad) { |
---|
522 | $values->node_data_field_proyecto_unidadm_field_proyecto_unidadm_value = $values->proyectos_reformular_unidad; |
---|
523 | } |
---|
524 | $new_result[] = $values; |
---|
525 | } |
---|
526 | } |
---|
527 | $view->result = $new_result; |
---|
528 | } |
---|
529 | return $view->render(); |
---|
530 | } |
---|
531 | |
---|
532 | /** |
---|
533 | * Implementation of sipp_report2_matriz_de_procesos_reporte_page(). |
---|
534 | * Display matriz de procesos reports |
---|
535 | */ |
---|
536 | function sipp_report2_matriz_de_procesos_reporte_page(){ |
---|
537 | $view = views_get_view('matriz_procesos'); |
---|
538 | $display_id = 'default'; |
---|
539 | $view->set_display($display_id); |
---|
540 | $view->override_path = $_GET['q']; |
---|
541 | $view->set_exposed_input($_POST); |
---|
542 | $_POST['unidad_apro'] = $_POST['field_proyecto_unidadm_value'] && is_numeric($_POST['field_proyecto_unidadm_value']) ? $_POST['field_proyecto_unidadm_value'] : 0; |
---|
543 | $view->pre_execute(); |
---|
544 | $view->execute(); |
---|
545 | if (count($view->result)) { |
---|
546 | $ftypes = array( |
---|
547 | 0 => t('Seleccione'), |
---|
548 | '1' => t('January'), |
---|
549 | '2' => t('February'), |
---|
550 | '3' => t('March'), |
---|
551 | '4' => t('April'), |
---|
552 | '5' => t('May'), |
---|
553 | '6' => t('June'), |
---|
554 | '7' => t('July'), |
---|
555 | '8' => t('August'), |
---|
556 | '9' => t('September'), |
---|
557 | '10' => t('Octuber'), |
---|
558 | '11' => t('November'), |
---|
559 | '12' => t('December'), |
---|
560 | ); |
---|
561 | $new_result = array(); |
---|
562 | $nids = array(); |
---|
563 | $mes_inicio = isset($_POST['mes_seguimiento_0']) && isset($ftypes[$_POST['mes_seguimiento_0'] - 1]) ? $_POST['mes_seguimiento_0'] - 1 : 0; |
---|
564 | $mes_final = isset($_POST['mes_seguimiento_1']) && isset($ftypes[$_POST['mes_seguimiento_1'] - 1]) ? $_POST['mes_seguimiento_1'] - 1 : 11; |
---|
565 | if ($mes_inicio > $mes_final) { |
---|
566 | $au = $mes_final; |
---|
567 | $mes_final = $mes_inicio; |
---|
568 | $mes_inicio = $au; |
---|
569 | } |
---|
570 | foreach($view->result as $i => $values) { |
---|
571 | if (!isset($nids[$values->nid])) { |
---|
572 | $nodo = node_load($values->nid); |
---|
573 | $nids[$values->nid] = $values->nid; |
---|
574 | $seguimiento = _seguimiento_financiero_todosmes_proyecto_load_solo_datos_aprobados($nodo); |
---|
575 | $metafisica = _seguimiento_metafisica_todosmes_proyecto_load_solo_datos_aprobados($nodo); |
---|
576 | $totalCausado = 0; |
---|
577 | $asignadoMes = 0; |
---|
578 | $metatotalCausado = 0; |
---|
579 | $metaasignadoMes = 0; |
---|
580 | for($j = $mes_inicio; $j <= $mes_final; $j++) { |
---|
581 | $asignadoMes += $seguimiento['seguimiento_financiero_todosmes'][$j]['asignadoMes']; |
---|
582 | $totalCausado += $seguimiento['seguimiento_financiero_todosmes'][$j]['causadoMes']; |
---|
583 | $metaasignadoMes += $metafisica['seguimiento_metafisica_todosmes'][$j]['planificadoMes']; |
---|
584 | $metatotalCausado += $metafisica['seguimiento_metafisica_todosmes'][$j]['ejecutadoMes']; |
---|
585 | } |
---|
586 | $porc_ejecucion_financiera = $asignadoMes ? (($totalCausado/$asignadoMes) *100) . '%' : 'N/A'; |
---|
587 | $porc_ejecucion_meta = $metaasignadoMes ? (($metatotalCausado/$metaasignadoMes) *100) . '%' : 'N/A'; |
---|
588 | $values->meta_asignado = $metaasignadoMes; |
---|
589 | $values->meta_causado = $metatotalCausado; |
---|
590 | $values->meta_porc = $porc_ejecucion_meta; |
---|
591 | $values->finan_asignado = $asignadoMes; |
---|
592 | $values->finan_causado = $totalCausado; |
---|
593 | $values->finan_porc = $porc_ejecucion_financiera; |
---|
594 | if ($values->proyectos_reformular_id_ref && $values->proyectos_reformular_unidad) { |
---|
595 | $values->node_data_field_proyecto_unidadm_field_proyecto_unidadm_value = $values->proyectos_reformular_unidad; |
---|
596 | } |
---|
597 | $new_result[] = $values; |
---|
598 | } |
---|
599 | } |
---|
600 | $view->result = $new_result; |
---|
601 | } |
---|
602 | return $view->render(); |
---|
603 | } |
---|
604 | |
---|
605 | /** |
---|
606 | * Implementation of hook__menu_alter(). |
---|
607 | */ |
---|
608 | function sipp_report2_menu_alter(&$items) { |
---|
609 | $items['principal']['page callback'] = 'sipp_report2_menu_principal_inicio_page'; |
---|
610 | $items['inicio']['page callback'] = 'sipp_report2_pagina_inicio_page'; |
---|
611 | } |
---|
612 | |
---|
613 | /** |
---|
614 | * Implementation of sipp_report2_menu_principal_inicio_page(). |
---|
615 | * Display alter menu principal |
---|
616 | */ |
---|
617 | function sipp_report2_menu_principal_inicio_page(){ |
---|
618 | $output = menu_principal_inicio_page(); |
---|
619 | // $output .= sipp_report2_page(); |
---|
620 | return $output; |
---|
621 | } |
---|
622 | |
---|
623 | /** |
---|
624 | * Implementation of sipp_report2_pagina_inicio_page(). |
---|
625 | * Display alter pagina inicio |
---|
626 | */ |
---|
627 | function sipp_report2_pagina_inicio_page() { |
---|
628 | global $user; |
---|
629 | if($user->uid > 0){ |
---|
630 | $page_content = sipp_report2_menu_principal_inicio_page(); |
---|
631 | } |
---|
632 | else { |
---|
633 | $page_content = pagina_inicio_page(); |
---|
634 | } |
---|
635 | return $page_content; |
---|
636 | } |
---|
637 | |
---|
638 | /* |
---|
639 | * Implementation of hook_menu() |
---|
640 | */ |
---|
641 | function sipp_report2_menu() { |
---|
642 | $items = array(); |
---|
643 | $items['sipp_report2'] = array( |
---|
644 | 'title' => t('Reportes'), |
---|
645 | 'page callback' => 'sipp_report2_page', |
---|
646 | 'access callback' => true, |
---|
647 | 'type' => MENU_CALLBACK, |
---|
648 | ); |
---|
649 | $items['sipp_report2/matriz_de_procesos'] = array( |
---|
650 | 'title' => t('MatrÃz de Procesos'), |
---|
651 | 'page callback' => 'sipp_report2_matriz_de_procesos_reporte_page', |
---|
652 | 'access callback' => true, |
---|
653 | 'type' => MENU_LOCAL_TASK, |
---|
654 | 'weight' => 1, |
---|
655 | ); |
---|
656 | $items['sipp_report2/resultados_por_unidad_ejecutora'] = array( |
---|
657 | 'title' => t('Resultados por Unidad Ejecutora'),//Mensual |
---|
658 | 'page callback' => 'sipp_report2_resultados_por_unidad_ejecutora_page', |
---|
659 | 'access callback' => true, |
---|
660 | 'type' => MENU_LOCAL_TASK, |
---|
661 | 'weight' => 2, |
---|
662 | ); |
---|
663 | $items['sipp_report2/consulta_proyectosoperativos'] = array( |
---|
664 | 'title' => t('Consulta de Proyectos Operativos'), |
---|
665 | 'page callback' => 'sipp_report2_consulta_proyectos_operativos_reporte_page', |
---|
666 | 'access callback' => true, |
---|
667 | 'type' => MENU_LOCAL_TASK, |
---|
668 | 'weight' => 5, |
---|
669 | ); |
---|
670 | $items['sipp_report2/consulta_partidas_fuentes'] = array( |
---|
671 | 'title' => t('Reporte de Partidas'), |
---|
672 | 'page callback' => 'sipp_report2_consulta_partidas_fuentes_page', |
---|
673 | 'access callback' => true, |
---|
674 | 'type' => MENU_LOCAL_TASK, |
---|
675 | 'weight' => 5, |
---|
676 | ); |
---|
677 | return $items; |
---|
678 | } |
---|
679 | |
---|
680 | /** |
---|
681 | * Implementation of sipp_report2_page(). |
---|
682 | * Display menu nuevos reportes |
---|
683 | */ |
---|
684 | function sipp_report2_page(){ |
---|
685 | $path_modulo_menu_principal = drupal_get_path('module', 'principal_inicio_sipp'); |
---|
686 | //reportes disponibles |
---|
687 | $page_content .= '<br><br>'; |
---|
688 | $page_content .= '<h4>Nuevos Reportes</h4>'; |
---|
689 | $page_content .= '<table align=\"center\" border=\"0\"><tr>'; |
---|
690 | $image_tag = theme_image($path_modulo_menu_principal.'/img/reportes/matrizprocesos.png').'<br>'.'<b>'.t('Matriz de Procesos').'</b>'; |
---|
691 | $page_content .= "<td width=\"20%\" align=\"center\">".l($image_tag, 'sipp_report2/matriz_de_procesos', array('html'=>TRUE))."</td>"; |
---|
692 | $image_tag = theme_image($path_modulo_menu_principal.'/img/reportes/unidadejecutora.png').'<br>'.'<b>'.t('Resultados por Unidad Ejecutora').'</b>'; |
---|
693 | $page_content .= "<td width=\"20%\" align=\"center\">".l($image_tag, 'sipp_report2/resultados_por_unidad_ejecutora', array('html'=>TRUE))."</td>"; |
---|
694 | $image_tag = theme_image($path_modulo_menu_principal.'/img/reportes/areasestrategicasdelministerio.png').'<br>'.'<b>'.t('Partidas y Fuentes de Financiamiento').'</b>'; |
---|
695 | $page_content .= "<td width=\"20%\" align=\"center\">".l($image_tag, 'sipp_report2/consulta_partidas_fuentes', array('html'=>TRUE))."</td>"; |
---|
696 | $image_tag = theme_image($path_modulo_menu_principal.'/img/reportes/consultadeproyectos.png').'<br>'.'<b>'.t('Consultas de Proyectos').'</b>'; |
---|
697 | $page_content .= "<td width=\"20%\" align=\"center\">".l($image_tag, 'sipp_report2/consulta_proyectosoperativos', array('html'=>TRUE))."</td>"; |
---|
698 | $page_content .= '</tr></table>'; |
---|
699 | $page_content .= '<br><br>'; |
---|
700 | return $page_content; |
---|
701 | } |
---|
702 | |
---|
703 | /** |
---|
704 | * Implementation of hook_views_api(). |
---|
705 | */ |
---|
706 | function sipp_report2_views_api() { |
---|
707 | return array( |
---|
708 | 'api' => '2.0', |
---|
709 | 'path' => drupal_get_path('module', 'sipp_report2') . '/views', |
---|
710 | ); |
---|
711 | } |
---|
712 | |
---|
713 | /* |
---|
714 | * hook_form_alter() |
---|
715 | */ |
---|
716 | function sipp_report2_form_alter(&$form, $form_state, $form_id) { |
---|
717 | if ($form_id == 'views_exposed_form') { |
---|
718 | if ($form['#id'] == 'views-exposed-form-matriz-procesos-default' || $form['#id'] == 'views-exposed-form-matriz-procesos-page-1' || $form['#id'] == 'views-exposed-form-matriz-procesos-page-2' || $form['#id'] == 'views-exposed-form-matriz-procesos-page-3') { |
---|
719 | $form['#method'] = 'post'; |
---|
720 | $info = array(); |
---|
721 | $ftypes = array( |
---|
722 | 0 => t('Seleccione'), |
---|
723 | '1' => t('January'), |
---|
724 | '2' => t('February'), |
---|
725 | '3' => t('March'), |
---|
726 | '4' => t('April'), |
---|
727 | '5' => t('May'), |
---|
728 | '6' => t('June'), |
---|
729 | '7' => t('July'), |
---|
730 | '8' => t('August'), |
---|
731 | '9' => t('September'), |
---|
732 | '10' => t('Octuber'), |
---|
733 | '11' => t('November'), |
---|
734 | '12' => t('December'), |
---|
735 | ); |
---|
736 | $form['mes_seguimiento_0'] = array( |
---|
737 | '#type' => 'select', |
---|
738 | '#default_value' => 0, |
---|
739 | '#options' => $ftypes, |
---|
740 | ); |
---|
741 | $form['mes_seguimiento_1'] = array( |
---|
742 | '#type' => 'select', |
---|
743 | '#default_value' => 0, |
---|
744 | '#options' => $ftypes, |
---|
745 | ); |
---|
746 | $campo = $form['#id'] == 'views-exposed-form-matriz-procesos-page-3' ? 'filter-year' : 'filter-field_proyecto_status_value_many_to_one'; |
---|
747 | foreach($form['#info'] as $id => $value) { |
---|
748 | if ($id == $campo) { |
---|
749 | $instance = array(); |
---|
750 | $instance['value'] = 'mes_seguimiento_0'; |
---|
751 | $instance['label'] = t('Desde'); |
---|
752 | $instance['operator'] = NULL; |
---|
753 | $info['filter-' . 'mes_seguimiento_0'] = $instance; |
---|
754 | $instance = array(); |
---|
755 | $instance['value'] = 'mes_seguimiento_1'; |
---|
756 | $instance['label'] = t('Hasta'); |
---|
757 | $instance['operator'] = NULL; |
---|
758 | $info['filter-' . 'mes_seguimiento_1'] = $instance; |
---|
759 | } |
---|
760 | $info[$id] = $value; |
---|
761 | } |
---|
762 | $form['#info'] = $info; |
---|
763 | if ($form['#id'] != 'views-exposed-form-matriz-procesos-page-3') { |
---|
764 | $form['#info']['filter-unidad_apro']['label'] = ''; |
---|
765 | $form['unidad_apro'] = array('#type' => 'hidden', '#value' => isset($_POST['unidad_apro']) ? $_POST['unidad_apro'] : 0); |
---|
766 | } |
---|
767 | } |
---|
768 | } |
---|
769 | if ($form['#id'] == 'views-exposed-form-matriz-procesos-page-2') { |
---|
770 | $form1 = sipp_report2_proyecto_genera_campos_form(); |
---|
771 | foreach($form1['#title_combos'] as $id => $varia) { |
---|
772 | $instance = array(); |
---|
773 | $instance['value'] = $id;; |
---|
774 | $instance['operator'] = NULL; |
---|
775 | $form['#info']['filter-' . $id] = $instance; |
---|
776 | } |
---|
777 | $instance = array(); |
---|
778 | $instance['value'] = 'ae'; |
---|
779 | $instance['operator'] = NULL; |
---|
780 | $form['#info']['filter-ae'] = $instance; |
---|
781 | $instance = array(); |
---|
782 | $instance['value'] = 'otros'; |
---|
783 | $instance['operator'] = NULL; |
---|
784 | $form['#info']['filter-otros'] = $instance; |
---|
785 | $instance = array(); |
---|
786 | $instance['value'] = 'proyectos_reformulacion'; |
---|
787 | $instance['operator'] = NULL; |
---|
788 | $form['#info']['filter-proyectos_reformulacion'] = $instance; |
---|
789 | $form += $form1; |
---|
790 | } |
---|
791 | if ($form['#id'] == 'views-exposed-form-matriz-procesos-page-3') { |
---|
792 | $field = content_fields('field_accion_esp_programacion', 'accion_especifica'); |
---|
793 | $tree = taxonomy_get_tree($field['vid']); |
---|
794 | $vtid = $field['vtid']; |
---|
795 | $partidas = array(); |
---|
796 | if ($tree) { |
---|
797 | foreach ($tree as $term) { |
---|
798 | if (isset($vtid[$term->tid])) { |
---|
799 | $form['partida_label_' . $term->tid] = array('#type' => 'hidden', '#value' => $term->name); |
---|
800 | $partidas[$term->tid] = $term->name; |
---|
801 | } |
---|
802 | } |
---|
803 | } |
---|
804 | if (count($partidas)) { |
---|
805 | $form['partidas'] = array( |
---|
806 | '#type' => 'checkboxes', |
---|
807 | '#default_value' => 0, |
---|
808 | '#options' => $partidas, |
---|
809 | ); |
---|
810 | $instance = array(); |
---|
811 | $instance['value'] = 'partidas'; |
---|
812 | $instance['label'] = t('Partidas'); |
---|
813 | $instance['operator'] = NULL; |
---|
814 | $form['#info']['filter-' . 'partidas'] = $instance; |
---|
815 | } |
---|
816 | //financiamiento |
---|
817 | $arreglo_financiamiento = array(); |
---|
818 | $accion_especifica_number_fields = variable_get('accion_especifica_number_fields', 4); |
---|
819 | if ($accion_especifica_number_fields > 0) { |
---|
820 | for($i = 0; $i < $accion_especifica_number_fields; $i++) { |
---|
821 | $arreglo_financiamiento['financiamiento_' . $i] = variable_get('accion_especifica_financiamiento_label_' . $i, '') ? variable_get('accion_especifica_financiamiento_label_' . $i, '') : ''; |
---|
822 | $arreglo_campos = variable_get('accion_especifica_financiamiento_options_' . $i, array()); |
---|
823 | foreach($arreglo_campos as $id_cam) { |
---|
824 | if ($id_cam) { |
---|
825 | $field = content_fields($id_cam, 'accion_especifica'); |
---|
826 | $form['finaciamiento_father_' . $id_cam] = array('#type' => 'hidden', '#value' => $arreglo_financiamiento['financiamiento_' . $i]); |
---|
827 | $form['finaciamiento_label_' . $id_cam] = array('#type' => 'hidden', '#value' => $field['widget']['label']); |
---|
828 | $arreglo_financiamiento_fields[$arreglo_financiamiento['financiamiento_' . $i]][$id_cam] = $field['widget']['label']; |
---|
829 | } |
---|
830 | } |
---|
831 | } |
---|
832 | } |
---|
833 | if (count($arreglo_financiamiento_fields)) { |
---|
834 | $form['financiamiento'] = array( |
---|
835 | '#type' => 'select', |
---|
836 | '#default_value' => 0, |
---|
837 | '#options' => $arreglo_financiamiento_fields, |
---|
838 | '#multiple' => TRUE, |
---|
839 | ); |
---|
840 | $instance = array(); |
---|
841 | $instance['value'] = 'financiamiento'; |
---|
842 | $instance['label'] = t('Fuentes de Financiamiento'); |
---|
843 | $instance['operator'] = NULL; |
---|
844 | $form['#info']['filter-' . 'financiamiento'] = $instance; |
---|
845 | } |
---|
846 | $mostrar = array( |
---|
847 | 'planificado' => t('Planificado'), |
---|
848 | 'ejecutado' => t('Ejecutado'), |
---|
849 | 'grafico' => t('Mostrar Gráfico'), |
---|
850 | ); |
---|
851 | $form['mostrar'] = array( |
---|
852 | '#type' => 'checkboxes', |
---|
853 | '#default_value' => 0, |
---|
854 | '#options' => $mostrar, |
---|
855 | ); |
---|
856 | $instance = array(); |
---|
857 | $instance['value'] = 'mostrar'; |
---|
858 | $instance['operator'] = NULL; |
---|
859 | $form['#info']['filter-' . 'mostrar'] = $instance; |
---|
860 | drupal_add_js(drupal_get_path('module','sipp_report2').'/js/sipp_report2.js'); |
---|
861 | $form['graph_dimesions'] = array( |
---|
862 | '#type' => 'fieldset', |
---|
863 | '#title' => t('Dimensiones del Gráfico'), |
---|
864 | '#collapsible' => FALSE, |
---|
865 | '#collapsed' => 0, |
---|
866 | '#tree' => FALSE, |
---|
867 | ); |
---|
868 | $form['graph_dimesions']['width'] = array( |
---|
869 | '#type' => 'textfield', |
---|
870 | '#title' => t('Ancho'), |
---|
871 | '#default_value' => $node->title, |
---|
872 | '#size' => 20, |
---|
873 | '#maxlength' => 10, |
---|
874 | ); |
---|
875 | $form['graph_dimesions']['height'] = array( |
---|
876 | '#type' => 'textfield', |
---|
877 | '#title' => t('Largo'), |
---|
878 | '#default_value' => $node->title, |
---|
879 | '#size' => 20, |
---|
880 | '#maxlength' => 10, |
---|
881 | ); |
---|
882 | $instance = array(); |
---|
883 | $instance['value'] = 'graph_dimesions'; |
---|
884 | $instance['operator'] = NULL; |
---|
885 | $form['#info']['filter-' . 'graph_dimesions'] = $instance; |
---|
886 | } |
---|
887 | } |
---|
888 | |
---|
889 | |
---|
890 | /** |
---|
891 | * Implementation of sipp_report2_proyecto_genera_campos_form(). |
---|
892 | * Formulario con todos los campos disponibles en el proyecto. |
---|
893 | */ |
---|
894 | function sipp_report2_proyecto_genera_campos_form() { |
---|
895 | $form = array(); |
---|
896 | $node_type = content_types('proyectos_operativos'); |
---|
897 | $fields = $node_type['fields']; |
---|
898 | //DATOS BASICOS |
---|
899 | //Datos Básicos de Identificación del Proyecto |
---|
900 | $title_combos = array(); |
---|
901 | $title_combos['db']['title'] = t('Datos Básicos'); |
---|
902 | $arreglo['db']['identificacion'] = array(); |
---|
903 | $arreglo['db']['identificacion'] = array( |
---|
904 | 'title' => t('Nombre del Proyecto'), |
---|
905 | 'field_proyecto_codigo' => 'field_proyecto_codigo', |
---|
906 | 'field_proyecto_fecha_i' => 'field_proyecto_fecha_i', |
---|
907 | 'field_proyecto_fecha_f' => 'field_proyecto_fecha_f', |
---|
908 | 'field_proyecto_status' => 'field_proyecto_status', |
---|
909 | 'field_proyecto_situacion_p' => 'field_proyecto_situacion_p', |
---|
910 | 'field_proyecto_plurianual' => 'field_proyecto_plurianual', |
---|
911 | 'field_proyecto_monto_anual' => 'field_proyecto_monto_anual', |
---|
912 | 'field_proyecto_total' => 'field_proyecto_total', |
---|
913 | 'field_proyecto_poan' => 'field_proyecto_poan', |
---|
914 | ); |
---|
915 | $title_combos['db']['identificacion']['title'] = t('Datos Básicos de Identificación del Proyecto'); |
---|
916 | //Gerente del Proyecto |
---|
917 | $arreglo['db']['gerentep'] = array(); |
---|
918 | $arreglo['db']['gerentep'] = array( |
---|
919 | 'field_proyecto_ente' => 'field_proyecto_ente', |
---|
920 | 'field_proyecto_autoridad' => 'field_proyecto_autoridad', |
---|
921 | 'field_proyecto_lider' => 'field_proyecto_lider', |
---|
922 | 'field_proyecto_unidad_a' => 'field_proyecto_unidad_a', |
---|
923 | 'field_proyecto_cargo' => 'field_proyecto_cargo', |
---|
924 | 'field_proyecto_telefono' => 'field_proyecto_telefono', |
---|
925 | 'field_proyecto_correo' => 'field_proyecto_correo', |
---|
926 | ); |
---|
927 | $title_combos['db']['gerentep']['title'] = t('Gerente del Proyecto'); |
---|
928 | //Ãrea Estrategica |
---|
929 | $pndes = variable_get('proyectos_operativos_muestra_pndes', TRUE); |
---|
930 | $mcti = variable_get('proyectos_operativos_muestra_mcti', TRUE); |
---|
931 | $arreglo['db']['areae'] = array(); |
---|
932 | if ($pndes) { |
---|
933 | $arreglo['db']['areae']['field_proyecto_pndes'] = 'field_proyecto_pndes'; |
---|
934 | } |
---|
935 | if ($mcti) { |
---|
936 | $arreglo['db']['areae']['field_proyecto_mcti'] = 'field_proyecto_mcti'; |
---|
937 | } |
---|
938 | $title_combos['db']['areae']['title'] = t('Ãrea Estratégica'); |
---|
939 | //DATOS GENERALES |
---|
940 | $title_combos['dg']['title'] = t('Datos Generales'); |
---|
941 | //Clasificación Sectorial |
---|
942 | $arreglo['dg']['sector'] = array(); |
---|
943 | $arreglo['dg']['sector'] = array( |
---|
944 | 'field_proyecto_sector' => 'field_proyecto_sector', |
---|
945 | ); |
---|
946 | $title_combos['dg']['sector']['title'] = t('Clasificación Sectorial'); |
---|
947 | //Talento Humano |
---|
948 | $arreglo['dg']['talentoh'] = array(); |
---|
949 | if (variable_get('proyectos_operativos_muestra_talento', TRUE)) { |
---|
950 | $arreglo['dg']['talentoh'] = array( |
---|
951 | 'field_proyecto_institucionth' => 'field_proyecto_institucionth', |
---|
952 | 'field_proyecto_nombres_a' => 'field_proyecto_nombres_a', |
---|
953 | 'field_proyecto_cargo_th' => 'field_proyecto_cargo_th', |
---|
954 | 'field_proyecto_rol_th' => 'field_proyecto_rol_th', |
---|
955 | 'field_proyecto_esfuerzo' => 'field_proyecto_esfuerzo', |
---|
956 | 'field_proyecto_formacion' => 'field_proyecto_formacion', |
---|
957 | ); |
---|
958 | } |
---|
959 | $title_combos['dg']['talentoh']['title'] = t('Talento Humano'); |
---|
960 | //Capacidades |
---|
961 | $arreglo['dg']['capacidades'] = array(); |
---|
962 | if (variable_get('proyectos_operativos_muestra_capacidades', TRUE)) { |
---|
963 | $arreglo['dg']['capacidades'] = array( |
---|
964 | 'field_proyecto_institucion_alc' => 'field_proyecto_institucion_alc', |
---|
965 | 'field_proyecto_infraestructura' => 'field_proyecto_infraestructura', |
---|
966 | 'field_proyecto_equipos' => 'field_proyecto_equipos', |
---|
967 | 'field_proyecto_insumos' => 'field_proyecto_insumos', |
---|
968 | 'field_proyectos_servicios' => 'field_proyectos_servicios', |
---|
969 | ); |
---|
970 | } |
---|
971 | $title_combos['dg']['capacidades']['title'] = t('Capacidades'); |
---|
972 | //Instituciones |
---|
973 | $arreglo['dg']['relacion'] = array(); |
---|
974 | $arreglo['dg']['relacion'] = array( |
---|
975 | 'field_proyecto_relacion' => 'field_proyecto_relacion', |
---|
976 | ); |
---|
977 | $title_combos['dg']['relacion']['title'] = t('Instituciones'); |
---|
978 | //Empleos Generados |
---|
979 | $arreglo['dg']['empleosg'] = array(); |
---|
980 | if (variable_get('proyectos_operativos_muestra_beneficiario', TRUE)) { |
---|
981 | $arreglo['dg']['empleosg'] = array( |
---|
982 | 'field_proyecto_emdirecto' => 'field_proyecto_emdirecto', |
---|
983 | 'field_proyecto_efdirecto' => 'field_proyecto_efdirecto', |
---|
984 | ); |
---|
985 | if (variable_get('proyectos_operativos_muestra_beneficiarios_indirectos', TRUE)) { |
---|
986 | $arreglo['dg']['empleosg']['field_proyecto_emindirecto'] = 'field_proyecto_emindirecto'; |
---|
987 | $arreglo['dg']['empleosg']['field_proyecto_efindirecto'] = 'field_proyecto_efindirecto'; |
---|
988 | } |
---|
989 | } |
---|
990 | $title_combos['dg']['empleosg']['title'] = t('Empleos Generados'); |
---|
991 | //Objetivos del Proyecto |
---|
992 | $arreglo['dg']['objetivosp'] = array(); |
---|
993 | $arreglo['dg']['objetivosp'] = array( |
---|
994 | 'field_proyecto_og' => 'field_proyecto_og', |
---|
995 | 'field_proyecto_oe' => 'field_proyecto_oe', |
---|
996 | ); |
---|
997 | //INDICADORES DEL PROYECTO |
---|
998 | //Enunciado del Problema |
---|
999 | $title_combos['ip']['title'] = t('Indicadores del Proyecto'); |
---|
1000 | $arreglo['ip']['enunciadop'] = array(); |
---|
1001 | if (variable_get('proyectos_operativos_muestra_enunciado_problema', TRUE)) { |
---|
1002 | $arreglo['ip']['enunciadop'] = array( |
---|
1003 | 'field_proyecto_causas' => 'field_proyecto_causas', |
---|
1004 | 'field_proyecto_problemas' => 'field_proyecto_problemas', |
---|
1005 | 'field_proyecto_consecuencias' => 'field_proyecto_consecuencias', |
---|
1006 | ); |
---|
1007 | } |
---|
1008 | $title_combos['ip']['enunciadop']['title'] = t('Enunciado del Problema'); |
---|
1009 | //Justificación del Proyecto |
---|
1010 | $arreglo['ip']['justificacion'] = array(); |
---|
1011 | if (variable_get('proyectos_operativos_muestra_justicacion', TRUE)) { |
---|
1012 | $arreglo['ip']['justificacion'] = array( |
---|
1013 | 'field_proyecto_justificacion' => 'field_proyecto_justificacion', |
---|
1014 | ); |
---|
1015 | } |
---|
1016 | $title_combos['ip']['justificacion']['title'] = t('Justificación del Proyecto'); |
---|
1017 | //Alcance del Proyecto |
---|
1018 | $arreglo['ip']['alcance'] = array(); |
---|
1019 | if (variable_get('proyectos_operativos_muestra_alcance', TRUE)) { |
---|
1020 | $arreglo['ip']['alcance'] = array( |
---|
1021 | 'field_proyecto_alcance' => 'field_proyecto_alcance', |
---|
1022 | ); |
---|
1023 | } |
---|
1024 | $title_combos['ip']['alcance']['title'] = t('Alcance del Proyecto'); |
---|
1025 | //Situación Actual del Proyecto |
---|
1026 | $arreglo['ip']['situaciona'] = array(); |
---|
1027 | if (variable_get('proyectos_operativos_muestra_sa', TRUE)) { |
---|
1028 | $arreglo['ip']['situaciona'] = array( |
---|
1029 | 'field_proyecto_sa_descripcion' => 'field_proyecto_sa_descripcion', |
---|
1030 | ); |
---|
1031 | if (variable_get('proyectos_operativos_muestra_sa_cuantificacion', TRUE)) { |
---|
1032 | $arreglo['ip']['situaciona']['field_proyecto_sa_cuantificacion'] = 'field_proyecto_sa_cuantificacion'; |
---|
1033 | } |
---|
1034 | $arreglo['ip']['situaciona']['field_proyecto_sa_formulai'] = 'field_proyecto_sa_formulai'; |
---|
1035 | $arreglo['ip']['situaciona']['field_proyecto_sa_fuentei'] = 'field_proyecto_sa_fuentei'; |
---|
1036 | $arreglo['ip']['situaciona']['field_proyecto_sa_fecha'] = 'field_proyecto_sa_fecha'; |
---|
1037 | } |
---|
1038 | $title_combos['ip']['situaciona']['title'] = t('Situación Actual del Proyecto'); |
---|
1039 | //Situación Objetivo |
---|
1040 | $arreglo['ip']['situaciono'] = array(); |
---|
1041 | if (variable_get('proyectos_operativos_muestra_so', TRUE)) { |
---|
1042 | $arreglo['ip']['situaciono'] = array( |
---|
1043 | 'field_proyecto_so_descripcion' => 'field_proyecto_so_descripcion', |
---|
1044 | 'field_proyecto_so_cuantificacion' => 'field_proyecto_so_cuantificacion', |
---|
1045 | 'field_proyecto_tiempoi' => 'field_proyecto_tiempoi', |
---|
1046 | ); |
---|
1047 | } |
---|
1048 | $title_combos['ip']['situaciono']['title'] = t('Situación Objetivo del Proyecto'); |
---|
1049 | //Indicador del resultado del Proyecto |
---|
1050 | $arreglo['ip']['resultadop'] = array(); |
---|
1051 | $arreglo['ip']['resultadop'] = array( |
---|
1052 | 'field_proyecto_descripcion_bien' => 'field_proyecto_descripcion_bien', |
---|
1053 | 'field_proyecto_unidadm' => 'field_proyecto_unidadm', |
---|
1054 | 'field_proyecto_meta_fisica' => 'field_proyecto_meta_fisica', |
---|
1055 | ); |
---|
1056 | $title_combos['ip']['resultadop']['title'] = t('Indicador del resultado del Proyecto'); |
---|
1057 | $campos['todos-los-campos'] = t('Mostrar todos los campos'); |
---|
1058 | //$campos['title'] = t('Nombre del Proyecto'); |
---|
1059 | if (count($fields)) { |
---|
1060 | foreach($fields as $id => $field) { |
---|
1061 | if (!$field['display_settings']['full']['exclude']) { |
---|
1062 | //DATOS BASICOS DEL PROYECTO |
---|
1063 | //Datos Básicos de Identificación del Proyecto |
---|
1064 | if (array_key_exists($id, $arreglo['db']['identificacion'])) { |
---|
1065 | $arreglo['db']['identificacion'][$id] = $field['widget']['label']; |
---|
1066 | } |
---|
1067 | //Gerente del Proyecto |
---|
1068 | elseif(array_key_exists($id, $arreglo['db']['gerentep'])) { |
---|
1069 | $arreglo['db']['gerentep'][$id] = $field['widget']['label']; |
---|
1070 | } |
---|
1071 | //Ãrea Estrategica |
---|
1072 | elseif(array_key_exists($id, $arreglo['db']['areae'])) { |
---|
1073 | $arreglo['db']['areae'][$id] = $field['widget']['label']; |
---|
1074 | } |
---|
1075 | //DATOS GENERALES |
---|
1076 | //Clasificación Sectorial |
---|
1077 | elseif(array_key_exists($id, $arreglo['dg']['sector'])) { |
---|
1078 | $arreglo['dg']['sector'][$id] = $field['widget']['label']; |
---|
1079 | } |
---|
1080 | //Talento Humano |
---|
1081 | elseif(array_key_exists($id, $arreglo['dg']['talentoh'])) { |
---|
1082 | $arreglo['dg']['talentoh'][$id] = $field['widget']['label']; |
---|
1083 | } |
---|
1084 | //Capacidades |
---|
1085 | elseif(array_key_exists($id, $arreglo['dg']['capacidades'])) { |
---|
1086 | $arreglo['dg']['capacidades'][$id] = $field['widget']['label']; |
---|
1087 | } |
---|
1088 | //Instituciones |
---|
1089 | elseif(array_key_exists($id, $arreglo['dg']['relacion'])) { |
---|
1090 | $arreglo['dg']['relacion'][$id] = $field['widget']['label']; |
---|
1091 | } |
---|
1092 | //Empleos Generados |
---|
1093 | elseif(array_key_exists($id, $arreglo['dg']['empleosg'])) { |
---|
1094 | $arreglo['dg']['empleosg'][$id] = $field['widget']['label']; |
---|
1095 | } |
---|
1096 | //Objetivos del Proyecto |
---|
1097 | elseif(array_key_exists($id, $arreglo['dg']['objetivosp'])) { |
---|
1098 | $arreglo['dg']['objetivosp'][$id] = $field['widget']['label']; |
---|
1099 | } |
---|
1100 | //INDICADORES DEL PROYECTO |
---|
1101 | //Enunciado del Problema |
---|
1102 | elseif(array_key_exists($id, $arreglo['ip']['enunciadop'])) { |
---|
1103 | $arreglo['ip']['enunciadop'][$id] = $field['widget']['label']; |
---|
1104 | } |
---|
1105 | //Justificación del Proyecto |
---|
1106 | elseif(array_key_exists($id, $arreglo['ip']['justificacion'])) { |
---|
1107 | $arreglo['ip']['justificacion'][$id] = $field['widget']['label']; |
---|
1108 | } |
---|
1109 | //Alcance del Proyecto |
---|
1110 | elseif(array_key_exists($id, $arreglo['ip']['alcance'])) { |
---|
1111 | $arreglo['ip']['alcance'][$id] = $field['widget']['label']; |
---|
1112 | } |
---|
1113 | //Situación Actual del Proyecto |
---|
1114 | elseif(array_key_exists($id, $arreglo['ip']['situaciona'])) { |
---|
1115 | $arreglo['ip']['situaciona'][$id] = $field['widget']['label']; |
---|
1116 | } |
---|
1117 | //Situación Objetivo |
---|
1118 | elseif(array_key_exists($id, $arreglo['ip']['situaciono'])) { |
---|
1119 | $arreglo['ip']['situaciono'][$id] = $field['widget']['label']; |
---|
1120 | } |
---|
1121 | //Indicador del resultado del Proyecto |
---|
1122 | elseif(array_key_exists($id, $arreglo['ip']['resultadop'])) { |
---|
1123 | $arreglo['ip']['resultadop'][$id] = $field['widget']['label']; |
---|
1124 | } |
---|
1125 | //DATOS BASICOS DEL PROYECTO |
---|
1126 | //Datos Básicos de Identificación del Proyecto |
---|
1127 | elseif (variable_get('proyectos_operativos_ac_d_' . $id, FALSE)) { |
---|
1128 | $arreglo['db']['identificacion'][$id] = $field['widget']['label']; |
---|
1129 | } |
---|
1130 | //Gerente del Proyecto |
---|
1131 | elseif (variable_get('proyectos_operativos_ac_di_' . $id, FALSE)) { |
---|
1132 | $arreglo['db']['gerentep'][$id] = $field['widget']['label']; |
---|
1133 | } |
---|
1134 | //Ãrea Estrategica |
---|
1135 | elseif (variable_get('proyectos_operativos_ac_p_' . $id, FALSE)) { |
---|
1136 | $arreglo['db']['areae'][$id] = $field['widget']['label']; |
---|
1137 | } |
---|
1138 | //DATOS GENERALES |
---|
1139 | //Clasificación Sectorial |
---|
1140 | elseif (variable_get('proyectos_operativos_dg_s_' . $id, FALSE)) { |
---|
1141 | $arreglo['dg']['sector'][$id] = $field['widget']['label']; |
---|
1142 | } |
---|
1143 | //Instituciones |
---|
1144 | elseif (variable_get('proyectos_operativos_dg_r_' . $id, FALSE)) { |
---|
1145 | $arreglo['dg']['relacion'][$id] = $field['widget']['label']; |
---|
1146 | } |
---|
1147 | //Objetivos del Proyecto |
---|
1148 | elseif (variable_get('proyectos_operativos_dg_o_' . $id, FALSE)) { |
---|
1149 | $arreglo['dg']['objetivosp'][$id] = $field['widget']['label']; |
---|
1150 | } |
---|
1151 | //Enunciado del Problema |
---|
1152 | elseif (variable_get('proyectos_operativos_ip_in_' . $id, FALSE)) { |
---|
1153 | $arreglo['ip']['enunciadop'][$id] = $field['widget']['label']; |
---|
1154 | } |
---|
1155 | //Alcance del Proyecto |
---|
1156 | elseif (variable_get('proyectos_operativos_ip_al_' . $id, FALSE)) { |
---|
1157 | $arreglo['ip']['alcance'][$id] = $field['widget']['label']; |
---|
1158 | } |
---|
1159 | //Justificación del Proyecto |
---|
1160 | elseif (variable_get('proyectos_operativos_ip_ju_' . $id, FALSE)) { |
---|
1161 | $arreglo['ip']['justificacion'][$id] = $field['widget']['label']; |
---|
1162 | } |
---|
1163 | //Situación Actual del Proyecto |
---|
1164 | elseif (variable_get('proyectos_operativos_ip_sa_' . $id, FALSE)) { |
---|
1165 | $arreglo['ip']['situaciona'][$id] = $field['widget']['label']; |
---|
1166 | } |
---|
1167 | //Situación Objetivo |
---|
1168 | elseif (variable_get('proyectos_operativos_ip_so_' . $id, FALSE)) { |
---|
1169 | $arreglo['ip']['situaciono'][$id] = $field['widget']['label']; |
---|
1170 | } |
---|
1171 | //Indicador del resultado del Proyecto |
---|
1172 | elseif (variable_get('proyectos_operativos_ip_re_' . $id, FALSE)) { |
---|
1173 | $arreglo['ip']['resultadop'][$id] = $field['widget']['label']; |
---|
1174 | } |
---|
1175 | //$campos[$id] = $field['widget']['label']; |
---|
1176 | } |
---|
1177 | //DATOS BASICOS DEL PROYECTO |
---|
1178 | //Datos Básicos de Identificación del Proyecto |
---|
1179 | elseif (array_key_exists($id, $arreglo['db']['identificacion'])) { |
---|
1180 | unset($arreglo['db']['identificacion'][$id]); |
---|
1181 | } |
---|
1182 | //Gerente del Proyecto |
---|
1183 | elseif (array_key_exists($id, $arreglo['db']['gerentep'])) { |
---|
1184 | unset($arreglo['db']['gerentep'][$id]); |
---|
1185 | } |
---|
1186 | //Ãrea Estrategica |
---|
1187 | elseif (array_key_exists($id, $arreglo['db']['areae'])) { |
---|
1188 | unset($arreglo['db']['areae'][$id]); |
---|
1189 | } |
---|
1190 | //DATOS GENERALES |
---|
1191 | //Clasificación Sectorial |
---|
1192 | elseif (array_key_exists($id, $arreglo['dg']['sector'])) { |
---|
1193 | unset($arreglo['dg']['sector'][$id]); |
---|
1194 | } |
---|
1195 | //Talento Humano |
---|
1196 | elseif (array_key_exists($id, $arreglo['dg']['talentoh'])) { |
---|
1197 | unset($arreglo['dg']['talentoh'][$id]); |
---|
1198 | } |
---|
1199 | //Capacidades |
---|
1200 | elseif (array_key_exists($id, $arreglo['dg']['capacidades'])) { |
---|
1201 | unset($arreglo['dg']['capacidades'][$id]); |
---|
1202 | } |
---|
1203 | //Instituciones |
---|
1204 | elseif (array_key_exists($id, $arreglo['dg']['relacion'])) { |
---|
1205 | unset($arreglo['dg']['relacion'][$id]); |
---|
1206 | } |
---|
1207 | //Empleos Generados |
---|
1208 | elseif (array_key_exists($id, $arreglo['dg']['empleosg'])) { |
---|
1209 | unset($arreglo['dg']['empleosg'][$id]); |
---|
1210 | } |
---|
1211 | //Objetivos del Proyecto |
---|
1212 | elseif (array_key_exists($id, $arreglo['dg']['objetivosp'])) { |
---|
1213 | unset($arreglo['dg']['objetivosp'][$id]); |
---|
1214 | } |
---|
1215 | //INDICADORES DEL PROYECTO |
---|
1216 | //Enunciado del Problema |
---|
1217 | elseif (array_key_exists($id, $arreglo['ip']['enunciadop'])) { |
---|
1218 | unset($arreglo['ip']['enunciadop'][$id]); |
---|
1219 | } |
---|
1220 | //Justificación del Proyecto |
---|
1221 | elseif (array_key_exists($id, $arreglo['ip']['justificacion'])) { |
---|
1222 | unset($arreglo['ip']['justificacion'][$id]); |
---|
1223 | } |
---|
1224 | //Alcance del Proyecto |
---|
1225 | elseif (array_key_exists($id, $arreglo['ip']['alcance'])) { |
---|
1226 | unset($arreglo['ip']['alcance'][$id]); |
---|
1227 | } |
---|
1228 | //Situación Actual del Proyecto |
---|
1229 | elseif (array_key_exists($id, $arreglo['ip']['situaciona'])) { |
---|
1230 | unset($arreglo['ip']['situaciona'][$id]); |
---|
1231 | } |
---|
1232 | //Situación Objetivo |
---|
1233 | elseif (array_key_exists($id, $arreglo['ip']['situaciono'])) { |
---|
1234 | unset($arreglo['ip']['situaciono'][$id]); |
---|
1235 | } |
---|
1236 | //Indicador del resultado del Proyecto |
---|
1237 | elseif (array_key_exists($id, $arreglo['ip']['resultadop'])) { |
---|
1238 | unset($arreglo['ip']['resultadop'][$id]); |
---|
1239 | } |
---|
1240 | } |
---|
1241 | } |
---|
1242 | //$campos['proyectos_operativos_flujo'] = t('Flujo de Trabajo'); |
---|
1243 | //DATOS BASICOS DEL PROYECTO |
---|
1244 | $identificacion = count($arreglo['db']['identificacion']); |
---|
1245 | $gerentep = count($arreglo['db']['gerentep']); |
---|
1246 | $areae = count($arreglo['db']['areae']); |
---|
1247 | if ($identificacion || $gerentep || $areae) { |
---|
1248 | $form['db'] = array( |
---|
1249 | '#type' => 'fieldset', |
---|
1250 | '#title' => t('Datos Básicos'), |
---|
1251 | ); |
---|
1252 | } |
---|
1253 | if ($identificacion) { |
---|
1254 | $form['db']['identificacion'] = array( |
---|
1255 | '#type' => 'checkboxes', |
---|
1256 | '#options' => $arreglo['db']['identificacion'], |
---|
1257 | '#default_value' => array(), |
---|
1258 | '#title' => t('Datos Básicos de Identificación del Proyecto'), |
---|
1259 | '#multiple' => TRUE, |
---|
1260 | ); |
---|
1261 | } |
---|
1262 | if ($gerentep) { |
---|
1263 | $form['db']['gerentep'] = array( |
---|
1264 | '#type' => 'checkboxes', |
---|
1265 | '#options' => $arreglo['db']['gerentep'], |
---|
1266 | '#default_value' => array(), |
---|
1267 | '#title' => t('Gerente del Proyecto'), |
---|
1268 | '#multiple' => TRUE, |
---|
1269 | ); |
---|
1270 | } |
---|
1271 | if ($areae) { |
---|
1272 | $form['db']['areae'] = array( |
---|
1273 | '#type' => 'checkboxes', |
---|
1274 | '#options' => $arreglo['db']['areae'], |
---|
1275 | '#default_value' => array(), |
---|
1276 | '#title' => t('Ãrea Estratégica'), |
---|
1277 | '#multiple' => TRUE, |
---|
1278 | ); |
---|
1279 | } |
---|
1280 | //DATOS GENERALES DEL PROYECTO |
---|
1281 | $sector = count($arreglo['dg']['sector']); |
---|
1282 | $talentoh = count($arreglo['dg']['talentoh']); |
---|
1283 | $capacidades = count($arreglo['dg']['capacidades']); |
---|
1284 | $beneficiarios = count($arreglo['dg']['empleosg']); |
---|
1285 | $relacion = count($arreglo['dg']['relacion']); |
---|
1286 | $objetivosp = count($arreglo['dg']['objetivosp']); |
---|
1287 | if ($sector || $talentoh || $capacidades || $relacion || $objetivosp) { |
---|
1288 | $form['dg'] = array( |
---|
1289 | '#type' => 'fieldset', |
---|
1290 | '#title' => t('Datos Generales'), |
---|
1291 | ); |
---|
1292 | } |
---|
1293 | //Clasificación Sectorial |
---|
1294 | if ($sector) { |
---|
1295 | $form['dg']['sector'] = array( |
---|
1296 | '#type' => 'checkboxes', |
---|
1297 | '#options' => $arreglo['dg']['sector'], |
---|
1298 | '#default_value' => array(), |
---|
1299 | '#title' => t('Clasificación Sectorial'), |
---|
1300 | '#multiple' => TRUE, |
---|
1301 | ); |
---|
1302 | } |
---|
1303 | //Talento Humano |
---|
1304 | if ($talentoh) { |
---|
1305 | $form['dg']['talentoh'] = array( |
---|
1306 | '#type' => 'checkboxes', |
---|
1307 | '#options' => $arreglo['dg']['talentoh'], |
---|
1308 | '#default_value' => array(), |
---|
1309 | '#title' => t('Talento Humano'), |
---|
1310 | '#multiple' => TRUE, |
---|
1311 | ); |
---|
1312 | } |
---|
1313 | //Capacidades |
---|
1314 | if ($capacidades) { |
---|
1315 | $arreglo['dg']['empleosg']['proyectos_operativos_beneficiarios'] = 'proyectos_operativos_beneficiarios'; |
---|
1316 | $form['dg']['capacidades'] = array( |
---|
1317 | '#type' => 'checkboxes', |
---|
1318 | '#options' => $arreglo['dg']['capacidades'], |
---|
1319 | '#default_value' => array(), |
---|
1320 | '#title' => t('Capacidades'), |
---|
1321 | '#multiple' => TRUE, |
---|
1322 | ); |
---|
1323 | } |
---|
1324 | //Beneficiarios |
---|
1325 | if ($beneficiarios) { |
---|
1326 | $arreglo['dg']['empleosg']['proyectos_operativos_beneficiarios'] = t('Benefiarios (Completo)'); |
---|
1327 | $form['dg']['empleosg'] = array( |
---|
1328 | '#type' => 'checkboxes', |
---|
1329 | '#options' => $arreglo['dg']['empleosg'], |
---|
1330 | '#default_value' => array(), |
---|
1331 | '#title' => t('Beneficiarios'), |
---|
1332 | '#multiple' => TRUE, |
---|
1333 | ); |
---|
1334 | } |
---|
1335 | //Instituciones |
---|
1336 | if ($relacion) { |
---|
1337 | $form['dg']['relacion'] = array( |
---|
1338 | '#type' => 'checkboxes', |
---|
1339 | '#options' => $arreglo['dg']['relacion'], |
---|
1340 | '#default_value' => array(), |
---|
1341 | '#title' => t('Instituciones'), |
---|
1342 | '#multiple' => TRUE, |
---|
1343 | ); |
---|
1344 | } |
---|
1345 | //Objetivos del Proyecto |
---|
1346 | if ($objetivosp) { |
---|
1347 | $form['dg']['objetivosp'] = array( |
---|
1348 | '#type' => 'checkboxes', |
---|
1349 | '#options' => $arreglo['dg']['objetivosp'], |
---|
1350 | '#default_value' => array(), |
---|
1351 | '#title' => t('Objetivos del Proyecto'), |
---|
1352 | '#multiple' => TRUE, |
---|
1353 | ); |
---|
1354 | } |
---|
1355 | //INDICADORES DEL PROYECTO |
---|
1356 | $enunciadop = count($arreglo['ip']['enunciadop']); |
---|
1357 | $justificacion = count($arreglo['ip']['justificacion']); |
---|
1358 | $alcance = count($arreglo['ip']['alcance']); |
---|
1359 | $situaciona = count($arreglo['ip']['situaciona']); |
---|
1360 | $situaciono = count($arreglo['ip']['situaciono']); |
---|
1361 | $resultadop = count($arreglo['ip']['resultadop']); |
---|
1362 | if ($enunciadop || $justificacion || $alcance || $situaciona || $situaciono || $resultadop) { |
---|
1363 | $form['ip'] = array( |
---|
1364 | '#type' => 'fieldset', |
---|
1365 | '#title' => t('Indicadores del Proyecto'), |
---|
1366 | ); |
---|
1367 | } |
---|
1368 | //Enunciado del Problema |
---|
1369 | if ($enunciadop) { |
---|
1370 | $form['ip']['enunciadop'] = array( |
---|
1371 | '#type' => 'checkboxes', |
---|
1372 | '#options' => $arreglo['ip']['enunciadop'], |
---|
1373 | '#default_value' => array(), |
---|
1374 | '#title' => t('Enunciado del Problema'), |
---|
1375 | '#multiple' => TRUE, |
---|
1376 | ); |
---|
1377 | } |
---|
1378 | //Justificación del Proyecto |
---|
1379 | if ($justificacion) { |
---|
1380 | $form['ip']['justificacion'] = array( |
---|
1381 | '#type' => 'checkboxes', |
---|
1382 | '#options' => $arreglo['ip']['justificacion'], |
---|
1383 | '#default_value' => array(), |
---|
1384 | '#title' => t('Justificación del Proyecto'), |
---|
1385 | '#multiple' => TRUE, |
---|
1386 | ); |
---|
1387 | } |
---|
1388 | //Alcance del Proyecto |
---|
1389 | if ($alcance) { |
---|
1390 | $form['ip']['alcance'] = array( |
---|
1391 | '#type' => 'checkboxes', |
---|
1392 | '#options' => $arreglo['ip']['alcance'], |
---|
1393 | '#default_value' => array(), |
---|
1394 | '#title' => t('Alcance del Proyecto'), |
---|
1395 | '#multiple' => TRUE, |
---|
1396 | ); |
---|
1397 | } |
---|
1398 | //Situación Actual del Proyecto |
---|
1399 | if ($situaciona) { |
---|
1400 | $form['ip']['situaciona'] = array( |
---|
1401 | '#type' => 'checkboxes', |
---|
1402 | '#options' => $arreglo['ip']['situaciona'], |
---|
1403 | '#default_value' => array(), |
---|
1404 | '#title' => t('Situación Actual del Proyecto'), |
---|
1405 | '#multiple' => TRUE, |
---|
1406 | ); |
---|
1407 | } |
---|
1408 | //Situación Objetivo |
---|
1409 | if ($situaciono) { |
---|
1410 | $form['ip']['situaciono'] = array( |
---|
1411 | '#type' => 'checkboxes', |
---|
1412 | '#options' => $arreglo['ip']['situaciono'], |
---|
1413 | '#default_value' => array(), |
---|
1414 | '#title' => t('Situación Objetivo'), |
---|
1415 | '#multiple' => TRUE, |
---|
1416 | ); |
---|
1417 | } |
---|
1418 | //Indicador del resultado del Proyecto |
---|
1419 | if ($resultadop) { |
---|
1420 | $form['ip']['resultadop'] = array( |
---|
1421 | '#type' => 'checkboxes', |
---|
1422 | '#options' => $arreglo['ip']['resultadop'], |
---|
1423 | '#default_value' => array(), |
---|
1424 | '#title' => t('Indicador del resultado del Proyecto'), |
---|
1425 | '#multiple' => TRUE, |
---|
1426 | ); |
---|
1427 | } |
---|
1428 | //Acciones especificas |
---|
1429 | $form['ae'] = array( |
---|
1430 | '#type' => 'fieldset', |
---|
1431 | '#title' => t('Acciones EspecÃficas'), |
---|
1432 | ); |
---|
1433 | $arreglo['ae']['field_proyecto_accion_esp'] = t('Acciones EspecÃficas'); |
---|
1434 | //Indicador del resultado del Proyecto |
---|
1435 | $form['ae']['accionesesp'] = array( |
---|
1436 | '#type' => 'checkboxes', |
---|
1437 | '#options' => $arreglo['ae'], |
---|
1438 | '#default_value' => array(), |
---|
1439 | '#title' => t('Acciones EspecÃficas'), |
---|
1440 | '#multiple' => TRUE, |
---|
1441 | '#weight' => 99, |
---|
1442 | ); |
---|
1443 | $title_combos['accionesesp']['title'] = t('Acciones EspecÃficas'); |
---|
1444 | //otros |
---|
1445 | $form['otros'] = array( |
---|
1446 | '#type' => 'fieldset', |
---|
1447 | '#title' => t('Otros'), |
---|
1448 | ); |
---|
1449 | $arreglo['otros']['proyectos_operativos_flujo'] = t('Flujo de Trabajo'); |
---|
1450 | //Indicador del resultado del Proyecto |
---|
1451 | $form['otros']['fl'] = array( |
---|
1452 | '#type' => 'checkboxes', |
---|
1453 | '#options' => $arreglo['otros'], |
---|
1454 | '#default_value' => array(), |
---|
1455 | '#title' => t('Flujo de Trabajo'), |
---|
1456 | '#multiple' => TRUE, |
---|
1457 | '#weight' => 99, |
---|
1458 | ); |
---|
1459 | $title_combos['fl']['title'] = t('Flujo de Trabajo'); |
---|
1460 | //REFORMULACION DEL PROYECTO |
---|
1461 | $arreglo['proyectos_reformulacion']['reformulacion'] = array( |
---|
1462 | 'proyectos_operativos_monto_anual_reformulado' => t('Monto Total del Proyecto para el año en curso (Reformulado)'), |
---|
1463 | 'proyectos_operativos_monto_total_reformulado' => t('Monto Total del Proyecto (Reformulado)'), |
---|
1464 | 'proyectos_operativos_unidad_medida_reformulado' => t('Unidad de Medida (Reformulado)'), |
---|
1465 | 'proyectos_operativos_meta_fisica_reformulado' => t('Meta FÃsica del proyecto (Reformulado)'), |
---|
1466 | ); |
---|
1467 | $form['proyectos_reformulacion'] = array( |
---|
1468 | '#type' => 'fieldset', |
---|
1469 | '#title' => t('Reformulación del Proyecto'), |
---|
1470 | '#weight' => 1, |
---|
1471 | ); |
---|
1472 | //Clasificación Sectorial |
---|
1473 | $form['proyectos_reformulacion']['reformulacion'] = array( |
---|
1474 | '#type' => 'checkboxes', |
---|
1475 | '#options' => $arreglo['proyectos_reformulacion']['reformulacion'], |
---|
1476 | '#default_value' => array(), |
---|
1477 | '#title' => t('Reformulación del Proyecto'), |
---|
1478 | '#multiple' => TRUE, |
---|
1479 | ); |
---|
1480 | $form['#title_combos']['reformulacion']['title'] = t('Reformulación del Proyecto'); |
---|
1481 | $form['#title_combos'] = $title_combos; |
---|
1482 | return $form; |
---|
1483 | } |
---|