tripal_db.module 4.3 KB

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