[a0b4327] | 1 | <?php |
---|
| 2 | |
---|
| 3 | /** |
---|
| 4 | * Sistema Integral de Planificación y Presupuesto (SIPP) |
---|
| 5 | * @file acciones_centralizadas.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 | * @version 0.1 // (0.1) |
---|
| 26 | * |
---|
| 27 | */ |
---|
| 28 | |
---|
| 29 | /* |
---|
| 30 | * ente_planificador_admin_settings |
---|
| 31 | * Configurar acciones centralizadas |
---|
| 32 | */ |
---|
| 33 | function acciones_centralizadas_admin_settings() { |
---|
| 34 | $ftypes = array( |
---|
| 35 | 0 => t('Seleccione'), |
---|
| 36 | '1' => t('January'), |
---|
| 37 | '2' => t('February'), |
---|
| 38 | '3' => t('March'), |
---|
| 39 | '4' => t('April'), |
---|
| 40 | '5' => t('May'), |
---|
| 41 | '6' => t('June'), |
---|
| 42 | '7' => t('July'), |
---|
| 43 | '8' => t('August'), |
---|
| 44 | '9' => t('September'), |
---|
| 45 | '10' => t('Octuber'), |
---|
| 46 | '11' => t('November'), |
---|
| 47 | '12' => t('December'), |
---|
| 48 | ); |
---|
| 49 | $current_year = date("Y"); |
---|
| 50 | if (!variable_get('acciones_centralizadas_anho_creacion', 0)) { |
---|
| 51 | $years[0] = t('Seleccione'); |
---|
| 52 | } |
---|
| 53 | for($i = $current_year - 10; $i <= $current_year; $i++) { |
---|
| 54 | $years[$i] = $i; |
---|
| 55 | } |
---|
| 56 | $form = array(); |
---|
| 57 | $form['days'] = array( |
---|
| 58 | '#type' => 'fieldset', |
---|
| 59 | '#title' => t('Fechas'), |
---|
| 60 | '#collapsible' => TRUE, |
---|
| 61 | '#collapsed' => FALSE, |
---|
| 62 | ); |
---|
| 63 | $form['days']['acciones_centralizadas_anho_creacion'] = array( |
---|
| 64 | '#title' => t('Gestionar acción centralizada para el año'), |
---|
| 65 | '#type' => 'select', |
---|
| 66 | '#default_value' => variable_get('acciones_centralizadas_anho_creacion', 0), |
---|
| 67 | '#options' => $years, |
---|
| 68 | ); |
---|
| 69 | $form['days']['seguimiento'] = array( |
---|
| 70 | '#type' => 'fieldset', |
---|
| 71 | '#title' => t('Seguimiento'), |
---|
| 72 | '#collapsible' => TRUE, |
---|
| 73 | '#collapsed' => FALSE, |
---|
| 74 | ); |
---|
| 75 | $form['days']['seguimiento']['acciones_centralizadas_mes_seguimiento'] = array( |
---|
| 76 | '#title' => t('Habilitar seguimiento para el mes'), |
---|
| 77 | '#type' => 'select', |
---|
| 78 | '#default_value' => variable_get('acciones_centralizadas_mes_seguimiento', 0), |
---|
| 79 | '#options' => $ftypes, |
---|
| 80 | ); |
---|
| 81 | $form['days']['seguimiento']['acciones_centralizadas_anho_seguimiento'] = array( |
---|
| 82 | '#title' => t('Habilitar seguimiento para el año'), |
---|
| 83 | '#type' => 'select', |
---|
| 84 | '#default_value' => variable_get('acciones_centralizadas_anho_seguimiento', 0), |
---|
| 85 | '#options' => $years, |
---|
| 86 | ); |
---|
| 87 | $form['format_number'] = array( |
---|
| 88 | '#type' => 'fieldset', |
---|
| 89 | '#title' => t('Formato Númerico'), |
---|
| 90 | '#collapsible' => TRUE, |
---|
| 91 | '#collapsed' => FALSE, |
---|
| 92 | ); |
---|
| 93 | $form['format_number']['acciones_centralizadas_number_demostracion'] = array( |
---|
| 94 | '#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>', |
---|
| 95 | '#weight' => -10, |
---|
| 96 | |
---|
| 97 | ); |
---|
| 98 | $form['format_number']['acciones_centralizadas_number_decimals'] = array( |
---|
| 99 | '#type' => 'textfield', |
---|
| 100 | '#title' => t('Cantidad de Decimales.'), |
---|
| 101 | '#required' => TRUE, |
---|
| 102 | '#weight' => -9, |
---|
| 103 | '#default_value' => variable_get('acciones_centralizadas_number_decimals', 0), |
---|
| 104 | ); |
---|
| 105 | $form['format_number']['acciones_centralizadas_number_dec_point'] = array( |
---|
| 106 | '#type' => 'textfield', |
---|
| 107 | '#title' => t('Separador Decimal.'), |
---|
| 108 | '#required' => TRUE, |
---|
| 109 | '#weight' => -9, |
---|
| 110 | '#default_value' => variable_get('acciones_centralizadas_number_dec_point', ','), |
---|
| 111 | ); |
---|
| 112 | $form['format_number']['acciones_centralizadas_number_thousands_sep'] = array( |
---|
| 113 | '#type' => 'textfield', |
---|
| 114 | '#title' => t('Separador de Miles.'), |
---|
| 115 | '#required' => TRUE, |
---|
| 116 | '#weight' => -9, |
---|
| 117 | '#default_value' => variable_get('acciones_centralizadas_number_thousands_sep', '.'), |
---|
| 118 | ); |
---|
| 119 | $form['visual'] = array( |
---|
| 120 | '#type' => 'fieldset', |
---|
| 121 | '#title' => t('Visualización'), |
---|
| 122 | '#collapsible' => TRUE, |
---|
| 123 | '#collapsed' => FALSE, |
---|
| 124 | ); |
---|
| 125 | //estado critico |
---|
| 126 | $form['visual']['critico'] = array( |
---|
| 127 | '#type' => 'fieldset', |
---|
| 128 | '#title' => t('Estado critico'), |
---|
| 129 | '#collapsible' => TRUE, |
---|
| 130 | '#collapsed' => FALSE, |
---|
| 131 | ); |
---|
| 132 | $form['visual']['critico']['acciones_centralizadas_color_critica'] = array( |
---|
| 133 | '#title' => t('Color de fondo'), |
---|
| 134 | '#type' => 'textfield', |
---|
| 135 | '#default_value' => variable_get('acciones_centralizadas_color_critica', '#fd0002'), |
---|
| 136 | '#required' => TRUE, |
---|
| 137 | '#size' => 10, |
---|
| 138 | ); |
---|
| 139 | $form['visual']['critico']['acciones_centralizadas_colort_critica'] = array( |
---|
| 140 | '#title' => t('Color de fuente'), |
---|
| 141 | '#type' => 'textfield', |
---|
| 142 | '#default_value' => variable_get('acciones_centralizadas_colort_critica', '#FFFFFF'), |
---|
| 143 | '#required' => TRUE, |
---|
| 144 | '#size' => 10, |
---|
| 145 | ); |
---|
| 146 | $form['visual']['critico']['acciones_centralizadas_texto_critica'] = array( |
---|
| 147 | '#title' => t('Texto a mostrar'), |
---|
| 148 | '#type' => 'textfield', |
---|
| 149 | '#default_value' => variable_get('acciones_centralizadas_texto_critica', 'Zona crÃtica'), |
---|
| 150 | '#required' => TRUE, |
---|
| 151 | ); |
---|
| 152 | // estado discreta |
---|
| 153 | $form['visual']['discreta'] = array( |
---|
| 154 | '#type' => 'fieldset', |
---|
| 155 | '#title' => t('Estado discreto'), |
---|
| 156 | '#collapsible' => TRUE, |
---|
| 157 | '#collapsed' => FALSE, |
---|
| 158 | ); |
---|
| 159 | $form['visual']['discreta']['acciones_centralizadas_color_discreta'] = array( |
---|
| 160 | '#title' => t('Color de fondo'), |
---|
| 161 | '#type' => 'textfield', |
---|
| 162 | '#default_value' => variable_get('acciones_centralizadas_color_discreta', '#cc6733'), |
---|
| 163 | '#required' => TRUE, |
---|
| 164 | '#size' => 10, |
---|
| 165 | ); |
---|
| 166 | $form['visual']['discreta']['acciones_centralizadas_colort_discreta'] = array( |
---|
| 167 | '#title' => t('Color de fuente'), |
---|
| 168 | '#type' => 'textfield', |
---|
| 169 | '#default_value' => variable_get('acciones_centralizadas_colort_discreta', '#FFFFFF'), |
---|
| 170 | '#required' => TRUE, |
---|
| 171 | '#size' => 10, |
---|
| 172 | ); |
---|
| 173 | $form['visual']['discreta']['acciones_centralizadas_texto_discreta'] = array( |
---|
| 174 | '#title' => t('Texto a mostrar'), |
---|
| 175 | '#type' => 'textfield', |
---|
| 176 | '#default_value' => variable_get('acciones_centralizadas_texto_discreta', 'Zona discreta'), |
---|
| 177 | '#required' => TRUE, |
---|
| 178 | ); |
---|
| 179 | // estado moderada |
---|
| 180 | $form['visual']['moderada'] = array( |
---|
| 181 | '#type' => 'fieldset', |
---|
| 182 | '#title' => t('Estado moderado'), |
---|
| 183 | '#collapsible' => TRUE, |
---|
| 184 | '#collapsed' => FALSE, |
---|
| 185 | ); |
---|
| 186 | $form['visual']['moderada']['acciones_centralizadas_color_moderada'] = array( |
---|
| 187 | '#title' => t('Color de fondo'), |
---|
| 188 | '#type' => 'textfield', |
---|
| 189 | '#default_value' => variable_get('acciones_centralizadas_color_moderada', '#fdff00'), |
---|
| 190 | '#required' => TRUE, |
---|
| 191 | '#size' => 10, |
---|
| 192 | ); |
---|
| 193 | $form['visual']['moderada']['acciones_centralizadas_colort_moderada'] = array( |
---|
| 194 | '#title' => t('Color de fuente'), |
---|
| 195 | '#type' => 'textfield', |
---|
| 196 | '#default_value' => variable_get('acciones_centralizadas_colort_moderada', '#000000'), |
---|
| 197 | '#required' => TRUE, |
---|
| 198 | '#size' => 10, |
---|
| 199 | ); |
---|
| 200 | $form['visual']['moderada']['acciones_centralizadas_texto_moderada'] = array( |
---|
| 201 | '#title' => t('Texto a mostrar'), |
---|
| 202 | '#type' => 'textfield', |
---|
| 203 | '#default_value' => variable_get('acciones_centralizadas_texto_moderada', 'Zona moderada'), |
---|
| 204 | '#required' => TRUE, |
---|
| 205 | ); |
---|
| 206 | // estado optima |
---|
| 207 | $form['visual']['optima'] = array( |
---|
| 208 | '#type' => 'fieldset', |
---|
| 209 | '#title' => t('Estado Optimo'), |
---|
| 210 | '#collapsible' => TRUE, |
---|
| 211 | '#collapsed' => FALSE, |
---|
| 212 | ); |
---|
| 213 | $form['visual']['optima']['acciones_centralizadas_color_optima'] = array( |
---|
| 214 | '#title' => t('Color de fondo'), |
---|
| 215 | '#type' => 'textfield', |
---|
| 216 | '#default_value' => variable_get('acciones_centralizadas_color_optima', '#20ff21'), |
---|
| 217 | '#required' => TRUE, |
---|
| 218 | '#size' => 10, |
---|
| 219 | ); |
---|
| 220 | $form['visual']['optima']['acciones_centralizadas_colort_optima'] = array( |
---|
| 221 | '#title' => t('Color de fuente'), |
---|
| 222 | '#type' => 'textfield', |
---|
| 223 | '#default_value' => variable_get('acciones_centralizadas_colort_optima', '#000000'), |
---|
| 224 | '#required' => TRUE, |
---|
| 225 | '#size' => 10, |
---|
| 226 | ); |
---|
| 227 | $form['visual']['optima']['acciones_centralizadas_texto_optima'] = array( |
---|
| 228 | '#title' => t('Texto a mostrar'), |
---|
| 229 | '#type' => 'textfield', |
---|
| 230 | '#default_value' => variable_get('acciones_centralizadas_texto_optima', 'Zona optima'), |
---|
| 231 | '#required' => TRUE, |
---|
| 232 | ); |
---|
| 233 | // estado sejecucion |
---|
| 234 | $form['visual']['sejecucion'] = array( |
---|
| 235 | '#type' => 'fieldset', |
---|
| 236 | '#title' => t('Estado Sobre ejecución'), |
---|
| 237 | '#collapsible' => TRUE, |
---|
| 238 | '#collapsed' => FALSE, |
---|
| 239 | ); |
---|
| 240 | $form['visual']['sejecucion']['acciones_centralizadas_color_sejecucion'] = array( |
---|
| 241 | '#title' => t('Color de fondo'), |
---|
| 242 | '#type' => 'textfield', |
---|
| 243 | '#default_value' => variable_get('acciones_centralizadas_color_sejecucion', '#9966cd'), |
---|
| 244 | '#required' => TRUE, |
---|
| 245 | '#size' => 10, |
---|
| 246 | ); |
---|
| 247 | $form['visual']['sejecucion']['acciones_centralizadas_colort_sejecucion'] = array( |
---|
| 248 | '#title' => t('Color de fuente'), |
---|
| 249 | '#type' => 'textfield', |
---|
| 250 | '#default_value' => variable_get('acciones_centralizadas_colort_sejecucion', '#000000'), |
---|
| 251 | '#required' => TRUE, |
---|
| 252 | '#size' => 10, |
---|
| 253 | ); |
---|
| 254 | $form['visual']['sejecucion']['acciones_centralizadas_texto_sejecucion'] = array( |
---|
| 255 | '#title' => t('Texto a mostrar'), |
---|
| 256 | '#type' => 'textfield', |
---|
| 257 | '#default_value' => variable_get('acciones_centralizadas_texto_sejecucion', 'Sobre ejecución'), |
---|
| 258 | '#required' => TRUE, |
---|
| 259 | ); |
---|
| 260 | // estado sejecucion |
---|
| 261 | $form['visual']['default'] = array( |
---|
| 262 | '#type' => 'fieldset', |
---|
| 263 | '#title' => t('Estado sin planificación'), |
---|
| 264 | '#collapsible' => TRUE, |
---|
| 265 | '#collapsed' => FALSE, |
---|
| 266 | ); |
---|
| 267 | $form['visual']['default']['acciones_centralizadas_color_default'] = array( |
---|
| 268 | '#title' => t('Color de fondo'), |
---|
| 269 | '#type' => 'textfield', |
---|
| 270 | '#default_value' => variable_get('acciones_centralizadas_color_default', '#633303'), |
---|
| 271 | '#required' => TRUE, |
---|
| 272 | '#size' => 10, |
---|
| 273 | ); |
---|
| 274 | $form['visual']['default']['acciones_centralizadas_colort_default'] = array( |
---|
| 275 | '#title' => t('Color de fuente'), |
---|
| 276 | '#type' => 'textfield', |
---|
| 277 | '#default_value' => variable_get('acciones_centralizadas_colort_default', '#FFFFFF'), |
---|
| 278 | '#required' => TRUE, |
---|
| 279 | '#size' => 10, |
---|
| 280 | ); |
---|
| 281 | $form['visual']['default']['acciones_centralizadas_texto_default'] = array( |
---|
| 282 | '#title' => t('Texto a mostrar'), |
---|
| 283 | '#type' => 'textfield', |
---|
| 284 | '#default_value' => variable_get('acciones_centralizadas_texto_default', 'No hay planificación'), |
---|
| 285 | '#required' => TRUE, |
---|
| 286 | ); |
---|
| 287 | if (module_exists('workflow')) { |
---|
| 288 | $wid = workflow_get_workflow_for_type('accion_centralizada'); |
---|
| 289 | if ($wid){ |
---|
| 290 | $states = workflow_get_states($wid); |
---|
| 291 | $rids = user_roles(); |
---|
| 292 | $rids['-1'] = t('author'); |
---|
| 293 | if (count($states)) { |
---|
| 294 | $form['workflow'] = array( |
---|
| 295 | '#type' => 'fieldset', |
---|
| 296 | '#title' => t('Workflow'), |
---|
| 297 | '#collapsible' => TRUE, |
---|
| 298 | '#collapsed' => FALSE, |
---|
| 299 | ); |
---|
| 300 | foreach ($states as $sid => $state) { |
---|
| 301 | $form['workflow']['acciones_centralizadas_state_m_' . $sid] = array( |
---|
| 302 | '#type' => 'checkboxes', |
---|
| 303 | '#options' => $rids, |
---|
| 304 | '#default_value' => variable_get('acciones_centralizadas_state_m_' . $sid, array()), |
---|
| 305 | '#title' => t('Roles que pueden editar las AC'), |
---|
| 306 | '#multiple' => TRUE, |
---|
| 307 | '#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>', |
---|
| 308 | ); |
---|
| 309 | $form['workflow']['acciones_centralizadas_state_r_' . $sid] = array( |
---|
| 310 | '#type' => 'checkboxes', |
---|
| 311 | '#options' => $rids, |
---|
| 312 | '#default_value' => variable_get('acciones_centralizadas_state_r_' . $sid, array()), |
---|
| 313 | '#title' => t('Roles que pueden reformular las AC'), |
---|
| 314 | '#multiple' => TRUE, |
---|
| 315 | '#prefix' => "</td><td>", |
---|
| 316 | ); |
---|
| 317 | $form['workflow']['acciones_centralizadas_state_s_' . $sid] = array( |
---|
| 318 | '#type' => 'checkboxes', |
---|
| 319 | '#options' => $rids, |
---|
| 320 | '#default_value' => variable_get('acciones_centralizadas_state_s_' . $sid, array()), |
---|
| 321 | '#title' => t('Roles que pueden Seguimiento las AC'), |
---|
| 322 | '#multiple' => TRUE, |
---|
| 323 | '#prefix' => "</td><td>", |
---|
| 324 | '#suffix' => "</td></tr></tbody></table>", |
---|
| 325 | ); |
---|
| 326 | } |
---|
| 327 | $form['estados'] = array( |
---|
| 328 | '#type' => 'fieldset', |
---|
| 329 | '#title' => t('Seguimiento'), |
---|
| 330 | '#collapsible' => TRUE, |
---|
| 331 | '#collapsed' => FALSE, |
---|
| 332 | ); |
---|
| 333 | $form['seguimiento']['acciones_centralizadas_state_aprobado'] = array( |
---|
| 334 | '#type' => 'select', |
---|
| 335 | '#title' => t('Estado aprobado'), |
---|
| 336 | '#default_value' => variable_get('acciones_centralizadas_state_aprobado', NULL), |
---|
| 337 | '#options' => $states, |
---|
| 338 | '#prefix' => '<table width="100%" style="border: 0;"><tbody style="border: 0;"><tr><td>', |
---|
| 339 | ); |
---|
| 340 | $form['seguimiento']['acciones_centralizadas_state_naprobado'] = array( |
---|
| 341 | '#type' => 'select', |
---|
| 342 | '#title' => t('Estado no aprobado'), |
---|
| 343 | '#default_value' => variable_get('acciones_centralizadas_state_naprobado', NULL), |
---|
| 344 | '#options' => $states, |
---|
| 345 | '#prefix' => "</td><td>", |
---|
| 346 | '#suffix' => "</td></tr></tbody></table>", |
---|
| 347 | ); |
---|
| 348 | } |
---|
| 349 | } |
---|
| 350 | } |
---|
| 351 | return system_settings_form($form); |
---|
| 352 | } |
---|
[dc71b2f] | 353 | /** |
---|
| 354 | * Implementation of proyectos_operativos_admin_settings(). |
---|
| 355 | * COnfigurar las acciones centralizadas |
---|
| 356 | */ |
---|
| 357 | function acciones_centralizadas_admin_workflow_color_settings() { |
---|
| 358 | if (module_exists('workflow')) { |
---|
| 359 | $wid = workflow_get_workflow_for_type('accion_centralizada'); |
---|
| 360 | $colores = '#ffffff'; |
---|
| 361 | if ($wid){ |
---|
| 362 | $states = workflow_get_states($wid); |
---|
| 363 | if (count($states)) { |
---|
| 364 | $form['workflow'] = array( |
---|
| 365 | '#type' => 'fieldset', |
---|
| 366 | '#title' => t('Workflow Status Color'), |
---|
| 367 | '#collapsible' => TRUE, |
---|
| 368 | '#collapsed' => FALSE, |
---|
| 369 | ); |
---|
| 370 | foreach ($states as $sid => $state) { |
---|
| 371 | $form['workflow']['acciones_centralizadas_state_color_' . $sid] = array( |
---|
| 372 | '#type' => 'textfield', |
---|
| 373 | '#title' => t('Color para el Estado: '. $state), |
---|
| 374 | '#default_value' => variable_get('acciones_centralizadas_state_color_' . $sid, $colores), |
---|
| 375 | '#size' => 25, |
---|
| 376 | ); |
---|
| 377 | } |
---|
| 378 | } |
---|
| 379 | } |
---|
| 380 | } |
---|
| 381 | return system_settings_form($form); |
---|
| 382 | } |
---|