tripal_natural_diversity.install 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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_cv_add_cvterm(array('name' => 'Genotyping','def' => 'An experiment where genotypes of individuals are identified.'),
  65. 'nd_experiment_types', 0, 1, 'tripal');
  66. tripal_cv_add_cvterm(array('name' => 'Phenotyping','def' => 'An experiment where phenotypes of individuals are identified.'),
  67. 'nd_experiment_types', 0, 1, 'tripal');
  68. tripal_cv_add_cvterm(array('name' => 'Location','def' => 'The name of the location.'),
  69. 'nd_geolocation_property', 0, 1, 'tripal');
  70. }