tripal_db.module 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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('theme', 'tripal') . '/css/tripal_db.css');
  15. drupal_add_js(drupal_get_path('theme', 'tripal') . '/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. 'access arguments' => array('administer db cross-references'),
  27. 'type' => MENU_NORMAL_ITEM,
  28. );
  29. $items['admin/tripal/chado/tripal_db/help'] = array(
  30. 'title' => 'Help',
  31. 'description' => "A description of the Tripal Database module including a short description of it's usage.",
  32. 'page callback' => 'theme',
  33. 'page arguments' => array('tripal_db_admin'),
  34. 'access arguments' => array('administer db cross-references'),
  35. 'type' => MENU_NORMAL_ITEM,
  36. 'weight' => 10
  37. );
  38. $items['admin/tripal/chado/tripal_db/edit'] = array(
  39. 'title' => 'Edit a Database Reference',
  40. 'description' => 'Edit existing Database References.',
  41. 'page callback' => 'drupal_get_form',
  42. 'page arguments' => array('tripal_db_db_edit_form'),
  43. 'access callback' => 'user_access',
  44. 'access arguments' => array('administer db cross-references'),
  45. 'type' => MENU_NORMAL_ITEM,
  46. );
  47. $items['admin/tripal/chado/tripal_db/add'] = array(
  48. 'title' => 'Create a Database Reference',
  49. 'description' => 'Create a new reference to an External Database.',
  50. 'page callback' => 'drupal_get_form',
  51. 'page arguments' => array('tripal_db_db_add_form'),
  52. 'access callback' => 'user_access',
  53. 'access arguments' => array('administer db cross-references'),
  54. 'type' => MENU_NORMAL_ITEM,
  55. );
  56. return $items;
  57. }
  58. /**
  59. * Implements hook_help()
  60. * Purpose: Adds a help page to the module list
  61. */
  62. function tripal_db_help ($path, $arg) {
  63. if ($path == 'admin/help#tripal_db') {
  64. return theme('tripal_db_admin', array());
  65. }
  66. }
  67. /**
  68. * Set the permission types that the chado module uses. Essentially we
  69. * want permissionis that protect creation, editing and deleting of chado
  70. * data objects
  71. *
  72. * @ingroup tripal_db
  73. */
  74. function tripal_db_permission() {
  75. return array(
  76. 'administer db cross-references' => array(
  77. 'title' => t('Administer the list of external databases used for data cross-references.'),
  78. 'description' => t('Allows the user to add, edit or delete databases stored in the Chado database.'),
  79. ),
  80. );
  81. }
  82. /**
  83. * Implements hook_views_api()
  84. * Purpose: Essentially this hook tells drupal that there is views support for
  85. * for this module which then includes tripal_db.views.inc where all the
  86. * views integration code is
  87. *
  88. * @ingroup tripal_db
  89. */
  90. function tripal_db_views_api() {
  91. return array('api' => 2.0);
  92. }
  93. /**
  94. * We need to let drupal know about our theme functions and their arguments.
  95. * We create theme functions to allow users of the module to customize the
  96. * look and feel of the output generated in this module
  97. *
  98. * @ingroup tripal_db
  99. */
  100. function tripal_db_theme() {
  101. return array(
  102. 'tripal_db_admin' => array(
  103. 'template' => 'tripal_db_admin',
  104. 'arguments' => array(NULL),
  105. 'path' => drupal_get_path('module', 'tripal_db') . '/theme',
  106. ),
  107. );
  108. }