tripal_natural_diversity.install 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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_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_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_update_dependencies().
  41. *
  42. * It specifies a list of other modules whose updates must be run prior to
  43. * this one. It also ensures the the Tripal API is in scope for site
  44. * upgrades when tripal_core is disabled.
  45. */
  46. function tripal_natural_diversity_dependencies() {
  47. $dependencies = array();
  48. return $dependencies;
  49. }
  50. /**
  51. * Implementation of hook_install().
  52. *
  53. * @ingroup tripal_natural_diversity
  54. */
  55. function tripal_natural_diversity_install() {
  56. // add cvterms
  57. tripal_natural_diversity_add_cvterms();
  58. }
  59. /**
  60. * Implementation of hook_uninstall().
  61. *
  62. * @ingroup tripal_natural_diversity
  63. */
  64. function tripal_natural_diversity_uninstall() {
  65. }
  66. /**
  67. * Add cvterms related to natural diversity
  68. *
  69. * @ingroup tripal_natural_diversity
  70. */
  71. function tripal_natural_diversity_add_cvterms(){
  72. // add cvterms for the nd_experiment_types
  73. tripal_insert_cvterm(
  74. array(
  75. 'name' => 'Genotyping',
  76. 'definition' => 'An experiment where genotypes of individuals are identified.',
  77. 'cv_name' => 'nd_experiment_types',
  78. 'is_relationship' => 0,
  79. 'db_name' => 'tripal'
  80. ),
  81. array('update_existing' => TRUE)
  82. );
  83. tripal_insert_cvterm(
  84. array(
  85. 'name' => 'Phenotyping',
  86. 'definition' => 'An experiment where phenotypes of individuals are identified.',
  87. 'cv_name' => 'nd_experiment_types',
  88. 'is_relationship' => 0,
  89. 'db_name' => 'tripal'
  90. ),
  91. array('update_existing' => TRUE)
  92. );
  93. tripal_insert_cvterm(
  94. array(
  95. 'name' => 'Location',
  96. 'definition' => 'The name of the location.',
  97. 'cv_name' => 'nd_geolocation_property',
  98. 'is_relationship' => 0,
  99. 'db_name' => 'tripal'
  100. ),
  101. array('update_existing' => TRUE)
  102. );
  103. }