tripal_natural_diversity.module 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. /*************************************************************************
  13. * Implements hook_views_api()
  14. * Purpose: Essentially this hook tells drupal that there is views support for
  15. * for this module which then includes tripal_natural_diversity.views.inc where all the
  16. * views integration code is
  17. */
  18. function tripal_natural_diversity_views_api() {
  19. return array(
  20. 'api' => 2.0,
  21. );
  22. }
  23. /**
  24. * Implements hook_theme
  25. */
  26. function tripal_natural_diversity_theme() {
  27. return array(
  28. 'tripal_feature_nd_genotypes' => array(
  29. 'arguments' => array('node' => NULL),
  30. 'template' => 'tripal_feature_nd_genotypes',
  31. ),
  32. 'tripal_stock_nd_genotypes' => array(
  33. 'arguments' => array('node' => NULL),
  34. 'template' => 'tripal_stock_nd_genotypes',
  35. ),
  36. 'tripal_stock_nd_phenotypes' => array(
  37. 'arguments' => array('node' => NULL),
  38. 'template' => 'tripal_stock_nd_phenotypes',
  39. ),
  40. 'tripal_stock_nd_locations' => array(
  41. 'arguments' => array('node' => NULL),
  42. 'template' => 'tripal_stock_nd_locations',
  43. ),
  44. );
  45. }
  46. /*
  47. *
  48. */
  49. function tripal_natural_diversity_nodeapi(&$node, $op, $teaser, $page){
  50. switch ($op) {
  51. case 'view':
  52. if ($node->type == 'chado_feature') {
  53. // the tripal_genetic module provides a tripal_feature_genotype
  54. // template. The only difference between them is the addition of
  55. // project information by this module's template. Therefore,
  56. // if the tripal_genetic content is present get rid of as this
  57. // module superceeds it.
  58. if (array_key_exists('tripal_feature_genotypes', $node->content)) {
  59. unset($node->content['tripal_feature_genotypes']);
  60. }
  61. $node->content['tripal_feature_nd_genotypes'] = array(
  62. '#value' => theme('tripal_feature_nd_genotypes', $node),
  63. );
  64. }
  65. if ($node->type == 'chado_stock') {
  66. $node->content['tripal_stock_nd_genotypes'] = array(
  67. '#value' => theme('tripal_stock_nd_genotypes', $node),
  68. );
  69. $node->content['tripal_stock_nd_phenotypes'] = array(
  70. '#value' => theme('tripal_stock_nd_phenotypes', $node),
  71. );
  72. $node->content['tripal_stock_nd_locations'] = array(
  73. '#value' => theme('tripal_stock_nd_locations', $node),
  74. );
  75. }
  76. break;
  77. }
  78. }
  79. /*
  80. *
  81. */
  82. function tripal_natural_diversity_preprocess_tripal_stock_nd_genotypes(&$variables){
  83. }