tripal_natural_diversity.module 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <?php
  2. require_once('api/tripal_natural_diversity.api.inc');
  3. require_once('includes/tripal_natural_diversity.schema.inc');
  4. /**
  5. * @file
  6. * This file contains the basic functions needed for this drupal module.
  7. * The drupal tripal_natural_diversity module maps directly to the chado X module.
  8. *
  9. * For documentation regarding the Chado X module:
  10. * @see http://gmod.org/wiki/Chado_General_Module
  11. *
  12. * @defgroup tripal_natural_diversity Natural Diversity Module
  13. * @ingroup tripal_modules
  14. */
  15. /*************************************************************************
  16. * Implements hook_views_api()
  17. * Purpose: Essentially this hook tells drupal that there is views support for
  18. * for this module which then includes tripal_natural_diversity.views.inc where all the
  19. * views integration code is
  20. *
  21. * @ingroup tripal_natural_diversity
  22. */
  23. function tripal_natural_diversity_views_api() {
  24. return array(
  25. 'api' => 2.0,
  26. );
  27. }
  28. /**
  29. * Implements hook_theme
  30. *
  31. * @ingroup tripal_natural_diversity
  32. */
  33. function tripal_natural_diversity_theme() {
  34. return array(
  35. 'tripal_feature_nd_genotypes' => array(
  36. 'arguments' => array('node' => NULL),
  37. 'template' => 'tripal_feature_nd_genotypes',
  38. ),
  39. 'tripal_stock_nd_genotypes' => array(
  40. 'arguments' => array('node' => NULL),
  41. 'template' => 'tripal_stock_nd_genotypes',
  42. ),
  43. 'tripal_stock_nd_phenotypes' => array(
  44. 'arguments' => array('node' => NULL),
  45. 'template' => 'tripal_stock_nd_phenotypes',
  46. ),
  47. 'tripal_stock_nd_locations' => array(
  48. 'arguments' => array('node' => NULL),
  49. 'template' => 'tripal_stock_nd_locations',
  50. ),
  51. );
  52. }
  53. /**
  54. * Implements hook_nodeapi().
  55. *
  56. * @ingroup tripal_natural_diversity
  57. */
  58. function tripal_natural_diversity_nodeapi(&$node, $op, $teaser, $page){
  59. switch ($op) {
  60. case 'view':
  61. if ($node->type == 'chado_feature') {
  62. // the tripal_genetic module provides a tripal_feature_genotype
  63. // template. The only difference between them is the addition of
  64. // project information by this module's template. Therefore,
  65. // if the tripal_genetic content is present get rid of as this
  66. // module superceeds it.
  67. if (array_key_exists('tripal_feature_genotypes', $node->content)) {
  68. unset($node->content['tripal_feature_genotypes']);
  69. }
  70. $node->content['tripal_feature_nd_genotypes'] = array(
  71. '#value' => theme('tripal_feature_nd_genotypes', $node),
  72. );
  73. }
  74. if ($node->type == 'chado_stock') {
  75. $node->content['tripal_stock_nd_genotypes'] = array(
  76. '#value' => theme('tripal_stock_nd_genotypes', $node),
  77. );
  78. $node->content['tripal_stock_nd_phenotypes'] = array(
  79. '#value' => theme('tripal_stock_nd_phenotypes', $node),
  80. );
  81. $node->content['tripal_stock_nd_locations'] = array(
  82. '#value' => theme('tripal_stock_nd_locations', $node),
  83. );
  84. }
  85. break;
  86. }
  87. }
  88. /**
  89. *
  90. *
  91. * @ingroup tripal_natural_diversity
  92. */
  93. function tripal_natural_diversity_preprocess_tripal_stock_nd_genotypes(&$variables){
  94. }