tripal_project.install 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. /**
  3. * @file
  4. * This file contains all the functions which describe and implement drupal database tables
  5. * needed by this module. This module was developed by Chad N.A. Krilow and Lacey-Anne Sanderson,
  6. * University of Saskatchewan.
  7. *
  8. * The project manamgenet module allows you to sync data in a chado/Tripal instance with
  9. * multiple project/mysql instances as well as manage and create such project instances
  10. */
  11. /**
  12. * Implementation of hook_requirements().
  13. *
  14. */
  15. function tripal_project_requirements($phase) {
  16. $requirements = array();
  17. if ($phase == 'install') {
  18. // make sure chado is installed
  19. if (!tripal_core_is_chado_installed()) {
  20. $requirements ['tripal_project'] = array(
  21. 'title' => "tripal_project",
  22. 'value' => "ERROR: Chado most be installed before this module can be enabled",
  23. 'severity' => REQUIREMENT_ERROR,
  24. );
  25. }
  26. }
  27. return $requirements;
  28. }
  29. /**
  30. * Implementation of hook_install().
  31. */
  32. function tripal_project_install() {
  33. // create the module's data directory
  34. tripal_create_moddir('tripal_project');
  35. tripal_project_add_cvterms();
  36. }
  37. /**
  38. * Implementation of hook_uninstall().
  39. */
  40. function tripal_project_uninstall() {
  41. }
  42. /**
  43. * Implementation of hook_schema().
  44. */
  45. function tripal_project_schema() {
  46. $schema['chado_project'] = array(
  47. 'fields' => array(
  48. 'nid' => array(
  49. 'type' => 'int',
  50. 'unsigned' => TRUE,
  51. 'not null' => TRUE,
  52. ),
  53. 'vid' => array(
  54. 'type' => 'int',
  55. 'not null' => TRUE,
  56. ),
  57. 'project_id' => array(
  58. 'type' => 'int',
  59. 'unsigned' => TRUE,
  60. 'not null' => TRUE,
  61. ),
  62. ),
  63. 'primary key' => array('nid', 'vid', 'project_id'),
  64. );
  65. return $schema;
  66. }
  67. /*
  68. *
  69. */
  70. function tripal_project_add_cvterms() {
  71. // Insert cvterm 'library_description' into cvterm table of chado
  72. // database. This CV term is used to keep track of the library
  73. // description in the libraryprop table.
  74. tripal_cv_add_cvterm(array('name' => 'project_description', 'def' => 'Description of a project'),
  75. 'tripal', 0, 1, 'tripal');
  76. }