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ñ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 | |
---|
34 | function aem_eliminar_microinforme_page($reg_microinforme = NULL){ |
---|
35 | |
---|
36 | if($reg_microinforme != NULL){ |
---|
37 | $output .= drupal_get_form('formulario_eliminar_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_eliminar_microinforme_form(). |
---|
50 | */ |
---|
51 | function formulario_eliminar_microinforme_form($form_state, $reg_microinforme = NULL) { |
---|
52 | |
---|
53 | $form = array(); |
---|
54 | |
---|
55 | $form['#reg_microinforme'] = $reg_microinforme; |
---|
56 | |
---|
57 | $anno_seleccionado_para_reporte = $reg_microinforme['anho']; |
---|
58 | $nombre_estrategia = taxonomy_get_term($reg_microinforme['id_area_estrategica'])->name; |
---|
59 | $descripcion_confirmacion = t('Confirmación para eliminar Microinforme de la Estratégia <i>'.$nombre_estrategia.'</i> en el año <i>'.$anno_seleccionado_para_reporte.'</i>'); |
---|
60 | |
---|
61 | $form['confirmacion_eliminar'] = array( |
---|
62 | '#type' => 'radios', |
---|
63 | '#title' => t('¿Está seguro(a) que desea eliminar este microinforme?'), |
---|
64 | '#default_value' => 2, |
---|
65 | '#options' => array(1 => t('Si'), 2 => t('No')), |
---|
66 | '#description' => $descripcion_confirmacion, |
---|
67 | ); |
---|
68 | |
---|
69 | drupal_set_title(t('Confirmación para eliminar Microinforme')); |
---|
70 | |
---|
71 | //boton de enviar consulta |
---|
72 | $form['buttons'] = array( |
---|
73 | '#prefix' => '<div class="container-inline">', |
---|
74 | '#suffix' => '</div>', |
---|
75 | ); |
---|
76 | $nombre_boton = t('Aceptar'); |
---|
77 | $form['buttons']['submit'] = array( |
---|
78 | '#type' => 'submit', |
---|
79 | '#value' => $nombre_boton, |
---|
80 | ); |
---|
81 | if(!$primerformulario){ |
---|
82 | $form['buttons']['submit_cancelar'] = array( |
---|
83 | '#type' => 'submit', |
---|
84 | '#value' => 'Cancelar', |
---|
85 | ); |
---|
86 | } |
---|
87 | |
---|
88 | return $form; |
---|
89 | } |
---|
90 | |
---|
91 | /** |
---|
92 | * Implementation of formulario_eliminar_microinforme_form_submit(). |
---|
93 | */ |
---|
94 | function formulario_eliminar_microinforme_form_submit($form, &$form_state) { |
---|
95 | |
---|
96 | if($form_state['clicked_button']['#value'] == $form_state['values']['submit']){//if button 1 is clicked |
---|
97 | |
---|
98 | if($form_state['values']['confirmacion_eliminar'] == 1){//eliminar |
---|
99 | |
---|
100 | $exe_query = db_query("DELETE FROM {microinformes_area_estrategica_mcti} WHERE id_microinforme = %d", $form['#reg_microinforme']['id_microinforme']); |
---|
101 | drupal_set_message(t('Se ha eliminado el microInforme con éxito!')); |
---|
102 | $form_state['redirect'] = 'reportes_sipp/areas_estrategicas_ministerio/mi/lista_microinformes'; |
---|
103 | |
---|
104 | }else{ |
---|
105 | $form_state['redirect'] = 'reportes_sipp/areas_estrategicas_ministerio/mi/lista_microinformes'; |
---|
106 | } |
---|
107 | |
---|
108 | }elseif($form_state['clicked_button']['#value'] == $form_state['values']['submit_cancelar']){ //if button 2 is clicked |
---|
109 | |
---|
110 | $form_state['redirect'] = 'reportes_sipp/areas_estrategicas_ministerio/mi/lista_microinformes'; |
---|
111 | |
---|
112 | } |
---|
113 | } |
---|