source: sipes/0.3-modules/reportes_sipp/includes/aem/aem_formulario_editar_microinforme.forms.inc @ eb502b4

stableversion-3.0
Last change on this file since eb502b4 was 303fae2, checked in by José Gregorio Puentes <jpuentes@…>, 9 años ago

se agregaron los modulos

  • Propiedad mode establecida a 100755
File size: 5.1 KB
Línea 
1<?php
2  /**
3  * Sistema Integral de Planificación y Presupuesto (SIPP)
4  * @file reportes_sipp.module
5  * Drupal part Module to Sistema Integral de Planificación y Presupuesto (SIPP)
6  * Copyright 2013 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 Uzcátegui (diego.uzc [at] gmail [dot] com)
23  * @date 2013-05-01 // (a&#241;o-mes-dia)
24  * @version 0.1 // (0.1)
25  *
26  */
27
28/*
29 * Pagina que muestra el áreas estratégicas del ministerio
30 * Implementado por: Ing. Diego Uzcátegui,
31 * Inicio de codificación: 30-05-13
32 */
33
34function aem_editar_microinforme_page($reg_microinforme = NULL){
35
36  if($reg_microinforme != NULL){
37    $output .= drupal_get_form('formulario_modificar_microinforme_form', $reg_microinforme);
38  }else{
39    $output .= '<h5>No encontrado</h5>';
40  }
41 
42  return $output;
43 
44}
45
46//************************************************************************************************
47
48/**
49 * Implementation of formulario_modificar_microinforme_form().
50 */
51function formulario_modificar_microinforme_form($form_state, $reg_microinforme = NULL) {
52 
53  $form = array();
54 
55  $form['#reg_microinforme'] = $reg_microinforme;
56 
57  $annos = array();
58  $annos[] = $reg_microinforme['anho'];
59  $form['anno_seleccionado_para_reporte'] = array(
60    '#title' => t('Año'),
61    '#type' => 'select',
62    '#default_value' => $reg_microinforme['anho'],
63    '#options' => $annos,
64    '#disabled' => true,
65  );
66
67  //areas estratégicas del ministerio
68  $areas = array();
69  $nombre_estrategia = taxonomy_get_term($reg_microinforme['id_area_estrategica'])->name;
70  $areas[] = $nombre_estrategia;
71  $form['area_seleccionada_para_reporte'] = array(
72    '#title' => t('Área Estratégica del Ministerio'),
73    '#type' => 'select',
74    '#default_value' => $nombre_estrategia,
75    '#options' => $areas,
76    '#disabled' => true,
77  );
78 
79  drupal_set_title(t('Microinforme para la Estratégia <i>'.$nombre_estrategia.'</i> en el año <i>'.$anno_seleccionado_para_reporte.'</i>'));
80   
81    $form['informacion_textual'] = array(
82      '#type' => 'textarea',
83      '#title' => t('Información Textual para Microinforme'),
84      '#default_value' => $reg_microinforme['informacion_textual'],
85    );
86 
87
88    module_load_include('inc', 'reportes_sipp' , 'includes/aem/funciones_tablas_graficas.pages');
89   
90    $datos_cargados = unserialize($reg_microinforme['datos_graficas_y_tablas']);
91    $contenidohtml .= generar_grafica_producciontrimestres($datos_cargados['datos_anho_actual'], $datos_cargados['param']);
92    $contenidohtml .= generar_tabla_produccion_trimestres($datos_cargados['datos_anho_actual'], $datos_cargados['param']);
93    $contenidohtml .= generar_grafica_historicos($datos_cargados);
94    $contenidohtml .= '<br><br>';
95   
96    $form['#datos_cargados'] = serialize($datos_cargados);
97   
98    $form['contenidohtml_tablas_graficos'] = array(
99      '#value' => $contenidohtml,
100    );
101   
102   
103  //boton de enviar consulta
104  $form['buttons'] = array(
105    '#prefix' => '<div class="container-inline">',
106    '#suffix' => '</div>',
107  );
108  $nombre_boton = t('Guardar');
109  $form['buttons']['submit'] = array(
110    '#type' => 'submit',
111    '#value' => $nombre_boton,
112  );
113  if(!$primerformulario){
114    $form['buttons']['submit_reiniciar'] = array(
115      '#type' => 'submit',
116      '#value' => 'Cancelar',
117    );
118  }
119   
120  return $form;
121}
122
123/**
124 * Implementation of formulario_modificar_microinforme_form_submit().
125 */
126function formulario_modificar_microinforme_form_submit($form, &$form_state) {
127 
128  if($form_state['clicked_button']['#value'] == $form_state['values']['submit']){//if button 1 is clicked
129 
130      //actualizar
131      $informacion_textual = check_plain($form_state['values']['informacion_textual']);
132      $exe_query = db_query("UPDATE {microinformes_area_estrategica_mcti} SET informacion_textual = '%s', fecha_ultima_actualizacion = %d WHERE id_microinforme = %d", $informacion_textual, time(), $form['#reg_microinforme']['id_microinforme']);
133      drupal_set_message(t('Se ha actualizado el microInforme con éxito!'));
134      $form_state['redirect'] = 'reportes_sipp/areas_estrategicas_ministerio/mi/lista_microinformes';
135 
136  }elseif($form_state['clicked_button']['#value'] == $form_state['values']['submit_reiniciar']){  //if button 2 is clicked
137 
138    $form_state['redirect'] = 'reportes_sipp/areas_estrategicas_ministerio/mi/lista_microinformes';
139   
140  }
141}
Nota: Vea TracBrowser para ayuda de uso del navegador del repositorio.