tripal_natural_diversity.install 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. /**
  3. * @file
  4. * Implements hooks from the Schema API
  5. */
  6. /**
  7. * Disable default views when module is disabled
  8. */
  9. function tripal_natural_diversity_disable() {
  10. // Disable all default views provided by this module
  11. require_once("tripal_natural_diversity.views_default.inc");
  12. $views = tripal_natural_diversity_views_default_views();
  13. foreach (array_keys($views) as $view_name) {
  14. tripal_views_admin_disable_view($view_name,FALSE,array('suppress_error' => TRUE));
  15. }
  16. }
  17. /**
  18. * Implementation of hook_requirements().
  19. */
  20. function tripal_natural_diversity_requirements($phase) {
  21. $requirements = array();
  22. if ($phase == 'install') {
  23. // make sure chado is installed
  24. if (!$GLOBALS["chado_is_installed"]) {
  25. $requirements ['tripal_natural_diversity'] = array(
  26. 'title' => "tripal_natural_diversity",
  27. 'value' => "ERROR: Chado must be installed before this module can be enabled",
  28. 'severity' => REQUIREMENT_ERROR,
  29. );
  30. }
  31. }
  32. return $requirements;
  33. }
  34. /**
  35. * Implementation of hook_install().
  36. */
  37. function tripal_natural_diversity_install() {
  38. // create the module's data directory
  39. tripal_create_moddir('tripal_natural_diversity');
  40. // add cvterms
  41. tripal_natural_diversity_add_cvterms();
  42. }
  43. /**
  44. * Implementation of hook_uninstall().
  45. */
  46. function tripal_natural_diversity_uninstall() {
  47. }
  48. /*
  49. *
  50. */
  51. function tripal_natural_diversity_add_cvterms(){
  52. // add cvterms for the nd_experiment_types
  53. tripal_cv_add_cvterm(array('name' => 'Genotyping','def' => 'An experiment where genotypes of individuals are identified.'),
  54. 'nd_experiment_types', 0, 1, 'tripal');
  55. tripal_cv_add_cvterm(array('name' => 'Phenotyping','def' => 'An experiment where phenotypes of individuals are identified.'),
  56. 'nd_experiment_types', 0, 1, 'tripal');
  57. tripal_cv_add_cvterm(array('name' => 'Location','def' => 'The name of the location.'),
  58. 'nd_geolocation_property', 0, 1, 'tripal');
  59. }