tripal_library.base.tpl.php 3.1 KB

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