tripal_feature_base.tpl.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <?php
  2. $feature = $variables['node']->feature; ?>
  3. <div class="tripal_feature-info-box-desc tripal-info-box-desc"></div> <?php
  4. // the $headers array is an array of fields to use as the colum headers.
  5. // additional documentation can be found here
  6. // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
  7. // This table for the analysis has a vertical header (down the first column)
  8. // so we do not provide headers here, but specify them in the $rows array below.
  9. $headers = array();
  10. // the $rows array contains an array of rows where each row is an array
  11. // of values for each column of the table in that row. Additional documentation
  12. // can be found here:
  13. // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
  14. $rows = array();
  15. // Name row
  16. $rows[] = array(
  17. array(
  18. 'data' => 'Name',
  19. 'header' => TRUE
  20. ),
  21. $feature->name
  22. );
  23. // Unique Name row
  24. $rows[] = array(
  25. array(
  26. 'data' => 'Unique Name',
  27. 'header' => TRUE
  28. ),
  29. $feature->uniquename
  30. );
  31. // Type row
  32. $rows[] = array(
  33. array(
  34. 'data' => 'Type',
  35. 'header' => TRUE
  36. ),
  37. $feature->type_id->name
  38. );
  39. // Organism row
  40. $organism = $feature->organism_id->genus ." " . $feature->organism_id->species ." (" . $feature->organism_id->common_name .")";
  41. if (property_exists($feature->organism_id, 'nid')) {
  42. $organism = l("<i>" . $feature->organism_id->genus . " " . $feature->organism_id->species . "</i> (" . $feature->organism_id->common_name .")", "node/".$feature->organism_id->nid, array('html' => TRUE));
  43. }
  44. $rows[] = array(
  45. array(
  46. 'data' => 'Organism',
  47. 'header' => TRUE,
  48. ),
  49. $organism
  50. );
  51. // Seqlen row
  52. if($feature->seqlen > 0) {
  53. $rows[] = array(
  54. array(
  55. 'data' => 'Sequence length',
  56. 'header' => TRUE,
  57. ),
  58. $feature->seqlen
  59. );
  60. }
  61. // allow site admins to see the feature ID
  62. if (user_access('access administration pages')) {
  63. // Feature ID
  64. $rows[] = array(
  65. array(
  66. 'data' => 'Feature ID',
  67. 'header' => TRUE,
  68. 'class' => 'tripal-site-admin-only-table-row',
  69. ),
  70. array(
  71. 'data' => $feature->feature_id,
  72. 'class' => 'tripal-site-admin-only-table-row',
  73. ),
  74. );
  75. }
  76. // Is Obsolete Row
  77. if($feature->is_obsolete == TRUE){
  78. $rows[] = array(
  79. array(
  80. 'data' => '<div class="tripal_feature-obsolete">This feature is obsolete</div>',
  81. 'colspan' => 2
  82. ),
  83. );
  84. }
  85. // the $table array contains the headers and rows array as well as other
  86. // options for controlling the display of the table. Additional
  87. // documentation can be found here:
  88. // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
  89. $table = array(
  90. 'header' => $headers,
  91. 'rows' => $rows,
  92. 'attributes' => array(
  93. 'id' => 'tripal_feature-table-base',
  94. ),
  95. 'sticky' => FALSE,
  96. 'caption' => '',
  97. 'colgroups' => array(),
  98. 'empty' => '',
  99. );
  100. // once we have our table array structure defined, we call Drupal's theme_table()
  101. // function to generate the table.
  102. print theme_table($table);