tripal_phenotype.module 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <?php
  2. /**
  3. * @file
  4. * This file contains the basic functions needed for this drupal module.
  5. * The drupal tripal_phenotype module maps directly to the chado X module.
  6. *
  7. * For documentation regarding the Chado X module:
  8. * @see http://gmod.org/wiki/Chado_General_Module
  9. *
  10. * @defgroup tripal_phenotype Phenotype Module
  11. * @ingroup tripal_modules
  12. */
  13. /**
  14. * Menu items are automatically added for the new node types created
  15. * by this module to the 'Create Content' Navigation menu item. This function
  16. * adds more menu items needed for this module.
  17. *
  18. * @ingroup tripal_phenotype
  19. */
  20. function tripal_phenotype_menu() {
  21. $items = array();
  22. // the administative settings menu
  23. $items['admin/tripal/chado/tripal_phenotype'] = array(
  24. 'title' => 'Phenotypes',
  25. 'description' => 'A controlled sentence describing observable effects of non-wild type function.',
  26. 'page callback' => 'tripal_phenotype_admin_phenotypes_listing',
  27. 'access arguments' => array('adminster tripal phenotype'),
  28. 'type' => MENU_NORMAL_ITEM,
  29. );
  30. $items['admin/tripal/chado/tripal_phenotype/help'] = array(
  31. 'title' => 'Help',
  32. 'description' => "A description of the Tripal phenotype module including a short description of it's usage.",
  33. 'page callback' => 'theme',
  34. 'page arguments' => array('tripal_phenotype_help'),
  35. 'access arguments' => array('adminster tripal phenotype'),
  36. 'type' => MENU_LOCAL_TASK,
  37. );
  38. $items['admin/tripal/chado/tripal_phenotype/views/phenotypes/enable'] = array(
  39. 'title' => 'Enable Phenotype Administrative View',
  40. 'page callback' => 'tripal_views_admin_enable_view',
  41. 'page arguments' => array('tripal_phenotype_admin_phenotypes', 'admin/tripal/chado/tripal_phenotype'),
  42. 'access arguments' => array('administer tripal_bulk_loader'),
  43. 'type' => MENU_CALLBACK,
  44. );
  45. return $items;
  46. }
  47. /**
  48. * We need to let drupal know about our theme functions and their arguments.
  49. * We create theme functions to allow users of the module to customize the
  50. * look and feel of the output generated in this module
  51. *
  52. * @ingroup tripal_phenotype
  53. */
  54. function tripal_phenotype_theme($existing, $type, $theme, $path) {
  55. $core_path = drupal_get_path('module', 'tripal_core');
  56. $items = array(
  57. 'tripal_phenotype_help' => array(
  58. 'template' => 'tripal_phenotype_help',
  59. 'variables' => array(NULL),
  60. 'path' => "$path/theme",
  61. ),
  62. );
  63. return $items;
  64. }
  65. /**
  66. * Implements hook_views_api()
  67. * Purpose: Essentially this hook tells drupal that there is views support for
  68. * for this module which then includes tripal_phenotype.views.inc where all the
  69. * views integration code is
  70. *
  71. * @ingroup tripal_phenotype
  72. */
  73. function tripal_phenotype_views_api() {
  74. return array(
  75. 'api' => 3.0,
  76. );
  77. }
  78. function tripal_phenotype_admin_phenotypes_listing() {
  79. $output = '';
  80. // set the breadcrumb
  81. $breadcrumb = array();
  82. $breadcrumb[] = l('Home', '<front>');
  83. $breadcrumb[] = l('Administration', 'admin');
  84. $breadcrumb[] = l('Tripal', 'admin/tripal');
  85. $breadcrumb[] = l('Chado', 'admin/tripal/chado');
  86. $breadcrumb[] = l('Phenotypes', 'admin/tripal/chado/tripal_phenotype');
  87. drupal_set_breadcrumb($breadcrumb);
  88. // Add the view
  89. $view = views_embed_view('tripal_phenotype_admin_phenotypes','default');
  90. if (isset($view)) {
  91. $output .= $view;
  92. }
  93. else {
  94. $output .= '<p>The Tripal Phenotype Module uses primarily views to provide an '
  95. . 'administrative interface. Currently one or more views needed for this '
  96. . 'administrative interface are disabled. <strong>Click each of the following links to '
  97. . 'enable the pertinent views</strong>:</p>';
  98. $output .= '<ul>';
  99. $output .= '<li>'.l('Phenotype Admin', 'admin/tripal/chado/tripal_phenotype/views/phenotypes/enable').'</li>';
  100. $output .= '</ul>';
  101. }
  102. return $output;
  103. }