tripal_featuremap.base.tpl.php 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. $featuremap = $variables['node']->featuremap;
  3. // expand the description field
  4. $featuremap = tripal_core_expand_chado_vars($featuremap, 'field', 'featuremap.description');
  5. ?>
  6. <div id="tripal_featuremap-base-box" class="tripal_featuremap-info-box tripal-info-box">
  7. <div class="tripal_featuremap-info-box-title tripal-info-box-title">Map Details</div>
  8. <div class="tripal_featuremap-info-box-desc tripal-info-box-desc"></div> <?php
  9. // the $headers array is an array of fields to use as the colum headers.
  10. // additional documentation can be found here
  11. // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
  12. // This table for the analysis has a vertical header (down the first column)
  13. // so we do not provide headers here, but specify them in the $rows array below.
  14. $headers = array();
  15. // the $rows array contains an array of rows where each row is an array
  16. // of values for each column of the table in that row. Additional documentation
  17. // can be found here:
  18. // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
  19. $rows = array();
  20. // Map Name row
  21. $rows[] = array(
  22. array(
  23. 'data' => 'Map Name',
  24. 'header' => TRUE
  25. ),
  26. $featuremap->name
  27. );
  28. // Map Units
  29. $rows[] = array(
  30. array(
  31. 'data' => 'Map Units',
  32. 'header' => TRUE
  33. ),
  34. $featuremap->unittype_id->name
  35. );
  36. // allow site admins to see the feature ID
  37. if (user_access('access administration pages')) {
  38. // Feature Map ID
  39. $rows[] = array(
  40. array(
  41. 'data' => 'Feature Map ID',
  42. 'header' => TRUE
  43. ),
  44. $featuremap->featuremap_id
  45. );
  46. }
  47. // the $table array contains the headers and rows array as well as other
  48. // options for controlling the display of the table. Additional
  49. // documentation can be found here:
  50. // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
  51. $table = array(
  52. 'header' => $headers,
  53. 'rows' => $rows,
  54. 'attributes' => array(
  55. 'id' => 'tripal_featuremap-table-base',
  56. ),
  57. 'sticky' => FALSE,
  58. 'caption' => '',
  59. 'colgroups' => array(),
  60. 'empty' => '',
  61. );
  62. // once we have our table array structure defined, we call Drupal's theme_table()
  63. // function to generate the table.
  64. print theme_table($table);
  65. if (property_exists($featuremap, 'description')) { ?>
  66. <div style="text-align: justify"><?php print $featuremap->description; ?></div> <?php
  67. } ?>
  68. </div>