tripal_natural_diversity.install 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. /**
  3. * @file
  4. * Implements hooks from the Schema API
  5. */
  6. /**
  7. * Implementation of hook_install().
  8. */
  9. function tripal_natural_diversity_install() {
  10. // create the module's data directory
  11. tripal_create_moddir('tripal_natural_diversity');
  12. // add cvterms
  13. tripal_natural_diversity_add_cvterms();
  14. }
  15. /**
  16. * Update for Drupal 6.x, Tripal 1.1, Natural Diversity Module 1.1
  17. * This update adds new cvterms for experiment types
  18. *
  19. */
  20. function tripal_natural_diversity_update_6100() {
  21. // add cvterms
  22. tripal_natural_diversity_add_cvterms();
  23. $ret = array(
  24. '#finished' => 1,
  25. );
  26. return $ret;
  27. }
  28. /*
  29. *
  30. */
  31. function tripal_natural_diversity_add_cvterms(){
  32. tripal_cv_add_cv('nd_experiment_types', 'Terms for defining the natural diversity experiment types for the chado.nd_experiment table.');
  33. // add cvterms for the nd_experiment_types
  34. tripal_cv_add_cvterm(array('name' => 'Genotyping','def' => 'An experiment where genotypes of individuals are identified.'),
  35. 'nd_experiment_types', 0, 1, 'tripal');
  36. tripal_cv_add_cvterm(array('name' => 'Phenotyping','def' => 'An experiment where phenotypes of individuals are identified.'),
  37. 'nd_experiment_types', 0, 1, 'tripal');
  38. }
  39. /**
  40. * Implementation of hook_uninstall().
  41. */
  42. function tripal_natural_diversity_uninstall() {
  43. }
  44. /**
  45. * Implementation of hook_requirements().
  46. */
  47. function tripal_natural_diversity_requirements($phase) {
  48. $requirements = array();
  49. if ($phase == 'install') {
  50. // make sure chado is installed
  51. if (!tripal_core_is_chado_installed()) {
  52. $requirements ['tripal_natural_diversity'] = array(
  53. 'title' => "tripal_natural_diversity",
  54. 'value' => "ERROR: Chado most be installed before this module can be enabled",
  55. 'severity' => REQUIREMENT_ERROR,
  56. );
  57. }
  58. }
  59. return $requirements;
  60. }