tripal_organism_base.tpl.php 2.6 KB

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