tripal_feature_base.tpl.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. $organism = $feature->organism_id->genus ." " . $feature->organism_id->species ." (" .$feature->organism_id->common_name .")";
  43. if ($feature->organism_id->nid) {
  44. $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));
  45. }
  46. $rows[] = array(
  47. array(
  48. 'data' => 'Organism',
  49. 'header' => TRUE
  50. ),
  51. $organism
  52. );
  53. // Seqlen row
  54. if($feature->seqlen > 0) {
  55. $rows[] = array(
  56. array(
  57. 'data' => 'Sequence length',
  58. 'header' => TRUE
  59. ),
  60. $feature->seqlen
  61. );
  62. }
  63. // allow site admins to see the feature ID
  64. if (user_access('access administration pages')) {
  65. // Feature ID
  66. $rows[] = array(
  67. array(
  68. 'data' => 'Feature ID',
  69. 'header' => TRUE
  70. ),
  71. $feature->feature_id
  72. );
  73. }
  74. // Is Obsolete Row
  75. if($feature->is_obsolete == TRUE){
  76. $rows[] = array(
  77. array(
  78. 'data' => '<div class="tripal_feature-obsolete">This feature is obsolete</div>',
  79. 'colspan' => 2
  80. ),
  81. );
  82. }
  83. // the $table array contains the headers and rows array as well as other
  84. // options for controlling the display of the table. Additional
  85. // documentation can be found here:
  86. // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
  87. $table = array(
  88. 'header' => $headers,
  89. 'rows' => $rows,
  90. 'attributes' => array(
  91. 'id' => 'tripal_feature-table-base',
  92. ),
  93. 'sticky' => FALSE,
  94. 'caption' => '',
  95. 'colgroups' => array(),
  96. 'empty' => '',
  97. );
  98. // once we have our table array structure defined, we call Drupal's theme_table()
  99. // function to generate the table.
  100. print theme_table($table); ?>
  101. </div>