tripal_featuremap_base.tpl.php 2.3 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. <div class="tripal_featuremap-data-block-desc tripal-data-block-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. // Map Name row
  18. $rows[] = array(
  19. array(
  20. 'data' => 'Map Name',
  21. 'header' => TRUE
  22. ),
  23. $featuremap->name
  24. );
  25. // Map Units
  26. $rows[] = array(
  27. array(
  28. 'data' => 'Map Units',
  29. 'header' => TRUE
  30. ),
  31. $featuremap->unittype_id->name
  32. );
  33. // allow site admins to see the feature ID
  34. if (user_access('access administration pages')) {
  35. // Feature Map ID
  36. $rows[] = array(
  37. array(
  38. 'data' => 'Feature Map ID',
  39. 'header' => TRUE,
  40. 'class' => 'tripal-site-admin-only-table-row',
  41. ),
  42. array(
  43. 'data' => $featuremap->featuremap_id,
  44. 'class' => 'tripal-site-admin-only-table-row',
  45. ),
  46. );
  47. }
  48. // the $table array contains the headers and rows array as well as other
  49. // options for controlling the display of the table. Additional
  50. // documentation can be found here:
  51. // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
  52. $table = array(
  53. 'header' => $headers,
  54. 'rows' => $rows,
  55. 'attributes' => array(
  56. 'id' => 'tripal_featuremap-table-base',
  57. ),
  58. 'sticky' => FALSE,
  59. 'caption' => '',
  60. 'colgroups' => array(),
  61. 'empty' => '',
  62. );
  63. // once we have our table array structure defined, we call Drupal's theme_table()
  64. // function to generate the table.
  65. print theme_table($table);
  66. if (property_exists($featuremap, 'description')) { ?>
  67. <div style="text-align: justify"><?php print $featuremap->description; ?></div> <?php
  68. }