tripal_natural_diversity.install 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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_install().
  41. *
  42. * @ingroup tripal_natural_diversity
  43. */
  44. function tripal_natural_diversity_install() {
  45. // create the module's data directory
  46. tripal_create_files_dir('tripal_natural_diversity');
  47. // add cvterms
  48. tripal_natural_diversity_add_cvterms();
  49. }
  50. /**
  51. * Implementation of hook_uninstall().
  52. *
  53. * @ingroup tripal_natural_diversity
  54. */
  55. function tripal_natural_diversity_uninstall() {
  56. }
  57. /**
  58. * Add cvterms related to natural diversity
  59. *
  60. * @ingroup tripal_natural_diversity
  61. */
  62. function tripal_natural_diversity_add_cvterms(){
  63. // add cvterms for the nd_experiment_types
  64. tripal_insert_cvterm(
  65. array(
  66. 'name' => 'Genotyping',
  67. 'definition' => 'An experiment where genotypes of individuals are identified.',
  68. 'cv_name' => 'nd_experiment_types',
  69. 'is_relationship' => 0,
  70. 'db_name' => 'tripal'
  71. ),
  72. array('update_existing' => TRUE)
  73. );
  74. tripal_insert_cvterm(
  75. array(
  76. 'name' => 'Phenotyping',
  77. 'definition' => 'An experiment where phenotypes of individuals are identified.',
  78. 'cv_name' => 'nd_experiment_types',
  79. 'is_relationship' => 0,
  80. 'db_name' => 'tripal'
  81. ),
  82. array('update_existing' => TRUE)
  83. );
  84. tripal_insert_cvterm(
  85. array(
  86. 'name' => 'Location',
  87. 'definition' => 'The name of the location.',
  88. 'cv_name' => 'nd_geolocation_property',
  89. 'is_relationship' => 0,
  90. 'db_name' => 'tripal'
  91. ),
  92. array('update_existing' => TRUE)
  93. );
  94. }