source: sipes/0.3-modules/proyectos_operativos/proyectos_operativos.admin.inc @ 2db5c18

stableversion-3.0
Last change on this file since 2db5c18 was a0cf94c, checked in by eramirez <eramirez@…>, 8 años ago

se modifico el modulo de proyectos operativos

  • Propiedad mode establecida a 100755
File size: 13.7 KB
Línea 
1<?php
2
3  /**
4  * Sistema Integral de Planificación y Presupuesto (SIPP)
5  * @file proyectos_operativos.admin.inc
6  * Drupal part Module to Sistema Integral de Planificación y Presupuesto (SIPP)
7  * Copyright 2013 Sistema Automatizado para la Planificación Estratégico-Situacional en la Administración Pública Venezolana (CENDITEL)
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
22  *
23  * @author Cenditel Merida - Msc. Juan Vizcarrondo
24  * @date 2013-02-02 // (a&#241;o-mes-dia)
25  * @date 2013-08-27 // (a&#241;o-mes-dia)
26  * @version 0.1 // (0.1)
27  *
28  */
29
30/**
31 * Implementation of proyectos_operativos_admin_settings().
32 * COnfigurar proyectos operativos.
33 */
34function proyectos_operativos_admin_settings() {
35  $ftypes = array(
36    0 => t('Seleccione'),
37    '1' => t('January'),
38    '2' => t('February'),
39    '3' => t('March'),
40    '4' => t('April'),
41    '5' => t('May'),
42    '6' => t('June'),
43    '7' => t('July'),
44    '8' => t('August'),
45    '9' => t('September'),
46    '10' => t('Octuber'),
47    '11' => t('November'),
48    '12' => t('December'),
49  );
50  $node_type = content_types('proyectos_operativos');
51  $fields = $node_type['fields'];
52
53  $current_year = date("Y");
54  if (!variable_get('proyectos_operativos_anho_creacion', 0)) {
55  $years[0] = t('Seleccione');
56  }
57  for($i = $current_year - 10; $i <= $current_year; $i++) {
58    $years[$i] = $i;
59  }
60  $form = array();
61  $form['days'] = array(
62    '#type' => 'fieldset',
63    '#title' => t('Fechas'),
64    '#collapsible' => TRUE,
65    '#collapsed' => FALSE,
66  );
67  $form['days']['proyectos_operativos_anho_creacion'] = array(
68    '#title' => t('Gestionar los proyectos operativos para el año'),
69    '#type' => 'select',
70    '#default_value' => variable_get('proyectos_operativos_anho_creacion', 0),
71    '#options' => $years,
72  );
73  $form['days']['proyectos_operativos_reformulacion_meses'] = array(
74    '#type' => 'checkbox',
75    '#title' => t('No Restringir agregar reformulación en los meses fuera de la fecha del proyecto.'),
76    '#default_value' => variable_get('proyectos_operativos_reformulacion_meses', TRUE),
77  );
78  $form['basicos'] = array(
79    '#type' => 'fieldset',
80    '#title' => t('Recolectar información en Datos Básicos del Proyecto Operativo'),
81    '#collapsible' => TRUE,
82    '#collapsed' => FALSE,
83  );
84  $vid = $fields['field_proyecto_plurianual']['vid'];
85  $tree = taxonomy_get_tree($vid);
86  $option_plurianual = array();
87  if ($tree) {
88    foreach ($tree as $term) {
89      $choice = new stdClass();
90      $choice->option = array($term->tid => str_repeat('-', $term->depth) . $term->name);
91      $option_plurianual[] = $choice;
92    }
93  }
94  $form['basicos']['proyectos_operativos_plurianual'] = array(
95    '#type' => 'select',
96    '#options' => $option_plurianual,
97    '#default_value' => variable_get('proyectos_operativos_plurianual', 0),
98    '#title' => t('Proyecto Plurianual'),
99    '#description' => t('Seleccione la opción de cuando un proyecto es considerado plurianual'),
100  );
101
102  $form['basicos']['proyectos_operativos_muestra_pndes'] = array(
103    '#type' => 'checkbox',
104    '#title' => t('Recolectar PNDES.'),
105    '#default_value' => variable_get('proyectos_operativos_muestra_pndes', TRUE),
106  );
107  $form['basicos']['proyectos_operativos_muestra_mcti'] = array(
108    '#type' => 'checkbox',
109    '#title' => t('Recolectar Directriz MCTI.'),
110    '#default_value' => variable_get('proyectos_operativos_muestra_mcti', TRUE),
111  );
112  $form['basicos']['responsables'] = array(
113    '#title' => t('Responsables del proyecto'),
114    '#type' => 'fieldset',
115  );
116  $form['basicos']['responsables']['proyectos_operativos_muestra_gerentes'] = array(
117    '#type' => 'checkbox',
118    '#title' => t('Gerente del Proyecto'),
119    '#default_value' => variable_get('proyectos_operativos_muestra_gerentes', TRUE),
120  );
121  $form['generales'] = array(
122    '#type' => 'fieldset',
123    '#title' => t('Recolectar información en Datos Generales del Proyecto Operativo'),
124    '#collapsible' => TRUE,
125    '#collapsed' => FALSE,
126  );
127  $form['generales']['proyectos_operativos_muestra_talento'] = array(
128    '#type' => 'checkbox',
129    '#title' => t('Recolectar Talento humano.'),
130    '#default_value' => variable_get('proyectos_operativos_muestra_talento', TRUE),
131  );
132  $form['generales']['proyectos_operativos_muestra_capacidades'] = array(
133    '#type' => 'checkbox',
134    '#title' => t('Recolectar Capacidades.'),
135    '#default_value' => variable_get('proyectos_operativos_muestra_capacidades', TRUE),
136  );
137  $form['generales']['proyectos_operativos_muestra_beneficiario'] = array(
138    '#type' => 'checkbox',
139    '#title' => t('Recolectar Beneficiarios.'),
140    '#default_value' => variable_get('proyectos_operativos_muestra_beneficiario', TRUE),
141  );
142  $form['generales']['proyectos_operativos_muestra_beneficiarios_indirectos'] = array(
143    '#type' => 'checkbox',
144    '#title' => t('Recolectar Beneficiarios indirectos.'),
145    '#default_value' => variable_get('proyectos_operativos_muestra_beneficiarios_indirectos', TRUE),
146  );
147  $form['indicadores'] = array(
148    '#type' => 'fieldset',
149    '#title' => t('Recolectar información en Indicadores del Proyecto'),
150    '#collapsible' => TRUE,
151    '#collapsed' => FALSE,
152  );
153  $form['indicadores']['proyectos_operativos_muestra_enunciado_problema'] = array(
154    '#type' => 'checkbox',
155    '#title' => t('Recolectar Enunciado del problema.'),
156    '#default_value' => variable_get('proyectos_operativos_muestra_enunciado_problema', TRUE),
157  );
158  $form['indicadores']['proyectos_operativos_muestra_justicacion'] = array(
159    '#type' => 'checkbox',
160    '#title' => t('Recolectar Justificación.'),
161    '#default_value' => variable_get('proyectos_operativos_muestra_justicacion', TRUE),
162  );
163  $form['indicadores']['proyectos_operativos_muestra_alcance'] = array(
164    '#type' => 'checkbox',
165    '#title' => t('Recolectar Alcance.'),
166    '#default_value' => variable_get('proyectos_operativos_muestra_alcance', TRUE),
167  );
168  $form['indicadores']['proyectos_operativos_muestra_sa'] = array(
169    '#type' => 'checkbox',
170    '#title' => t('Recolectar Situación Actual.'),
171    '#default_value' => variable_get('proyectos_operativos_muestra_sa', TRUE),
172  );
173  $form['indicadores']['proyectos_operativos_muestra_sa_cuantificacion'] = array(
174    '#type' => 'checkbox',
175    '#title' => t('Recolectar Cuantificación en Situación Actual.'),
176    '#default_value' => variable_get('proyectos_operativos_muestra_sa_cuantificacion', TRUE),
177  );
178  $form['indicadores']['proyectos_operativos_muestra_so'] = array(
179    '#type' => 'checkbox',
180    '#title' => t('Recolectar Situación Objetivo.'),
181    '#default_value' => variable_get('proyectos_operativos_muestra_so', TRUE),
182  );
183  $vid = $fields['field_proyecto_unidadm']['vid'];
184  $tree = taxonomy_get_tree($vid);
185  $option_unidadm = array();
186  if ($tree) {
187    foreach ($tree as $term) {
188      $choice = new stdClass();
189      $choice->option = array($term->tid => str_repeat('-', $term->depth) . $term->name);
190      $option_unidadm[] = $choice;
191    }
192  }
193  $form['indicadores']['proyectos_operativos_allow_unidpersona'] = array(
194    '#type' => 'select',
195    '#options' => $option_unidadm,
196    '#default_value' => variable_get('proyectos_operativos_allow_unidpersona', array()),
197    '#title' => t('Campos de las unidades de medida que deben relacionarse con personas'),
198    '#multiple' => TRUE,
199  );
200  $form['format_number'] = array(
201    '#type' => 'fieldset',
202    '#title' => t('Formato Númerico'),
203    '#collapsible' => TRUE,
204    '#collapsed' => FALSE,
205  );
206  $form['format_number']['proyectos_operativos_number_demostracion'] = array(
207    '#value' => '<b>' . t('Convertir número @numero en @numero_conversion', array('@numero' => '4123123.23', '@numero_conversion' => number_format(4123123.23, variable_get('proyectos_operativos_number_decimals', 0), variable_get('proyectos_operativos_number_dec_point', ','), variable_get('proyectos_operativos_number_thousands_sep', '.')))) . '</b>',
208    '#weight' => -10,
209
210  );
211  $form['format_number']['proyectos_operativos_number_decimals'] = array(
212    '#type' => 'textfield',
213    '#title' => t('Cantidad de Decimales.'),
214    '#required' => TRUE,
215    '#weight' => -9,
216    '#default_value' => variable_get('proyectos_operativos_number_decimals', 0),
217  );
218  $form['format_number']['proyectos_operativos_number_dec_point'] = array(
219    '#type' => 'textfield',
220    '#title' => t('Separador Decimal.'),
221    '#required' => TRUE,
222    '#weight' => -9,
223    '#default_value' => variable_get('proyectos_operativos_number_dec_point', ','),
224  );
225  $form['format_number']['proyectos_operativos_number_thousands_sep'] = array(
226    '#type' => 'textfield',
227    '#title' => t('Separador de Miles.'),
228    '#required' => TRUE,
229    '#weight' => -9,
230    '#default_value' => variable_get('proyectos_operativos_number_thousands_sep', '.'),
231  );
232
233  return system_settings_form($form);
234}
235
236
237
238/**
239 * Implementation of proyectos_operativos_admin_settings().
240 * COnfigurar proyectos operativos.
241 */
242function proyectos_operativos_admin_workflow_settings() {
243  if (module_exists('workflow')) {
244    $wid = workflow_get_workflow_for_type('proyectos_operativos');
245    if ($wid){
246      $states = workflow_get_states($wid);
247      $rids = user_roles();
248      $rids['-1'] = t('author');
249      if (count($states)) {
250        $form['workflow'] = array(
251          '#type' => 'fieldset',
252          '#title' => t('Workflow'),
253          '#collapsible' => TRUE,
254          '#collapsed' => FALSE,
255        );
256        foreach ($states as $sid => $state) {
257          $form['workflow']['proyectos_operativos_state_m_' . $sid] = array(
258            '#type' => 'checkboxes',
259            '#options' => $rids,
260            '#default_value' => variable_get('proyectos_operativos_state_m_' . $sid, array()),
261            '#title' => t('Roles que pueden editar los Proyectos Operativos'),
262            '#multiple' => TRUE,
263            '#prefix' => '<table width="100%" style="border: 0;"><tbody style="border: 0;"><tr><th colspan="3">' . t('State: @state', array('@state' => $state)) . '</th></tr><tr><td>',
264            '#suffix' => "</td></tr></tbody></table>",
265          );
266        }
267        $form['seguimiento']['proyectos_operativos_state_aprobado'] = array(
268          '#type' => 'select',
269          '#title' => t('Estado aprobado'),
270          '#default_value' => variable_get('proyectos_operativos_state_aprobado', NULL),
271          '#options' => $states,
272            '#prefix' => '<table width="100%" style="border: 0;"><tbody style="border: 0;"><tr><td>',
273        );
274        $form['seguimiento']['proyectos_operativos_state_naprobado'] = array(
275          '#type' => 'select',
276          '#title' => t('Estado no aprobado'),
277          '#default_value' => variable_get('proyectos_operativos_state_naprobado', NULL),
278          '#options' => $states,
279            '#prefix' => "</td><td>",
280            '#suffix' => "</td></tr></tbody></table>",
281        );
282      }
283      $form['workflow']['devueltos'] = array(
284        '#type' => 'fieldset',
285        '#title' => t('Estados Devueltos'),
286        '#collapsible' => TRUE,
287        '#collapsed' => FALSE,
288      );
289      $i = 0;
290      $first_state = _workflow_creation_state($wid);
291      $prefijo = '<table width="100%" style="border: 0;"><tbody style="border: 0;"><tr>';
292      $prefijo .= '<th>' . t('De / A') . '&nbsp;→</th>';
293      foreach ($states as $sid => $state) {
294        if ($sid != $first_state) {
295          $prefijo .= '<th>' . $state . '</th>';
296        }
297      }
298      $prefijo .= '</tr>';
299      foreach ($states as $sid => $state) {
300        $prefijo .= '<tr>';
301        $prefijo .= '<td>' . check_plain($state) . '</td>';
302        foreach ($states as $sid1 => $state1) {
303          if ($sid1 != $first_state) {
304            $form['workflow']['devueltos']['proyectos_operativos_state_d_' . $sid . '_' . $sid1] = array(
305              '#type' => 'checkbox',
306              '#title' => check_plain($state1),
307              '#default_value' => variable_get('proyectos_operativos_state_d_' . $sid . '_' . $sid1, FALSE),
308              '#prefix' => $prefijo . '<td>',
309              '#suffix' => "</td>",
310            );
311            $prefijo = '';
312          }
313        }
314        $form['workflow']['devueltos']['proyectos_operativos_state_d_' . $sid . '_' . $sid1]['#suffix'] .= '</tr>';
315      }
316      $form['workflow']['devueltos']['proyectos_operativos_state_d_' . $sid . '_' . $sid1]['#suffix'] .= '</table>';
317      $form['workflow']['devueltos']['proyectos_operativos_state_tdevueltos'] = array(
318        '#type' => 'textfield',
319        '#title' => t('Texto que antecede a los estados devueltos.'),
320        '#required' => TRUE,
321        '#default_value' => variable_get('proyectos_operativos_state_tdevueltos', 'Devuelto a @state'),
322        '#description' => t('Añada la etiqueta @state para indicar donde debe aparecer la palabra del estado.'),
323      );
324      $form['workflow']['devueltos']['proyectos_operativos_state_tndevueltos'] = array(
325        '#type' => 'textfield',
326        '#title' => t('Texto que antecede a los estados no devueltos.'),
327        '#required' => TRUE,
328        '#default_value' => variable_get('proyectos_operativos_state_tndevueltos', 'Enviado a @state'),
329        '#description' => t('Añada la etiqueta @state para indicar donde debe aparecer la palabra del estado.'),
330      );
331    }
332  }
333  return system_settings_form($form);
334}
335
336
Nota: Vea TracBrowser para ayuda de uso del navegador del repositorio.