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