123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- <?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 project manamgenet module allows you to sync data in a chado/Tripal instance with
- * multiple project/mysql instances as well as manage and create such project instances
- */
- /**
- * Implementation of hook_install().
- */
- function tripal_pub_install() {
-
- // create the module's data directory
- tripal_create_moddir('tripal_pub');
- // install the tripal_oub
- drupal_install_schema('tripal_pub');
-
- // add any cvterms we need for this module
- tripal_pub_add_cvterms();
- }
- /*
- *
- *
- */
- function tripal_pub_add_cvterms(){
-
- tripal_cv_add_cvterm(array('name' => 'abstract', 'def' => 'Publication abstract'),
- 'tripal_pub', 0, 1, 'tripal');
- }
- /**
- * Implementation of hook_uninstall().
- */
- function tripal_pub_uninstall() {
- //Remove tables
- drupal_uninstall_schema('tripal_pub');
- }
- /**
- * Implementation of hook_schema().
- */
- function tripal_pub_schema() {
-
- $schema['chado_pub'] = 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),
- 'pub_id' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
- 'sync_date' => array('type' => 'int', 'not null' => FALSE, 'description' => 'UNIX integer sync date/time'),
- ),
- 'indexes' => array(
- 'pub_id' => array('pub_id')
- ),
- 'unique keys' => array(
- 'nid_vid' => array('nid', 'vid'),
- 'vid' => array('vid')
- ),
- 'primary key' => array('nid'),
- );
- /*
- //a intfield, not null and project_id is the unique_id of the project in chado
- 'pubmed_id' => array(
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => FALSE,
- ),
- 'author' => array(
- 'type' => 'text',
- 'size' => 'normal',
- 'not null' => TRUE,
- 'default' => '',
- 'description' => 'The Author Name.',
- ),*/
- return $schema;
- }
- /**
- * Implementation of hook_requirements().
- */
- function tripal_pub_requirements($phase) {
- $requirements = array();
- if ($phase == 'install') {
- // make sure chado is installed
- if (!tripal_core_is_chado_installed()) {
- $requirements ['tripal_pub'] = array(
- 'title' => "tripal_pub",
- 'value' => "ERROR: Chado most be installed before this module can be enabled",
- 'severity' => REQUIREMENT_ERROR,
- );
- }
- }
- return $requirements;
- }
|