tripal_db.module 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <?php
  2. require_once "api/tripal_db.api.inc";
  3. require_once "includes/tripal_db.admin.inc";
  4. /**
  5. * @defgroup tripal_db Database Reference Module
  6. * @ingroup tripal_modules
  7. * @{
  8. * Provides functions for managing chado database references which link chado content, such
  9. * as features and stocks, to records/pages in external databases/websites. For example,
  10. * you might have a feature record in your site which is also in the NCBI website and by
  11. * adding a database refrence to your feature, an automatic link to the content at NCBI
  12. * is created.
  13. * @}
  14. */
  15. /**
  16. *
  17. * @ingroup tripal_db
  18. */
  19. function tripal_db_init() {
  20. }
  21. /**
  22. *
  23. * @ingroup tripal_db
  24. */
  25. function tripal_db_menu() {
  26. $items = array();
  27. $items['admin/tripal/chado/tripal_db'] = array(
  28. 'title' => 'Databases',
  29. 'description' => 'References to External Database sites such as NCBI',
  30. 'page callback' => 'tripal_db_admin_db_listing',
  31. 'access arguments' => array('administer db cross-references'),
  32. 'type' => MENU_NORMAL_ITEM,
  33. );
  34. $items['admin/tripal/chado/tripal_db/help'] = array(
  35. 'title' => 'Help',
  36. 'description' => "A description of the Tripal Database module including a short description of it's usage.",
  37. 'page callback' => 'theme',
  38. 'page arguments' => array('tripal_db_admin'),
  39. 'access arguments' => array('administer db cross-references'),
  40. 'type' => MENU_LOCAL_TASK,
  41. 'weight' => 10
  42. );
  43. $items['admin/tripal/chado/tripal_db/edit/%'] = array(
  44. 'title' => 'Edit a Database Reference',
  45. 'description' => 'Edit existing Database References.',
  46. 'page callback' => 'drupal_get_form',
  47. 'page arguments' => array('tripal_db_db_edit_form',5),
  48. 'access callback' => 'user_access',
  49. 'access arguments' => array('administer db cross-references'),
  50. 'type' => MENU_CALLBACK,
  51. );
  52. $items['admin/tripal/chado/tripal_db/add'] = array(
  53. 'title' => 'Create a Database Reference',
  54. 'description' => 'Create a new reference to an External Database.',
  55. 'page callback' => 'drupal_get_form',
  56. 'page arguments' => array('tripal_db_db_add_form'),
  57. 'access callback' => 'user_access',
  58. 'access arguments' => array('administer db cross-references'),
  59. 'type' => MENU_CALLBACK,
  60. );
  61. $items['admin/tripal/chado/tripal_db/views/dbs/enable'] = array(
  62. 'title' => 'Enable Database Administrative View',
  63. 'page callback' => 'tripal_views_admin_enable_view',
  64. 'page arguments' => array('tripal_db_admin_dbs', 'admin/tripal/chado/tripal_db'),
  65. 'access arguments' => array('administer db cross-references'),
  66. 'type' => MENU_CALLBACK,
  67. );
  68. $items['admin/tripal/chado/tripal_db/views/dbxrefs/enable'] = array(
  69. 'title' => 'Enable Reference Administrative View',
  70. 'page callback' => 'tripal_views_admin_enable_view',
  71. 'page arguments' => array('tripal_db_admin_dbxrefs', 'admin/tripal/chado/tripal_db'),
  72. 'access arguments' => array('administer db cross-references'),
  73. 'type' => MENU_CALLBACK,
  74. );
  75. return $items;
  76. }
  77. /**
  78. * Implements hook_help()
  79. * Purpose: Adds a help page to the module list
  80. */
  81. function tripal_db_help ($path, $arg) {
  82. if ($path == 'admin/help#tripal_db') {
  83. return theme('tripal_db_help', array());
  84. }
  85. }
  86. /**
  87. * Set the permission types that the chado module uses. Essentially we
  88. * want permissionis that protect creation, editing and deleting of chado
  89. * data objects
  90. *
  91. * @ingroup tripal_db
  92. */
  93. function tripal_db_permission() {
  94. return array(
  95. 'administer db cross-references' => array(
  96. 'title' => t('Administer the list of external databases used for data cross-references.'),
  97. 'description' => t('Allows the user to add, edit or delete databases stored in the Chado database.'),
  98. ),
  99. );
  100. }
  101. /**
  102. * Implements hook_views_api()
  103. * Purpose: Essentially this hook tells drupal that there is views support for
  104. * for this module which then includes tripal_db.views.inc where all the
  105. * views integration code is
  106. *
  107. * @ingroup tripal_db
  108. */
  109. function tripal_db_views_api() {
  110. return array('api' => 2.0);
  111. }
  112. /**
  113. * We need to let drupal know about our theme functions and their arguments.
  114. * We create theme functions to allow users of the module to customize the
  115. * look and feel of the output generated in this module
  116. *
  117. * @ingroup tripal_db
  118. */
  119. function tripal_db_theme($existing, $type, $theme, $path) {
  120. $items = array(
  121. 'tripal_db_help' => array(
  122. 'template' => 'tripal_db_help',
  123. 'variables' => array(NULL),
  124. 'path' => "$path/theme/"
  125. )
  126. );
  127. return $items;
  128. }