'Ambitos', 'multiple' => 1, 'required' => 0, 'hierarchy' => 1, 'relations' => 0, 'module' => 'ente_planificador_sector', 'weight' => -10, ); taxonomy_save_vocabulary($vocabulary); variable_set('ente_planificador_sector_Ambitos', $vocabulary['vid']); $names = array( 'Social', 'Político-institucional', 'Económico', 'Territorial e Internacional', ); foreach ($names as $id => $name) { $term = array( 'vid' => $vocabulary['vid'], // Voacabulary ID 'name' => $name, // Term Name ); taxonomy_save_term($term); } } $vocabulary = 0; $vocabulary = taxonomy_vocabulary_load(variable_get('ente_planificador_sector_organismos', 0)); if (!$vocabulary) { $vocabulary = array( 'name' => 'Organismos Publicos', 'multiple' => 1, 'required' => 0, 'hierarchy' => 1, 'relations' => 0, 'module' => 'proyectos_operativos_mcti', 'weight' => -10, ); taxonomy_save_vocabulary($vocabulary); variable_set('ente_planificador_sector_organismos', $vocabulary['vid']); } //add field sector to table ente planificador db_add_field($ret, 'ente_planificador', 'sector', array( 'description' => 'id del sector.', 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0 )); db_add_field($ret, 'ente_planificador', 'ambito', array( 'description' => 'id del ambito.', 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0 )); db_add_field($ret, 'ente_planificador', 'organismo', array( 'description' => 'id del organismo publico.', 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0 )); db_add_field($ret, 'ente_planificador', 'ente_adscrito', array( 'description' => 'id del organismo publico.', 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0 )); db_add_field($ret, 'ente_planificador', 'sub_ente', array( 'description' => 'id del sub ente.', 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0 )); db_add_field($ret, 'ente_user_planificador', 'ambito', array( 'description' => 'id del ambito.', 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0 )); // Notify content module when this module is uninstalled. drupal_load('module', 'content'); content_notify('install', 'ente_planificador_sector'); // Set the weight of the ente_planificador_mct.module to 1 so it is loaded after the taxonomy.module. db_query("UPDATE {system} SET weight = 2 WHERE name = 'ente_planificador_sector'"); } /* * Implementation of hook_enable() */ function ente_planificador_sector_enable() { // Notify content module when this module is uninstalled. drupal_load('module', 'content'); content_notify('enable', 'ente_planificador_sector'); } /* * Implementation of hook_disable() */ function ente_planificador_sector_disable() { drupal_load('module', 'content'); content_notify('disable', 'ente_planificador_sector'); } /* * Implementation of hook_uninstall() */ function ente_planificador_sector_uninstall() { // Load the dependent Taxonomy module, in case it has been disabled. drupal_load('module', 'taxonomy'); $vocabulary = variable_get('ente_planificador_sector_Ambitos', 0); taxonomy_del_vocabulary($vocabulary); variable_del('ente_planificador_sector_Ambitos'); variable_del('ente_planificador_sector_vocabulary'); // Notify content module when this module is uninstalled. drupal_load('module', 'content'); content_notify('uninstall', 'ente_planificador_sector'); $ret = array(); db_drop_field($ret, "ente_planificador", "sector"); db_drop_field($ret, "ente_planificador", "ambito"); db_drop_field($ret, "ente_planificador", "organismo"); db_drop_field($ret, "ente_planificador", "ente_adscrito"); db_drop_field($ret, "ente_planificador", "sub_ente"); db_drop_field($ret, "ente_user_planificador", "ambito"); }