123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250 |
- <?php
- function tripal_contact_disable() {
-
- require_once("tripal_contact.views_default.inc");
- $views = tripal_contact_views_default_views();
- foreach (array_keys($views) as $view_name) {
- tripal_views_admin_disable_view($view_name,FALSE,array('suppress_error' => TRUE));
- }
- }
- function tripal_contact_requirements($phase) {
- $requirements = array();
- if ($phase == 'install') {
-
- if (!$GLOBALS["chado_is_installed"]) {
- $requirements ['tripal_contact'] = array(
- 'title' => "tripal_contact",
- 'value' => "ERROR: Chado must be installed before this module can be enabled",
- 'severity' => REQUIREMENT_ERROR,
- );
- }
- }
- return $requirements;
- }
- function tripal_contact_install() {
-
- tripal_create_files_dir('tripal_contact');
-
- tripal_contact_add_custom_tables();
-
- $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);
-
- tripal_contact_add_cvs();
- tripal_contact_add_cvterms();
-
- }
- function tripal_contact_uninstall() {
-
- }
- function tripal_contact_add_cvs() {
- tripal_cv_add_cv(
- 'contact_relationship_types',
- 'Contains Types of relationships between contacts.'
- );
- }
- function tripal_contact_add_cvterms() {
- }
- 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',
- ),
- ),
- ),
- );
- chado_create_custom_table('contactprop', $schema, TRUE);
- }
- function tripal_contact_update_7000() {
-
-
-
- try {
- $check = db_query("SELECT cv_id FROM chado.cv WHERE name = 'contact_relationship_types'")->fetchObject();
- if (!$check->cv_id) {
- $sql = "INSERT INTO chado.cv (name, definition) VALUES (
- 'contact_relationship_types',
- 'Contains Types of relationships between contacts.')
- ";
- db_query($sql);
- }
- }
- catch (\PDOException $e) {
- $error = $e->getMessage();
- throw new DrupalUpdateException('Failed to add contact_relationship_types vocabulary: '. $error);
- }
- }
|