tripal_db.module 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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/tripal_db'] = array(
  24. 'title' => 'Databases',
  25. 'description' => 'Basic Description of Tripal DB Module Functionality',
  26. 'page callback' => 'theme',
  27. 'page arguments' => array('tripal_db_admin'),
  28. 'access callback' => 'user_access',
  29. 'access arguments' => array('administer db cross-references'),
  30. 'type' => MENU_NORMAL_ITEM,
  31. );
  32. $items['admin/tripal/tripal_db/edit_db'] = array(
  33. 'title' => 'Edit a Database',
  34. 'description' => 'Manage Databases ',
  35. 'page callback' => 'drupal_get_form',
  36. 'page arguments' => array('tripal_db_db_edit_form'),
  37. 'access callback' => 'user_access',
  38. 'access arguments' => array('administer db cross-references'),
  39. 'type' => MENU_NORMAL_ITEM,
  40. );
  41. $items['admin/tripal/tripal_db/add_db'] = array(
  42. 'title' => 'Add a Database',
  43. 'page callback' => 'drupal_get_form',
  44. 'page arguments' => array('tripal_db_db_add_form'),
  45. 'access callback' => 'user_access',
  46. 'access arguments' => array('administer db cross-references'),
  47. 'type' => MENU_NORMAL_ITEM,
  48. );
  49. return $items;
  50. }
  51. /**
  52. * Set the permission types that the chado module uses. Essentially we
  53. * want permissionis that protect creation, editing and deleting of chado
  54. * data objects
  55. *
  56. * @ingroup tripal_db
  57. */
  58. function tripal_db_permission() {
  59. return array(
  60. 'administer db cross-references' => array(
  61. 'title' => t('Administer the list of external databases used for data cross-references.'),
  62. 'description' => t('Allows the user to add, edit or delete databases stored in the Chado database.'),
  63. ),
  64. );
  65. }
  66. /**
  67. * Implements hook_views_api()
  68. * Purpose: Essentially this hook tells drupal that there is views support for
  69. * for this module which then includes tripal_db.views.inc where all the
  70. * views integration code is
  71. *
  72. * @ingroup tripal_db
  73. */
  74. function tripal_db_views_api() {
  75. return array('api' => 2.0);
  76. }
  77. /**
  78. * We need to let drupal know about our theme functions and their arguments.
  79. * We create theme functions to allow users of the module to customize the
  80. * look and feel of the output generated in this module
  81. *
  82. * @ingroup tripal_db
  83. */
  84. function tripal_db_theme() {
  85. return array(
  86. 'tripal_db_admin' => array(
  87. 'template' => 'tripal_db_admin',
  88. 'arguments' => array(NULL),
  89. 'path' => drupal_get_path('module', 'tripal_db') . '/theme',
  90. ),
  91. );
  92. }