| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 | 
							- <?php
 
- /**
 
-  * @file
 
-  * @todo Add file header description
 
-  */
 
- /**
 
-  * Implementation of hook_install().
 
-  *
 
-  * @ingroup tripal_featuremap
 
-  */
 
- function tripal_featuremap_install() {
 
-   // create the module's data directory
 
-   tripal_create_moddir('tripal_featuremap');
 
-   // create the tables that correlate drupal nodes with chado
 
-   // features, maps, etc....
 
-   drupal_install_schema('tripal_featuremap');
 
- }
 
- /**
 
-  * Implementation of hook_schema().
 
-  *
 
-  * @ingroup tripal_featuremap
 
-  */
 
- function tripal_featuremap_schema() {
 
-   $schema = tripal_featuremap_get_schemas();
 
-   return $schema;
 
- }
 
- /**
 
-  * Implementation of hook_uninstall().
 
-  *
 
-  * @ingroup tripal_featuremap
 
-  */
 
- function tripal_featuremap_uninstall() {
 
-   drupal_uninstall_schema('tripal_featuremap');
 
-   // Get the list of nodes to remove
 
-   $sql_lib_id = "SELECT nid, vid ".
 
-                 "FROM {node} ".
 
-                 "WHERE type='chado_featuremap'";
 
-   $result = db_query($sql_lib_id);
 
-   while ($node = db_fetch_object($result)) {
 
-     node_delete($node->nid);
 
-   }
 
- }
 
- /**
 
-  * This function simply defines all tables needed for the module to work
 
-  * correctly.  By putting the table definitions in a separate function we
 
-  * can easily provide the entire list for hook_install or individual
 
-  * tables for an update.
 
-  *
 
-  * @ingroup tripal_featuremap
 
-  */
 
- function tripal_featuremap_get_schemas() {
 
-   $schema = array();
 
-   $schema['chado_featuremap'] = array(
 
-     'fields' => array(
 
-       'vid' => array(
 
-         'type' => 'int',
 
-         'unsigned' => TRUE,
 
-         'not null' => TRUE,
 
-         'default' => 0
 
-       ),
 
-       'nid' => array(
 
- 	      'type' => 'int',
 
- 	      'unsigned' => TRUE,
 
- 	      'not null' => TRUE,
 
- 	      'default' => 0
 
-       ),
 
- 	    'featuremap_id' => array(
 
- 	      'type' => 'int',
 
- 	      'not null' => TRUE,
 
- 	      'default' => 0
 
- 	      )
 
-       ),
 
- 	    'indexes' => array(
 
- 	      'featuremap_id' => array('featuremap_id')
 
- 	    ),
 
- 	    'unique keys' => array(
 
- 	      'nid_vid' => array('nid', 'vid'),
 
- 	      'vid' => array('vid')
 
- 	    ),
 
- 	    'primary key' => array('nid'),
 
-   );
 
-   return $schema;
 
- }
 
- /**
 
-  * Implementation of hook_requirements(). 
 
-  */
 
- function tripal_featuremap_requirements($phase) {
 
-   $requirements = array();
 
-   if ($phase == 'install') {
 
-     // make sure chado is installed
 
-     if (!tripal_core_is_chado_installed()) {
 
-       $requirements ['tripal_featuremap'] = array(
 
-             'title' => "tripal_featuremap",
 
-             'value' => "ERROR: Chado most be installed before this module can be enabled",
 
-             'severity' => REQUIREMENT_ERROR,
 
-       );
 
-     }
 
-   }
 
-   return $requirements;
 
- }
 
 
  |