tripal_feature_base.tpl.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <?php
  2. $feature = $variables['node']->feature; ?>
  3. <div id="tripal_feature-base-box" class="tripal_feature-info-box tripal-info-box">
  4. <div class="tripal_feature-info-box-title tripal-info-box-title">Details</div>
  5. <div class="tripal_feature-info-box-desc tripal-info-box-desc"></div> <?php
  6. // the $headers array is an array of fields to use as the colum headers.
  7. // additional documentation can be found here
  8. // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
  9. // This table for the analysis has a vertical header (down the first column)
  10. // so we do not provide headers here, but specify them in the $rows array below.
  11. $headers = array();
  12. // the $rows array contains an array of rows where each row is an array
  13. // of values for each column of the table in that row. Additional documentation
  14. // can be found here:
  15. // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
  16. $rows = array();
  17. // Name row
  18. $rows[] = array(
  19. array(
  20. 'data' => 'Name',
  21. 'header' => TRUE
  22. ),
  23. $feature->name
  24. );
  25. // Unique Name row
  26. $rows[] = array(
  27. array(
  28. 'data' => 'Unique Name',
  29. 'header' => TRUE
  30. ),
  31. $feature->uniquename
  32. );
  33. // Type row
  34. $rows[] = array(
  35. array(
  36. 'data' => 'Type',
  37. 'header' => TRUE
  38. ),
  39. $feature->type_id->name
  40. );
  41. // Organism row
  42. if ($feature->organism_id->nid) {
  43. $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));
  44. }
  45. else {
  46. $organism = $feature->organism_id->genus ." " . $feature->organism_id->species ." (" .$feature->organism_id->common_name .")";
  47. }
  48. $rows[] = array(
  49. array(
  50. 'data' => 'Organism',
  51. 'header' => TRUE
  52. ),
  53. $organism
  54. );
  55. // Seqlen row
  56. if($feature->seqlen > 0) {
  57. $rows[] = array(
  58. array(
  59. 'data' => 'Sequence length',
  60. 'header' => TRUE
  61. ),
  62. $feature->seqlen
  63. );
  64. }
  65. // allow site admins to see the feature ID
  66. if (user_access('access administration pages')) {
  67. // Feature ID
  68. $rows[] = array(
  69. array(
  70. 'data' => 'Feature ID',
  71. 'header' => TRUE
  72. ),
  73. $feature->feature_id
  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); ?>
  103. </div>