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

stable
Last change on this file since eb502b4 was f516a61, checked in by jpuentes <jpuentes@…>, 7 años ago

se agrego la opción de administracion para varios años

  • Propiedad mode establecida a 100755
File size: 15.0 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_sa'] = array(
206    '#type' => 'checkbox',
207    '#title' => t('Recolectar Situación Actual.'),
208    '#default_value' => variable_get('proyectos_operativos_muestra_sa', TRUE),
209  );
210  $form['indicadores']['proyectos_operativos_muestra_sa_cuantificacion'] = array(
211    '#type' => 'checkbox',
212    '#title' => t('Recolectar Cuantificación en Situación Actual.'),
213    '#default_value' => variable_get('proyectos_operativos_muestra_sa_cuantificacion', TRUE),
214  );
215  $form['indicadores']['proyectos_operativos_muestra_so'] = array(
216    '#type' => 'checkbox',
217    '#title' => t('Recolectar Situación Objetivo.'),
218    '#default_value' => variable_get('proyectos_operativos_muestra_so', TRUE),
219  );
220  $vid = $fields['field_proyecto_unidadm']['vid'];
221  $tree = taxonomy_get_tree($vid);
222  $option_unidadm = array();
223  if ($tree) {
224    foreach ($tree as $term) {
225      $choice = new stdClass();
226      $choice->option = array($term->tid => str_repeat('-', $term->depth) . $term->name);
227      $option_unidadm[] = $choice;
228    }
229  }
230  $form['indicadores']['proyectos_operativos_allow_unidpersona'] = array(
231    '#type' => 'select',
232    '#options' => $option_unidadm,
233    '#default_value' => variable_get('proyectos_operativos_allow_unidpersona', array()),
234    '#title' => t('Campos de las unidades de medida que deben relacionarse con personas'),
235    '#multiple' => TRUE,
236  );
237  $form['format_number'] = array(
238    '#type' => 'fieldset',
239    '#title' => t('Formato Númerico'),
240    '#collapsible' => TRUE,
241    '#collapsed' => FALSE,
242  );
243  $form['format_number']['proyectos_operativos_number_demostracion'] = array(
244    '#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>',
245    '#weight' => -10,
246
247  );
248  $form['format_number']['proyectos_operativos_number_decimals'] = array(
249    '#type' => 'textfield',
250    '#title' => t('Cantidad de Decimales.'),
251    '#required' => TRUE,
252    '#weight' => -9,
253    '#default_value' => variable_get('proyectos_operativos_number_decimals', 0),
254  );
255  $form['format_number']['proyectos_operativos_number_dec_point'] = array(
256    '#type' => 'textfield',
257    '#title' => t('Separador Decimal.'),
258    '#required' => TRUE,
259    '#weight' => -9,
260    '#default_value' => variable_get('proyectos_operativos_number_dec_point', ','),
261  );
262  $form['format_number']['proyectos_operativos_number_thousands_sep'] = array(
263    '#type' => 'textfield',
264    '#title' => t('Separador de Miles.'),
265    '#required' => TRUE,
266    '#weight' => -9,
267    '#default_value' => variable_get('proyectos_operativos_number_thousands_sep', '.'),
268  );
269
270  return system_settings_form($form);
271}
272
273
274
275/**
276 * Implementation of proyectos_operativos_admin_settings().
277 * COnfigurar proyectos operativos.
278 */
279function proyectos_operativos_admin_workflow_settings() {
280  if (module_exists('workflow')) {
281    $wid = workflow_get_workflow_for_type('proyectos_operativos');
282    if ($wid){
283      $states = workflow_get_states($wid);
284      $rids = user_roles();
285      $rids['-1'] = t('author');
286      if (count($states)) {
287        $form['workflow'] = array(
288          '#type' => 'fieldset',
289          '#title' => t('Workflow'),
290          '#collapsible' => TRUE,
291          '#collapsed' => FALSE,
292        );
293        foreach ($states as $sid => $state) {
294          $form['workflow']['proyectos_operativos_state_m_' . $sid] = array(
295            '#type' => 'checkboxes',
296            '#options' => $rids,
297            '#default_value' => variable_get('proyectos_operativos_state_m_' . $sid, array()),
298            '#title' => t('Roles que pueden editar los Proyectos Operativos'),
299            '#multiple' => TRUE,
300            '#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>',
301            '#suffix' => "</td></tr></tbody></table>",
302          );
303        }
304        $form['seguimiento']['proyectos_operativos_state_aprobado'] = array(
305          '#type' => 'select',
306          '#title' => t('Estado aprobado'),
307          '#default_value' => variable_get('proyectos_operativos_state_aprobado', NULL),
308          '#options' => $states,
309            '#prefix' => '<table width="100%" style="border: 0;"><tbody style="border: 0;"><tr><td>',
310        );
311        $form['seguimiento']['proyectos_operativos_state_naprobado'] = array(
312          '#type' => 'select',
313          '#title' => t('Estado no aprobado'),
314          '#default_value' => variable_get('proyectos_operativos_state_naprobado', NULL),
315          '#options' => $states,
316            '#prefix' => "</td><td>",
317            '#suffix' => "</td></tr></tbody></table>",
318        );
319      }
320      $form['workflow']['devueltos'] = array(
321        '#type' => 'fieldset',
322        '#title' => t('Estados Devueltos'),
323        '#collapsible' => TRUE,
324        '#collapsed' => FALSE,
325      );
326      $i = 0;
327      $first_state = _workflow_creation_state($wid);
328      $prefijo = '<table width="100%" style="border: 0;"><tbody style="border: 0;"><tr>';
329      $prefijo .= '<th>' . t('De / A') . '&nbsp;→</th>';
330      foreach ($states as $sid => $state) {
331        if ($sid != $first_state) {
332          $prefijo .= '<th>' . $state . '</th>';
333        }
334      }
335      $prefijo .= '</tr>';
336      foreach ($states as $sid => $state) {
337        $prefijo .= '<tr>';
338        $prefijo .= '<td>' . check_plain($state) . '</td>';
339        foreach ($states as $sid1 => $state1) {
340          if ($sid1 != $first_state) {
341            $form['workflow']['devueltos']['proyectos_operativos_state_d_' . $sid . '_' . $sid1] = array(
342              '#type' => 'checkbox',
343              '#title' => check_plain($state1),
344              '#default_value' => variable_get('proyectos_operativos_state_d_' . $sid . '_' . $sid1, FALSE),
345              '#prefix' => $prefijo . '<td>',
346              '#suffix' => "</td>",
347            );
348            $prefijo = '';
349          }
350        }
351        $form['workflow']['devueltos']['proyectos_operativos_state_d_' . $sid . '_' . $sid1]['#suffix'] .= '</tr>';
352      }
353      $form['workflow']['devueltos']['proyectos_operativos_state_d_' . $sid . '_' . $sid1]['#suffix'] .= '</table>';
354      $form['workflow']['devueltos']['proyectos_operativos_state_tdevueltos'] = array(
355        '#type' => 'textfield',
356        '#title' => t('Texto que antecede a los estados devueltos.'),
357        '#required' => TRUE,
358        '#default_value' => variable_get('proyectos_operativos_state_tdevueltos', 'Devuelto a @state'),
359        '#description' => t('Añada la etiqueta @state para indicar donde debe aparecer la palabra del estado.'),
360      );
361      $form['workflow']['devueltos']['proyectos_operativos_state_tndevueltos'] = array(
362        '#type' => 'textfield',
363        '#title' => t('Texto que antecede a los estados no devueltos.'),
364        '#required' => TRUE,
365        '#default_value' => variable_get('proyectos_operativos_state_tndevueltos', 'Enviado a @state'),
366        '#description' => t('Añada la etiqueta @state para indicar donde debe aparecer la palabra del estado.'),
367      );
368    }
369  }
370  return system_settings_form($form);
371}
372
373
Nota: Vea TracBrowser para ayuda de uso del navegador del repositorio.