source: sipes/0.3-modules/ente_planificador_sector/ente_planificador_sector.install @ fbe146b

stableversion-3.0
Last change on this file since fbe146b was 303fae2, checked in by José Gregorio Puentes <jpuentes@…>, 9 años ago

se agregaron los modulos

  • Propiedad mode establecida a 100755
File size: 5.5 KB
Línea 
1<?php
2  /**
3  * Modulo para la gestión de los entes planificadores por sectores sociales
4  * Sistema Automatizado para la Planificación Estratégico-Situacional en la Administración Pública Venezolana
5  * @file ente_planificador_sector.install
6  * Drupal part Module to code ente planificador module
7  * Copyright 2011 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 2014-11-03 // (a&#241;o-mes-dia)
25  * @version 0.2 // (0.1)
26  *
27  */
28
29/*
30 * Implementation of hook_install().
31 */
32function ente_planificador_sector_install () {
33  $vocabulary = taxonomy_vocabulary_load(variable_get('ente_planificador_sector_Ambitos', 0));
34  if (!$vocabulary) {
35    $vocabulary = array(
36      'name' => 'Ambitos',
37      'multiple' => 1,
38      'required' => 0,
39      'hierarchy' => 1,
40      'relations' => 0,
41      'module' => 'ente_planificador_sector',
42      'weight' => -10,
43    );
44    taxonomy_save_vocabulary($vocabulary);
45    variable_set('ente_planificador_sector_Ambitos', $vocabulary['vid']);
46                $names = array(
47                  'Social',
48                  'Político-institucional',
49                        'Económico',
50                        'Territorial e Internacional',
51                );   
52                foreach ($names as $id => $name) {
53                        $term = array(
54                'vid' => $vocabulary['vid'], // Voacabulary ID
55                'name' => $name, // Term Name
56                );
57                taxonomy_save_term($term);
58                }       
59  }
60        $vocabulary = 0;
61  $vocabulary = taxonomy_vocabulary_load(variable_get('ente_planificador_sector_organismos', 0));
62  if (!$vocabulary) {
63    $vocabulary = array(
64      'name' => 'Organismos Publicos',
65      'multiple' => 1,
66      'required' => 0,
67      'hierarchy' => 1,
68      'relations' => 0,
69      'module' => 'proyectos_operativos_mcti',
70      'weight' => -10,
71        );
72        taxonomy_save_vocabulary($vocabulary);
73        variable_set('ente_planificador_sector_organismos', $vocabulary['vid']);
74        }
75  //add field sector to table ente planificador
76  db_add_field($ret, 'ente_planificador', 'sector', array(
77    'description' => 'id del sector.',
78    'type' => 'int',
79    'unsigned' => TRUE,
80    'not null' => TRUE,
81    'default' => 0
82  ));
83  db_add_field($ret, 'ente_planificador', 'ambito', array(
84    'description' => 'id del ambito.',
85    'type' => 'int',
86    'unsigned' => TRUE,
87    'not null' => TRUE,
88    'default' => 0
89  ));
90  db_add_field($ret, 'ente_planificador', 'organismo', array(
91    'description' => 'id del organismo publico.',
92    'type' => 'int',
93    'unsigned' => TRUE,
94    'not null' => TRUE,
95    'default' => 0
96  ));
97  db_add_field($ret, 'ente_planificador', 'ente_adscrito', array(
98    'description' => 'id del organismo publico.',
99    'type' => 'int',
100    'unsigned' => TRUE,
101    'not null' => TRUE,
102    'default' => 0
103  ));
104  db_add_field($ret, 'ente_planificador', 'sub_ente', array(
105    'description' => 'id del sub ente.',
106    'type' => 'int',
107    'unsigned' => TRUE,
108    'not null' => TRUE,
109    'default' => 0
110  ));
111  db_add_field($ret, 'ente_user_planificador', 'ambito', array(
112    'description' => 'id del ambito.',
113    'type' => 'int',
114    'unsigned' => TRUE,
115    'not null' => TRUE,
116    'default' => 0
117  ));
118  // Notify content module when this module is uninstalled.
119  drupal_load('module', 'content');
120  content_notify('install', 'ente_planificador_sector');
121  // Set the weight of the ente_planificador_mct.module to 1 so it is loaded after the taxonomy.module.
122  db_query("UPDATE {system} SET weight = 2 WHERE name = 'ente_planificador_sector'");
123}
124
125/*
126 * Implementation of hook_enable()
127 */
128function ente_planificador_sector_enable() {
129  // Notify content module when this module is uninstalled.
130  drupal_load('module', 'content');
131  content_notify('enable', 'ente_planificador_sector');
132}
133
134/*
135 * Implementation of hook_disable()
136 */
137function ente_planificador_sector_disable() {
138  drupal_load('module', 'content');
139  content_notify('disable', 'ente_planificador_sector');
140}
141
142/*
143 * Implementation of hook_uninstall()
144 */
145function ente_planificador_sector_uninstall() {
146  // Load the dependent Taxonomy module, in case it has been disabled.
147  drupal_load('module', 'taxonomy');
148  $vocabulary = variable_get('ente_planificador_sector_Ambitos', 0);
149  taxonomy_del_vocabulary($vocabulary);
150  variable_del('ente_planificador_sector_Ambitos');
151  variable_del('ente_planificador_sector_vocabulary');
152  // Notify content module when this module is uninstalled.
153  drupal_load('module', 'content');
154  content_notify('uninstall', 'ente_planificador_sector');
155  $ret = array();
156  db_drop_field($ret, "ente_planificador", "sector");
157  db_drop_field($ret, "ente_planificador", "ambito");
158  db_drop_field($ret, "ente_planificador", "organismo");
159  db_drop_field($ret, "ente_planificador", "ente_adscrito");
160  db_drop_field($ret, "ente_planificador", "sub_ente");
161  db_drop_field($ret, "ente_user_planificador", "ambito");
162}
Nota: Vea TracBrowser para ayuda de uso del navegador del repositorio.