tripal_genetic.module 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. /**
  3. * @file
  4. * This file contains the basic functions needed for this drupal module.
  5. * The drupal tripal_genetic 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. require('api/tripal_genetic.api.inc');
  11. require('includes/tripal_genetic.api.inc');
  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_genetic.views.inc where all the
  16. * views integration code is
  17. */
  18. function tripal_genetic_views_api() {
  19. return array(
  20. 'api' => 2.0,
  21. );
  22. }
  23. function tripal_genetic_theme() {
  24. return array(
  25. 'tripal_feature_genotypes' => array(
  26. 'arguments' => array('node' => NULL),
  27. 'template' => 'tripal_feature_genotypes',
  28. ),
  29. );
  30. }
  31. /**
  32. *
  33. */
  34. function tripal_genetic_nodeapi(&$node, $op, $teaser, $page) {
  35. switch ($op) {
  36. case 'view':
  37. if ($node->type == 'chado_feature') {
  38. if (!isset($node->content['tripal_feature_genotypes'])) {
  39. $node->content['tripal_feature_genotypes'] = array(
  40. '#value' => theme('tripal_feature_genotypes', $node),
  41. );
  42. }
  43. }
  44. }
  45. }
  46. /**
  47. *
  48. */
  49. function tripal_genetic_preprocess_tripal_feature_genotypes(&$variables) {
  50. $feature = $variables['node']->feature;
  51. $variables['tripal_feature']['genotypes'] = tripal_genetic_get_genotypes_by_feature_id($feature->feature_id);
  52. }