tripal_natural_diversity.install

  1. 2.x tripal_natural_diversity/tripal_natural_diversity.install
  2. 3.x legacy/tripal_natural_diversity/tripal_natural_diversity.install
  3. 1.x tripal_natural_diversity/tripal_natural_diversity.install

Implements hooks from the Schema API

File

tripal_natural_diversity/tripal_natural_diversity.install
View source
  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. // add cvterms for the nd_experiment_types
  33. tripal_cv_add_cvterm(array('name' => 'Genotyping','def' => 'An experiment where genotypes of individuals are identified.'),
  34. 'nd_experiment_types', 0, 1, 'tripal');
  35. tripal_cv_add_cvterm(array('name' => 'Phenotyping','def' => 'An experiment where phenotypes of individuals are identified.'),
  36. 'nd_experiment_types', 0, 1, 'tripal');
  37. tripal_cv_add_cvterm(array('name' => 'Location','def' => 'The name of the location.'),
  38. 'nd_geolocation_property', 0, 1, 'tripal');
  39. }
  40. /**
  41. * Implementation of hook_uninstall().
  42. */
  43. function tripal_natural_diversity_uninstall() {
  44. }
  45. /**
  46. * Implementation of hook_requirements().
  47. */
  48. function tripal_natural_diversity_requirements($phase) {
  49. $requirements = array();
  50. if ($phase == 'install') {
  51. // make sure chado is installed
  52. if (!tripal_core_is_chado_installed()) {
  53. $requirements ['tripal_natural_diversity'] = array(
  54. 'title' => "tripal_natural_diversity",
  55. 'value' => "ERROR: Chado most be installed before this module can be enabled",
  56. 'severity' => REQUIREMENT_ERROR,
  57. );
  58. }
  59. }
  60. return $requirements;
  61. }