tripal_natural_diversity.install 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <?php
  2. /**
  3. * @file
  4. * Implements hooks from the Schema API
  5. */
  6. /**
  7. * Implements hook_disable().
  8. * Disable default views when module is disabled
  9. *
  10. * @ingroup tripal_legacy_natural_diversity
  11. */
  12. function tripal_natural_diversity_disable() {
  13. // Disable all default views provided by this module
  14. require_once("tripal_natural_diversity.views_default.inc");
  15. $views = tripal_natural_diversity_views_default_views();
  16. foreach (array_keys($views) as $view_name) {
  17. tripal_disable_view($view_name,FALSE,array('suppress_error' => TRUE));
  18. }
  19. }
  20. /**
  21. * Implementation of hook_requirements().
  22. *
  23. * @ingroup tripal_legacy_natural_diversity
  24. */
  25. function tripal_natural_diversity_requirements($phase) {
  26. $requirements = array();
  27. if ($phase == 'install') {
  28. // make sure chado is installed
  29. if (!$GLOBALS["chado_is_installed"]) {
  30. $requirements ['tripal_natural_diversity'] = array(
  31. 'title' => "tripal_natural_diversity",
  32. 'value' => "ERROR: Chado must be installed before this module can be enabled",
  33. 'severity' => REQUIREMENT_ERROR,
  34. );
  35. }
  36. }
  37. return $requirements;
  38. }
  39. /**
  40. * Implementation of hook_install().
  41. *
  42. * @ingroup tripal_legacy_natural_diversity
  43. */
  44. function tripal_natural_diversity_install() {
  45. // add cvterms
  46. tripal_natural_diversity_add_cvterms();
  47. }
  48. /**
  49. * Implementation of hook_uninstall().
  50. *
  51. * @ingroup tripal_legacy_natural_diversity
  52. */
  53. function tripal_natural_diversity_uninstall() {
  54. }
  55. /**
  56. * Add cvterms related to natural diversity
  57. *
  58. * @ingroup tripal_legacy_natural_diversity
  59. */
  60. function tripal_natural_diversity_add_cvterms(){
  61. // add cvterms for the nd_experiment_types
  62. tripal_insert_cvterm(
  63. array(
  64. 'name' => 'Genotyping',
  65. 'definition' => 'An experiment where genotypes of individuals are identified.',
  66. 'cv_name' => 'nd_experiment_types',
  67. 'is_relationship' => 0,
  68. 'db_name' => 'tripal'
  69. ),
  70. array('update_existing' => TRUE)
  71. );
  72. tripal_insert_cvterm(
  73. array(
  74. 'name' => 'Phenotyping',
  75. 'definition' => 'An experiment where phenotypes of individuals are identified.',
  76. 'cv_name' => 'nd_experiment_types',
  77. 'is_relationship' => 0,
  78. 'db_name' => 'tripal'
  79. ),
  80. array('update_existing' => TRUE)
  81. );
  82. tripal_insert_cvterm(
  83. array(
  84. 'name' => 'Location',
  85. 'definition' => 'The name of the location.',
  86. 'cv_name' => 'nd_geolocation_property',
  87. 'is_relationship' => 0,
  88. 'db_name' => 'tripal'
  89. ),
  90. array('update_existing' => TRUE)
  91. );
  92. }