source: sipes/0.3-modules/proyectos_operativos/proyectos_operativos.admin.inc @ 94c9dfd

stable
Last change on this file since 94c9dfd was 94c9dfd, checked in by joseft40 <joseft40@…>, 23 meses ago

fix - ajuste en los campos causas, alcance y justificacion

  • Propiedad mode establecida a 100755
File size: 15.3 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 + 10; $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_anho_edit'] = array(
74    '#title' => t('Permitir editar los proyectos operativos para los años'),
75    '#type' => 'select',
76    '#default_value' => variable_get('proyectos_operativos_anho_edit', array()),
77    '#options' => $years,
78    '#multiple' => TRUE,
79  );
80  $form['days']['proyectos_operativos_perm_nuevos'] = array(
81    '#type' => 'checkbox',
82    '#title' => t('Permitir agregar nuevos proyectos.'),
83    '#default_value' => variable_get('proyectos_operativos_perm_nuevos', TRUE),
84  );
85
86  $entes = obtener_ente_planificador();
87  $form['days']['proyectos_operativos_add_entes'] = array(
88    '#title' => t('Solo permitir agregar proyectos a estos entes'),
89    '#type' => 'select',
90    '#default_value' => variable_get('proyectos_operativos_add_entes', array()),
91    '#options' => $entes,
92    '#multiple' => 'TRUE',
93  );
94
95  $form['days']['proyectos_operativos_perm_edit'] = array(
96    '#type' => 'checkbox',
97    '#title' => t('Permitir editar proyectos.'),
98    '#default_value' => variable_get('proyectos_operativos_perm_edit', TRUE),
99  );
100
101  $form['days']['proyectos_operativos_updt_entes'] = array(
102    '#title' => t('Solo permitir modificar proyectos a estos entes'),
103    '#type' => 'select',
104    '#default_value' => variable_get('proyectos_operativos_updt_entes', array()),
105    '#options' => $entes,
106    '#multiple' => 'TRUE',
107  );
108
109
110  $form['days']['proyectos_operativos_reformulacion_meses'] = array(
111    '#type' => 'checkbox',
112    '#title' => t('No Restringir agregar reformulación en los meses fuera de la fecha del proyecto.'),
113    '#default_value' => variable_get('proyectos_operativos_reformulacion_meses', TRUE),
114  );
115  $form['basicos'] = array(
116    '#type' => 'fieldset',
117    '#title' => t('Recolectar información en Datos Básicos del Proyecto Operativo'),
118    '#collapsible' => TRUE,
119    '#collapsed' => FALSE,
120  );
121  $vid = $fields['field_proyecto_plurianual']['vid'];
122  $tree = taxonomy_get_tree($vid);
123  $option_plurianual = array();
124  if ($tree) {
125    foreach ($tree as $term) {
126      $choice = new stdClass();
127      $choice->option = array($term->tid => str_repeat('-', $term->depth) . $term->name);
128      $option_plurianual[] = $choice;
129    }
130  }
131  $form['basicos']['proyectos_operativos_plurianual'] = array(
132    '#type' => 'select',
133    '#options' => $option_plurianual,
134    '#default_value' => variable_get('proyectos_operativos_plurianual', 0),
135    '#title' => t('Proyecto Plurianual'),
136    '#description' => t('Seleccione la opción de cuando un proyecto es considerado plurianual'),
137  );
138
139  $form['basicos']['proyectos_operativos_muestra_pndes'] = array(
140    '#type' => 'checkbox',
141    '#title' => t('Recolectar PNDES.'),
142    '#default_value' => variable_get('proyectos_operativos_muestra_pndes', TRUE),
143  );
144  $form['basicos']['proyectos_operativos_muestra_mcti'] = array(
145    '#type' => 'checkbox',
146    '#title' => t('Recolectar Directriz MCTI.'),
147    '#default_value' => variable_get('proyectos_operativos_muestra_mcti', TRUE),
148  );
149  $form['basicos']['responsables'] = array(
150    '#title' => t('Responsables del proyecto'),
151    '#type' => 'fieldset',
152  );
153  $form['basicos']['responsables']['proyectos_operativos_muestra_gerentes'] = array(
154    '#type' => 'checkbox',
155    '#title' => t('Gerente del Proyecto'),
156    '#default_value' => variable_get('proyectos_operativos_muestra_gerentes', TRUE),
157  );
158  $form['generales'] = array(
159    '#type' => 'fieldset',
160    '#title' => t('Recolectar información en Datos Generales del Proyecto Operativo'),
161    '#collapsible' => TRUE,
162    '#collapsed' => FALSE,
163  );
164  $form['generales']['proyectos_operativos_muestra_talento'] = array(
165    '#type' => 'checkbox',
166    '#title' => t('Recolectar Talento humano.'),
167    '#default_value' => variable_get('proyectos_operativos_muestra_talento', TRUE),
168  );
169  $form['generales']['proyectos_operativos_muestra_capacidades'] = array(
170    '#type' => 'checkbox',
171    '#title' => t('Recolectar Capacidades.'),
172    '#default_value' => variable_get('proyectos_operativos_muestra_capacidades', TRUE),
173  );
174  $form['generales']['proyectos_operativos_muestra_beneficiario'] = array(
175    '#type' => 'checkbox',
176    '#title' => t('Recolectar Beneficiarios.'),
177    '#default_value' => variable_get('proyectos_operativos_muestra_beneficiario', TRUE),
178  );
179  $form['generales']['proyectos_operativos_muestra_beneficiarios_indirectos'] = array(
180    '#type' => 'checkbox',
181    '#title' => t('Recolectar Beneficiarios indirectos.'),
182    '#default_value' => variable_get('proyectos_operativos_muestra_beneficiarios_indirectos', TRUE),
183  );
184  $form['indicadores'] = array(
185    '#type' => 'fieldset',
186    '#title' => t('Recolectar información en Indicadores del Proyecto'),
187    '#collapsible' => TRUE,
188    '#collapsed' => FALSE,
189  );
190  $form['indicadores']['proyectos_operativos_muestra_enunciado_problema'] = array(
191    '#type' => 'checkbox',
192    '#title' => t('Recolectar Enunciado del problema.'),
193    '#default_value' => variable_get('proyectos_operativos_muestra_enunciado_problema', TRUE),
194  );
195  $form['indicadores']['proyectos_operativos_muestra_justicacion'] = array(
196    '#type' => 'checkbox',
197    '#title' => t('Recolectar Justificación.'),
198    '#default_value' => variable_get('proyectos_operativos_muestra_justicacion', TRUE),
199  );
200  $form['indicadores']['proyectos_operativos_muestra_alcance'] = array(
201    '#type' => 'checkbox',
202    '#title' => t('Recolectar Alcance.'),
203    '#default_value' => variable_get('proyectos_operativos_muestra_alcance', TRUE),
204  );
205  $form['indicadores']['proyectos_operativos_muestra_proyecto_causas'] = array(
206    '#type' => 'checkbox',
207    '#title' => t('Recolectar Causas del proyecto.'),
208    '#default_value' => variable_get('proyectos_operativos_muestra_proyecto_causas', TRUE),
209  );
210  $form['indicadores']['proyectos_operativos_muestra_sa'] = array(
211    '#type' => 'checkbox',
212    '#title' => t('Recolectar Situación Actual.'),
213    '#default_value' => variable_get('proyectos_operativos_muestra_sa', TRUE),
214  );
215  $form['indicadores']['proyectos_operativos_muestra_sa_cuantificacion'] = array(
216    '#type' => 'checkbox',
217    '#title' => t('Recolectar Cuantificación en Situación Actual.'),
218    '#default_value' => variable_get('proyectos_operativos_muestra_sa_cuantificacion', TRUE),
219  );
220  $form['indicadores']['proyectos_operativos_muestra_so'] = array(
221    '#type' => 'checkbox',
222    '#title' => t('Recolectar Situación Objetivo.'),
223    '#default_value' => variable_get('proyectos_operativos_muestra_so', TRUE),
224  );
225  $vid = $fields['field_proyecto_unidadm']['vid'];
226  $tree = taxonomy_get_tree($vid);
227  $option_unidadm = array();
228  if ($tree) {
229    foreach ($tree as $term) {
230      $choice = new stdClass();
231      $choice->option = array($term->tid => str_repeat('-', $term->depth) . $term->name);
232      $option_unidadm[] = $choice;
233    }
234  }
235  $form['indicadores']['proyectos_operativos_allow_unidpersona'] = array(
236    '#type' => 'select',
237    '#options' => $option_unidadm,
238    '#default_value' => variable_get('proyectos_operativos_allow_unidpersona', array()),
239    '#title' => t('Campos de las unidades de medida que deben relacionarse con personas'),
240    '#multiple' => TRUE,
241  );
242  $form['format_number'] = array(
243    '#type' => 'fieldset',
244    '#title' => t('Formato Númerico'),
245    '#collapsible' => TRUE,
246    '#collapsed' => FALSE,
247  );
248  $form['format_number']['proyectos_operativos_number_demostracion'] = array(
249    '#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>',
250    '#weight' => -10,
251
252  );
253  $form['format_number']['proyectos_operativos_number_decimals'] = array(
254    '#type' => 'textfield',
255    '#title' => t('Cantidad de Decimales.'),
256    '#required' => TRUE,
257    '#weight' => -9,
258    '#default_value' => variable_get('proyectos_operativos_number_decimals', 0),
259  );
260  $form['format_number']['proyectos_operativos_number_dec_point'] = array(
261    '#type' => 'textfield',
262    '#title' => t('Separador Decimal.'),
263    '#required' => TRUE,
264    '#weight' => -9,
265    '#default_value' => variable_get('proyectos_operativos_number_dec_point', ','),
266  );
267  $form['format_number']['proyectos_operativos_number_thousands_sep'] = array(
268    '#type' => 'textfield',
269    '#title' => t('Separador de Miles.'),
270    '#required' => TRUE,
271    '#weight' => -9,
272    '#default_value' => variable_get('proyectos_operativos_number_thousands_sep', '.'),
273  );
274
275  return system_settings_form($form);
276}
277
278
279
280/**
281 * Implementation of proyectos_operativos_admin_settings().
282 * COnfigurar proyectos operativos.
283 */
284function proyectos_operativos_admin_workflow_settings() {
285  if (module_exists('workflow')) {
286    $wid = workflow_get_workflow_for_type('proyectos_operativos');
287    if ($wid){
288      $states = workflow_get_states($wid);
289      $rids = user_roles();
290      $rids['-1'] = t('author');
291      if (count($states)) {
292        $form['workflow'] = array(
293          '#type' => 'fieldset',
294          '#title' => t('Workflow'),
295          '#collapsible' => TRUE,
296          '#collapsed' => FALSE,
297        );
298        foreach ($states as $sid => $state) {
299          $form['workflow']['proyectos_operativos_state_m_' . $sid] = array(
300            '#type' => 'checkboxes',
301            '#options' => $rids,
302            '#default_value' => variable_get('proyectos_operativos_state_m_' . $sid, array()),
303            '#title' => t('Roles que pueden editar los Proyectos Operativos'),
304            '#multiple' => TRUE,
305            '#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>',
306            '#suffix' => "</td></tr></tbody></table>",
307          );
308        }
309        $form['seguimiento']['proyectos_operativos_state_aprobado'] = array(
310          '#type' => 'select',
311          '#title' => t('Estado aprobado'),
312          '#default_value' => variable_get('proyectos_operativos_state_aprobado', NULL),
313          '#options' => $states,
314            '#prefix' => '<table width="100%" style="border: 0;"><tbody style="border: 0;"><tr><td>',
315        );
316        $form['seguimiento']['proyectos_operativos_state_naprobado'] = array(
317          '#type' => 'select',
318          '#title' => t('Estado no aprobado'),
319          '#default_value' => variable_get('proyectos_operativos_state_naprobado', NULL),
320          '#options' => $states,
321            '#prefix' => "</td><td>",
322            '#suffix' => "</td></tr></tbody></table>",
323        );
324      }
325      $form['workflow']['devueltos'] = array(
326        '#type' => 'fieldset',
327        '#title' => t('Estados Devueltos'),
328        '#collapsible' => TRUE,
329        '#collapsed' => FALSE,
330      );
331      $i = 0;
332      $first_state = _workflow_creation_state($wid);
333      $prefijo = '<table width="100%" style="border: 0;"><tbody style="border: 0;"><tr>';
334      $prefijo .= '<th>' . t('De / A') . '&nbsp;→</th>';
335      foreach ($states as $sid => $state) {
336        if ($sid != $first_state) {
337          $prefijo .= '<th>' . $state . '</th>';
338        }
339      }
340      $prefijo .= '</tr>';
341      foreach ($states as $sid => $state) {
342        $prefijo .= '<tr>';
343        $prefijo .= '<td>' . check_plain($state) . '</td>';
344        foreach ($states as $sid1 => $state1) {
345          if ($sid1 != $first_state) {
346            $form['workflow']['devueltos']['proyectos_operativos_state_d_' . $sid . '_' . $sid1] = array(
347              '#type' => 'checkbox',
348              '#title' => check_plain($state1),
349              '#default_value' => variable_get('proyectos_operativos_state_d_' . $sid . '_' . $sid1, FALSE),
350              '#prefix' => $prefijo . '<td>',
351              '#suffix' => "</td>",
352            );
353            $prefijo = '';
354          }
355        }
356        $form['workflow']['devueltos']['proyectos_operativos_state_d_' . $sid . '_' . $sid1]['#suffix'] .= '</tr>';
357      }
358      $form['workflow']['devueltos']['proyectos_operativos_state_d_' . $sid . '_' . $sid1]['#suffix'] .= '</table>';
359      $form['workflow']['devueltos']['proyectos_operativos_state_tdevueltos'] = array(
360        '#type' => 'textfield',
361        '#title' => t('Texto que antecede a los estados devueltos.'),
362        '#required' => TRUE,
363        '#default_value' => variable_get('proyectos_operativos_state_tdevueltos', 'Devuelto a @state'),
364        '#description' => t('Añada la etiqueta @state para indicar donde debe aparecer la palabra del estado.'),
365      );
366      $form['workflow']['devueltos']['proyectos_operativos_state_tndevueltos'] = array(
367        '#type' => 'textfield',
368        '#title' => t('Texto que antecede a los estados no devueltos.'),
369        '#required' => TRUE,
370        '#default_value' => variable_get('proyectos_operativos_state_tndevueltos', 'Enviado a @state'),
371        '#description' => t('Añada la etiqueta @state para indicar donde debe aparecer la palabra del estado.'),
372      );
373    }
374  }
375  return system_settings_form($form);
376}
377
378
Nota: Vea TracBrowser para ayuda de uso del navegador del repositorio.