| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156 | <?php/** * @file * This file contains all the functions which describe and implement drupal database tables * needed by this module. This module was developed by Chad N.A. Krilow and Lacey-Anne Sanderson, * University of Saskatchewan. * * The contact manamgenet module allows you to sync data in a chado/Tripal instance with * multiple contact/mysql instances as well as manage and create such contact instances *//** * Implementation of hook_requirements(). * */function tripal_contact_requirements($phase) {  $requirements = array();  if ($phase == 'install') {    // make sure chado is installed    if (!tripal_core_is_chado_installed()) {      $requirements ['tripal_contact'] = array(        'title' => "tripal_contact",        'value' => "ERROR: Chado most be installed before this module can be enabled",        'severity' => REQUIREMENT_ERROR,      );    }  }  return $requirements;}/** * Implementation of hook_install(). */function tripal_contact_install() {		// create the module's data directory  tripal_create_moddir('tripal_contact');    // add the contactprop table to Chado  tripal_contact_add_custom_tables();    // add loading of the the tripal contact ontology to the job queue  $obo_path = drupal_realpath(drupal_get_path('module', 'tripal_contact') . '/files/tcontact.obo');  $obo_id = tripal_cv_add_obo_ref('Tripal Contacts', $obo_path);  tripal_cv_submit_obo_job($obo_id);}/** * Implementation of hook_uninstall(). */function tripal_contact_uninstall() {}/** * Implementation of hook_schema(). */function tripal_contact_schema() {  $schema['chado_contact'] = 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      ),      'contact_id' => array(        'type' => 'int',        'not null' => TRUE,        'default' => 0      )    ),    'indexes' => array(      'contact_id' => array('contact_id')    ),    'unique keys' => array(      'nid_vid' => array('nid', 'vid'),      'vid' => array('vid')    ),    'primary key' => array('nid'),  );  return $schema;}/* *  */function tripal_contact_add_custom_tables(){  $schema = array (    'table' => 'contactprop',    'fields' => array (      'contactprop_id' => array (        'type' => 'serial',        'not null' => true,      ),      'contact_id' => array (        'type' => 'int',        'not null' => true,      ),      'type_id' => array (        'type' => 'int',        'not null' => true,      ),      'value' => array (        'type' => 'text',        'not null' => false,      ),      'rank' => array (        'type' => 'int',        'not null' => true,        'default' => 0,      ),    ),    'primary key' => array (      0 => 'contactprop_id',    ),    'unique keys' => array (      'contactprop_c1' => array (        0 => 'contact_id',        1 => 'type_id',        2 => 'rank',      ),    ),    'indexes' => array (      'contactprop_idx1' => array (        0 => 'contact_id',      ),      'contactprop_idx2' => array (        0 => 'type_id',      ),    ),    'foreign keys' => array (      'cvterm' => array (        'table' => 'cvterm',        'columns' => array (          'type_id' => 'cvterm_id',        ),      ),      'contact' => array (        'table' => 'contact',        'columns' => array (          'contact_id' => 'contact_id',        ),      ),    ),  );  tripal_core_create_custom_table('contactprop', $schema, TRUE);}
 |