tripal_organism_base.tpl.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <?php
  2. //$cv = entity_load('trp_vocabulary', array(20, 21, 22));
  3. //$cvterm = entity_load('trp_vocabulary_term', array(489, 44099, 45222, 527));
  4. //$gene = entity_load('trp_SO_0000704', array(3));
  5. //dpm($cv);
  6. //dpm($cvterm);
  7. //dpm($gene);
  8. $organism = $variables['node']->organism;
  9. $organism = chado_expand_var($organism,'field','organism.comment'); ?>
  10. <div class="tripal_organism-data-block-desc tripal-data-block-desc"></div><?php
  11. // generate the image tag
  12. $image = '';
  13. $image_url = tripal_get_organism_image_url($organism);
  14. if ($image_url) {
  15. $image = "<img class=\"tripal-organism-img\" src=\"$image_url\">";
  16. }
  17. // the $headers array is an array of fields to use as the colum headers.
  18. // additional documentation can be found here
  19. // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
  20. // This table for the organism has a vertical header (down the first column)
  21. // so we do not provide headers here, but specify them in the $rows array below.
  22. $headers = array();
  23. // the $rows array contains an array of rows where each row is an array
  24. // of values for each column of the table in that row. Additional documentation
  25. // can be found here:
  26. // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
  27. $rows = array();
  28. // genus row
  29. $rows[] = array(
  30. array(
  31. 'data' => 'Genus',
  32. 'header' => TRUE,
  33. 'width' => '20%',
  34. ),
  35. '<i>' . $organism->genus . '</i>'
  36. );
  37. // species row
  38. $rows[] = array(
  39. array(
  40. 'data' => 'Species',
  41. 'header' => TRUE
  42. ),
  43. '<i>' . $organism->species . '</i>'
  44. );
  45. // common name row
  46. $rows[] = array(
  47. array(
  48. 'data' => 'Common Name',
  49. 'header' => TRUE
  50. ),
  51. $organism->common_name,
  52. );
  53. // abbreviation row
  54. $rows[] = array(
  55. array(
  56. 'data' => 'Abbreviation',
  57. 'header' => TRUE
  58. ),
  59. $organism->abbreviation
  60. );
  61. // allow site admins to see the organism ID
  62. if (user_access('view ids')) {
  63. // Organism ID
  64. $rows[] = array(
  65. array(
  66. 'data' => 'Organism ID',
  67. 'header' => TRUE,
  68. 'class' => 'tripal-site-admin-only-table-row',
  69. ),
  70. array(
  71. 'data' => $organism->organism_id,
  72. 'class' => 'tripal-site-admin-only-table-row',
  73. ),
  74. );
  75. }
  76. // the $table array contains the headers and rows array as well as other
  77. // options for controlling the display of the table. Additional
  78. // documentation can be found here:
  79. // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
  80. $table = array(
  81. 'header' => $headers,
  82. 'rows' => $rows,
  83. 'attributes' => array(
  84. 'id' => 'tripal_organism-table-base',
  85. 'class' => 'tripal-organism-data-table tripal-data-table',
  86. ),
  87. 'sticky' => FALSE,
  88. 'caption' => '',
  89. 'colgroups' => array(),
  90. 'empty' => '',
  91. );
  92. // once we have our table array structure defined, we call Drupal's theme_table()
  93. // function to generate the table.
  94. print theme_table($table); ?>
  95. <div style="text-align: justify"><?php print $image . $organism->comment?></div>