tripal_db.module 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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. return $items;
  58. }
  59. /**
  60. * Implements hook_help()
  61. * Purpose: Adds a help page to the module list
  62. */
  63. function tripal_db_help ($path, $arg) {
  64. if ($path == 'admin/help#tripal_db') {
  65. return theme('tripal_db_help', array());
  66. }
  67. }
  68. /**
  69. * Set the permission types that the chado module uses. Essentially we
  70. * want permissionis that protect creation, editing and deleting of chado
  71. * data objects
  72. *
  73. * @ingroup tripal_db
  74. */
  75. function tripal_db_permission() {
  76. return array(
  77. 'administer db cross-references' => array(
  78. 'title' => t('Administer the list of external databases used for data cross-references.'),
  79. 'description' => t('Allows the user to add, edit or delete databases stored in the Chado database.'),
  80. ),
  81. );
  82. }
  83. /**
  84. * Implements hook_views_api()
  85. * Purpose: Essentially this hook tells drupal that there is views support for
  86. * for this module which then includes tripal_db.views.inc where all the
  87. * views integration code is
  88. *
  89. * @ingroup tripal_db
  90. */
  91. function tripal_db_views_api() {
  92. return array('api' => 2.0);
  93. }
  94. /**
  95. * We need to let drupal know about our theme functions and their arguments.
  96. * We create theme functions to allow users of the module to customize the
  97. * look and feel of the output generated in this module
  98. *
  99. * @ingroup tripal_db
  100. */
  101. function tripal_db_theme() {
  102. $theme_path = drupal_get_path('module', 'tripal_db') . '/theme';
  103. $items = array(
  104. 'tripal_db_help' => array(
  105. 'template' => 'tripal_db_help',
  106. 'arguments' => array(NULL),
  107. 'path' => $theme_path,
  108. ),
  109. );
  110. return $items;
  111. }