source: sipes/0.3-modules/proyectos_operativos_seguimiento/includes/ae_proyecto/cambiodeestado_seg_ae_proyecto_paginaconfirmacion.forms.inc @ 650248d

stable
Last change on this file since 650248d was 669d26e, checked in by Sipes Apn <root@…>, 7 años ago

se realizaron las correciones relacionadas al contador de fechas

  • Propiedad mode establecida a 100755
File size: 4.0 KB
Línea 
1<?php
2  /**
3  * Sistema Automatizado para la Planificación Estratégico-Situacional en la Administración Pública Venezolana
4  * @file accion_especifica_de_proyecto_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 * Implementation of acciones_centralizadas_seguimiento_wk_tab_page_form()
30 */
31function cambiodeestado_seg_ae_proyecto_paginaconfirmacion_form($form_state, $node, $mes = 0, $state) {
32  $estados = _obtener_estados_seguimiento_mes();
33 
34  $consultaseguimientoactual = _seguimiento_mesactual_partida_ae_deproyecto_load($node, $mes);
35 
36  $form = array();
37  $form['#node'] = $node;
38  $form['#segmes'] = $consultaseguimientoactual['segmes'];
39  $form['#nuevo_estado'] = $state;
40  $form['#estados'] = $estados['states'];
41  $form['#mes'] = $mes;
42  $form['comentario'] = array(
43    '#title' => t('Comentario'),
44    '#type' => 'textarea',
45    '#default_value' => '',
46  );
47 
48  $expr_mach = _nombres_estado_y_transiciones($estados['states'][$state]);
49  if(isset($expr_mach['nombre_corto'])){
50    $message = t('¿Está seguro(a) que desea %accionarealizar?', array('%accionarealizar' => $expr_mach['nombre_largo']));
51    $caption = '<p>'. t('This action cannot be undone.') .'</p>';
52    $return_path = 'node/' . $node->nid . '/seguimiento_aeproyecto';
53    return confirm_form($form, $message, $return_path, $caption, t('Aceptar'));
54  }else{
55    $message = t('¿Está seguro(a) que desea cambiar el seguimiento al estado %nombre_estado?', array('%nombre_estado' => $estados['states'][$state]));
56    $caption = '<p>'. t('This action cannot be undone.') .'</p>';
57    $return_path = 'node/' . $node->nid . '/seguimiento_aeproyecto';
58    return confirm_form($form, $message, $return_path, $caption, t('Cambiar'));
59  }
60}
61
62/**
63 * Implementation of acciones_centralizadas_seguimiento_wk_tab_page_form_submit().
64 * Process funcion delete confirm form.
65 */
66function cambiodeestado_seg_ae_proyecto_paginaconfirmacion_form_submit($form, &$form_state) {
67  global $user;
68 
69  db_query("INSERT INTO {seguimiento_aeproyecto_transiciones_estados} (estado, estado_ant, comentario, date, id_seg, uid) VALUES (%d, %d, '%s', %d, %d, %d)", $form['#nuevo_estado'], $form['#segmes']['estado'], check_plain($form_state['values']['comentario']), time(), $form['#segmes']['id_seg'], $user->uid);
70 
71  $ultima_id_transicion_seg = db_query("SELECT max(a.id_seg_transicion_estado) AS id FROM {seguimiento_aeproyecto_transiciones_estados} AS a WHERE a.id_seg = %d", $form['#segmes']['id_seg']);
72  $seg_transicion_estado = db_fetch_object($ultima_id_transicion_seg);
73 
74  db_query('UPDATE {seguimiento_aeproyecto} SET estado = %d, id_seg_transicion_estado = %d WHERE id_seg = %d', $form['#nuevo_estado'], $seg_transicion_estado->id, $form['#segmes']['id_seg']);
75 
76  drupal_set_message(t('El seguimiento fue cambiado al estado @nombre_estado', array('@nombre_estado' => $form['#estados'][$form['#nuevo_estado']])));
77  $form_state['redirect'] = 'node/' . $form['#node']->field_accion_esp_proyecto[0]['nid'] . '/fase_de_seguimiento_proyecto_y_aes/mes/'.$form['#mes'];
78 
79}
Nota: Vea TracBrowser para ayuda de uso del navegador del repositorio.