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

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

se agregaron los modulos

  • 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  return system_settings_form($form);
233}
234
235
236
237/**
238 * Implementation of proyectos_operativos_admin_settings().
239 * COnfigurar proyectos operativos.
240 */
241function proyectos_operativos_admin_workflow_settings() {
242  if (module_exists('workflow')) {
243    $wid = workflow_get_workflow_for_type('proyectos_operativos');
244    if ($wid){
245      $states = workflow_get_states($wid);
246      $rids = user_roles();
247      $rids['-1'] = t('author');
248      if (count($states)) {
249        $form['workflow'] = array(
250          '#type' => 'fieldset',
251          '#title' => t('Workflow'),
252          '#collapsible' => TRUE,
253          '#collapsed' => FALSE,
254        );
255        foreach ($states as $sid => $state) {
256          $form['workflow']['proyectos_operativos_state_m_' . $sid] = array(
257            '#type' => 'checkboxes',
258            '#options' => $rids,
259            '#default_value' => variable_get('proyectos_operativos_state_m_' . $sid, array()),
260            '#title' => t('Roles que pueden editar los Proyectos Operativos'),
261            '#multiple' => TRUE,
262            '#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>',
263            '#suffix' => "</td></tr></tbody></table>",
264          );
265        }
266        $form['seguimiento']['proyectos_operativos_state_aprobado'] = array(
267          '#type' => 'select',
268          '#title' => t('Estado aprobado'),
269          '#default_value' => variable_get('proyectos_operativos_state_aprobado', NULL),
270          '#options' => $states,
271            '#prefix' => '<table width="100%" style="border: 0;"><tbody style="border: 0;"><tr><td>',
272        );
273        $form['seguimiento']['proyectos_operativos_state_naprobado'] = array(
274          '#type' => 'select',
275          '#title' => t('Estado no aprobado'),
276          '#default_value' => variable_get('proyectos_operativos_state_naprobado', NULL),
277          '#options' => $states,
278            '#prefix' => "</td><td>",
279            '#suffix' => "</td></tr></tbody></table>",
280        );
281      }
282      $form['workflow']['devueltos'] = array(
283        '#type' => 'fieldset',
284        '#title' => t('Estados Devueltos'),
285        '#collapsible' => TRUE,
286        '#collapsed' => FALSE,
287      );
288      $i = 0;
289      $first_state = _workflow_creation_state($wid);
290      $prefijo = '<table width="100%" style="border: 0;"><tbody style="border: 0;"><tr>';
291      $prefijo .= '<th>' . t('De / A') . '&nbsp;→</th>';
292      foreach ($states as $sid => $state) {
293        if ($sid != $first_state) {
294          $prefijo .= '<th>' . $state . '</th>';
295        }
296      }
297      $prefijo .= '</tr>';
298      foreach ($states as $sid => $state) {
299        $prefijo .= '<tr>';
300        $prefijo .= '<td>' . check_plain($state) . '</td>';
301        foreach ($states as $sid1 => $state1) {
302          if ($sid1 != $first_state) {
303            $form['workflow']['devueltos']['proyectos_operativos_state_d_' . $sid . '_' . $sid1] = array(
304              '#type' => 'checkbox',
305              '#title' => check_plain($state1),
306              '#default_value' => variable_get('proyectos_operativos_state_d_' . $sid . '_' . $sid1, FALSE),
307              '#prefix' => $prefijo . '<td>',
308              '#suffix' => "</td>",
309            );
310            $prefijo = '';
311          }
312        }
313        $form['workflow']['devueltos']['proyectos_operativos_state_d_' . $sid . '_' . $sid1]['#suffix'] .= '</tr>';
314      }
315      $form['workflow']['devueltos']['proyectos_operativos_state_d_' . $sid . '_' . $sid1]['#suffix'] .= '</table>';
316      $form['workflow']['devueltos']['proyectos_operativos_state_tdevueltos'] = array(
317        '#type' => 'textfield',
318        '#title' => t('Texto que antecede a los estados devueltos.'),
319        '#required' => TRUE,
320        '#default_value' => variable_get('proyectos_operativos_state_tdevueltos', 'Devuelto a @state'),
321        '#description' => t('Añada la etiqueta @state para indicar donde debe aparecer la palabra del estado.'),
322      );
323      $form['workflow']['devueltos']['proyectos_operativos_state_tndevueltos'] = array(
324        '#type' => 'textfield',
325        '#title' => t('Texto que antecede a los estados no devueltos.'),
326        '#required' => TRUE,
327        '#default_value' => variable_get('proyectos_operativos_state_tndevueltos', 'Enviado a @state'),
328        '#description' => t('Añada la etiqueta @state para indicar donde debe aparecer la palabra del estado.'),
329      );
330    }
331  }
332  return system_settings_form($form);
333}
334
335
Nota: Vea TracBrowser para ayuda de uso del navegador del repositorio.