tripal_db.module 4.5 KB

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