tripal_db.module

  1. 2.x tripal_db/tripal_db.module
  2. 3.x legacy/tripal_db/tripal_db.module
  3. 1.x tripal_db/tripal_db.module

General functions for the db module

File

tripal_db/tripal_db.module
View source
  1. <?php
  2. /**
  3. * @file
  4. * General functions for the db module
  5. */
  6. require_once 'api/tripal_db.api.inc';
  7. require_once 'api/tripal_db.DEPRECATED.inc';
  8. require_once 'includes/tripal_db.admin.inc';
  9. /**
  10. * @defgroup tripal_db Database Reference Module
  11. * @ingroup tripal_modules
  12. * @{
  13. * Provides functions for managing chado database references which link chado content, such
  14. * as features and stocks, to records/pages in external databases/websites. For example,
  15. * you might have a feature record in your site which is also in the NCBI website and by
  16. * adding a database refrence to your feature, an automatic link to the content at NCBI
  17. * is created.
  18. * @}
  19. */
  20. /**
  21. * Implements hook_menu().
  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_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_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. (
  80. * Purpose: Adds a help page to the module list
  81. */
  82. function tripal_db_help ($path, $arg) {
  83. if ($path == 'admin/help#tripal_db') {
  84. return theme('tripal_db_help', array());
  85. }
  86. }
  87. /**
  88. * Implements hook_permission().
  89. *
  90. * Set the permission types that the chado module uses. Essentially we
  91. * want permissionis that protect creation, editing and deleting of chado
  92. * data objects
  93. *
  94. * @ingroup tripal_db
  95. */
  96. function tripal_db_permission() {
  97. return array(
  98. 'administer db cross-references' => array(
  99. 'title' => t('Administer External Database Cross-references.'),
  100. 'description' => t('Allows the user to add, edit or delete external databases references stored in the Chado database.'),
  101. ),
  102. );
  103. }
  104. /**
  105. * Implements hook_views_api().
  106. *
  107. * Essentially this hook tells drupal that there is views support for
  108. * for this module which then includes tripal_db.views.inc where all the
  109. * views integration code is
  110. *
  111. * @ingroup tripal_db
  112. */
  113. function tripal_db_views_api() {
  114. return array('api' => 3.0);
  115. }
  116. /**
  117. * Implements hook_theme().
  118. *
  119. * We need to let drupal know about our theme functions and their arguments.
  120. * We create theme functions to allow users of the module to customize the
  121. * look and feel of the output generated in this module
  122. *
  123. * @ingroup tripal_db
  124. */
  125. function tripal_db_theme($existing, $type, $theme, $path) {
  126. $items = array(
  127. 'tripal_db_help' => array(
  128. 'template' => 'tripal_db_help',
  129. 'variables' => array(NULL),
  130. 'path' => "$path/theme/templates"
  131. )
  132. );
  133. return $items;
  134. }