123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- <?php
- /**
- * @file
- * Handles install, uninstall, disable and enable functionality including database tables.
- *
- * @ingroup tripal_legacy_contact
- */
- /**
- * Implements hook_disable().
- * Disable default views when module is disabled
- *
- * @ingroup tripal_legacy_contact
- */
- function tripal_contact_disable() {
- // Disable all default views provided by this module
- require_once("tripal_contact.views_default.inc");
- $views = tripal_contact_views_default_views();
- foreach (array_keys($views) as $view_name) {
- tripal_disable_view($view_name,FALSE,array('suppress_error' => TRUE));
- }
- }
- /**
- * Implementation of hook_requirements().
- *
- * @ingroup tripal_legacy_contact
- */
- function tripal_contact_requirements($phase) {
- $requirements = array();
- if ($phase == 'install') {
- // make sure chado is installed
- 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;
- }
- /**
- * Implementation of hook_install().
- *
- * @ingroup tripal_legacy_contact
- */
- function tripal_contact_install() {
- // Add cvterms for relationship types.
- tripal_contact_add_cvs();
- tripal_contact_add_cvterms();
- // Set the default vocabularies.
- tripal_set_default_cv('contact', 'type_id', 'tripal_contact');
- tripal_set_default_cv('contactprop', 'type_id', 'tripal_contact');
- tripal_set_default_cv('contact_relationship', 'type_id', 'contact_relationship');
- }
- /**
- * Implementation of hook_uninstall().
- *
- * @ingroup tripal_legacy_contact
- */
- function tripal_contact_uninstall() {
- }
- /**
- * Adds any cvs needed by this module.
- *
- * @ingroup tripal_legacy_contact
- */
- function tripal_contact_add_cvs() {
- // Add the cv for contact properties. This is a default vocabulary in the event
- // that a user does not want to use the tripal_contact vocabulary
- tripal_insert_cv(
- 'contact_property',
- 'Contains properties for contacts. This can be used if the tripal_contact vocabulary (which is default for contacts in Tripal) is not desired.'
- );
- // add the cv for the contact type. This is a default vocabulary in the event
- // that a user does not want to use the tripal_contact vocabulary
- tripal_insert_cv(
- 'contact_type',
- 'Contains types of contacts. This can be used if the tripal_contact vocabulary (which is default for contacts in Tripal) is not desired.'
- );
- // Add the cv for the tripal_contact vocabulary which is loaded via the OBO
- tripal_insert_cv(
- 'tripal_contact',
- 'A heirarchical set of terms for describing a contact. It is intended to be used as the default vocabularies in Tripal for contact types and contact properties.'
- );
- // add the cv for contact relationships
- tripal_insert_cv(
- 'contact_relationship',
- 'Contains types of relationships between contacts.'
- );
- }
- /**
- * Adds any cvterms needed by this module.
- *
- * @ingroup tripal_legacy_contact
- */
- function tripal_contact_add_cvterms() {
- }
- /**
- * Implementation of hook_schema().
- *
- * @ingroup tripal_legacy_contact
- */
- 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;
- }
|