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 - Ing. Jose Puentes |
---|
24 | * @date 2017-02-09 // (año-mes-dia) |
---|
25 | * @version 0.1 // (0.1) |
---|
26 | * |
---|
27 | */ |
---|
28 | |
---|
29 | /** |
---|
30 | * Implementation of situacional_actual_preliminar_admin_settings(). |
---|
31 | * Configurar proyectos operativos. |
---|
32 | */ |
---|
33 | function situacional_actual_preliminar_admin_settings() { |
---|
34 | $form = array(); |
---|
35 | $current_year = date("Y"); |
---|
36 | $year = variable_get('situacional_actual_preliminar_anho_creacion', 0); |
---|
37 | if (!$year) { |
---|
38 | $years[0] = t('Seleccione'); |
---|
39 | } |
---|
40 | for($i = $current_year - 10; $i <= $current_year + 10; $i++) { |
---|
41 | $years[$i] = $i; |
---|
42 | } |
---|
43 | $form['situacional_actual_preliminar_anho_creacion'] = array( |
---|
44 | '#title' => t('Gestionar la explicación situacional para el año'), |
---|
45 | '#type' => 'select', |
---|
46 | '#default_value' => $year, |
---|
47 | '#options' => $years, |
---|
48 | ); |
---|
49 | if (module_exists('ente_planificador_hierarchical')) { |
---|
50 | $hierarchical = variable_get('ente_planificador_hierarchical_count', 2); |
---|
51 | for ($i = 1; $i <= $hierarchical; $i++) { |
---|
52 | $hierarchical_count[$i] = $i; |
---|
53 | } |
---|
54 | $form['ente_planificador_hierarchical']['situacion_actual_preliminar_hierarchical_count'] = array( |
---|
55 | '#title' => t('Nivel de Planificación'), |
---|
56 | '#type' => 'select', |
---|
57 | '#default_value' => variable_get('situacion_actual_preliminar_hierarchical_count', 2), |
---|
58 | '#description' => t('El nivel especificado sera una referencia y le permitirá obtener la explicación situacional de sus entes adscritos.'), |
---|
59 | '#options' => $hierarchical_count, |
---|
60 | ); |
---|
61 | } |
---|
62 | $options = array('_none' => 'Ninguna'); |
---|
63 | $views = views_get_all_views(); |
---|
64 | foreach ($views as $view) { |
---|
65 | $options[$view->name] = $view->human_name; |
---|
66 | } |
---|
67 | $planns = _situacion_actual_preliminar_get_planns(); |
---|
68 | $form['situacional_actual_preliminar_views'] = array( |
---|
69 | '#title' => t('Vistas por Tipo de Proceso'), |
---|
70 | '#type' => 'fieldset', |
---|
71 | ); |
---|
72 | $tipos = array( |
---|
73 | 'causas' => t('Causas'), |
---|
74 | 'descriptores' => t('Descriptores'), |
---|
75 | 'cambios' => t('Cambios de la Situación Actual'), |
---|
76 | 'causas_texto' => t('Causas (Texto)'), |
---|
77 | 'descriptores_texto' => t('Descriptores (Texto)'), |
---|
78 | 'cambios_texto' => t('Cambios de la Situación Actual (Texto)'), |
---|
79 | ); |
---|
80 | foreach ($planns as $plann) { |
---|
81 | $tipo = $plann['plan']; |
---|
82 | $form['situacional_actual_preliminar_views']['situacion_actual_preliminar_' . $plann['plan']] = array( |
---|
83 | '#title' => $plann['title'], |
---|
84 | '#type' => 'fieldset', |
---|
85 | ); |
---|
86 | foreach ($tipos as $name => $value) { |
---|
87 | $aux = 'situacion_actual_preliminar_' . $plann['plan']; |
---|
88 | $display_id = 'situacion_actual_preliminar_display_views_' . $plann['plan'] . '_' . $name; |
---|
89 | $form['situacional_actual_preliminar_views'][$aux][$aux . '_' . $name] = array( |
---|
90 | '#title' => $value, |
---|
91 | '#type' => 'select', |
---|
92 | '#default_value' => variable_get($aux . '_' . $name, 0), |
---|
93 | '#description' => t('Seleccione la vista para el proceso de <strong> @plan</strong>', array('@plan' => $plann['title'])), |
---|
94 | '#options' => $options, |
---|
95 | '#ahah' => array( |
---|
96 | 'event' => 'change', |
---|
97 | 'path' => 'situacional_actual_preliminar_views_js/' . $plann['plan'] . '/' . $name, |
---|
98 | 'wrapper' => $display_id, |
---|
99 | 'method' => 'replace', |
---|
100 | 'progress' => array('type' => 'bar', 'message' => t('Please wait...')), |
---|
101 | ), |
---|
102 | ); |
---|
103 | if (!variable_get($display_id, 0)) { |
---|
104 | $form['situacional_actual_preliminar_views'][$aux][$display_id] = array( |
---|
105 | '#prefix' => '<div id="' . $display_id . '">', |
---|
106 | '#suffix' => '</div>', |
---|
107 | '#type' => 'hidden', |
---|
108 | ); |
---|
109 | } |
---|
110 | else { |
---|
111 | $view = views_get_view(variable_get($aux . '_' . $name, 0)); |
---|
112 | foreach ($view->display as $key => $display) { |
---|
113 | $options_display[$key] = $display->display_title; |
---|
114 | } |
---|
115 | $form['situacional_actual_preliminar_views'][$aux][$display_id] = array( |
---|
116 | '#title' => t("Seleccione el display de la vista"), |
---|
117 | '#type' => 'select', |
---|
118 | '#default_value' => variable_get($display_id, 0), |
---|
119 | '#options' => $options_display, |
---|
120 | '#prefix' => '<div id="' . $display_id . '">', |
---|
121 | '#suffix' => '</div>', |
---|
122 | ); |
---|
123 | } |
---|
124 | } |
---|
125 | } |
---|
126 | return system_settings_form($form); |
---|
127 | } |
---|