tripal_analysis_base.tpl.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <?php
  2. $analysis = $variables['node']->analysis;
  3. $analysis = chado_expand_var($analysis, 'field', 'analysis.description'); ?>
  4. <div class="tripal__analysis-data-block-desc tripal-data-block-desc"></div><?php
  5. // the $headers array is an array of fields to use as the colum headers.
  6. // additional documentation can be found here
  7. // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
  8. // This table for the analysis has a vertical header (down the first column)
  9. // so we do not provide headers here, but specify them in the $rows array below.
  10. $headers = [];
  11. // the $rows array contains an array of rows where each row is an array
  12. // of values for each column of the table in that row. Additional documentation
  13. // can be found here:
  14. // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
  15. $rows = [];
  16. // Analysis Name row
  17. $rows[] = [
  18. [
  19. 'data' => 'Analysis Name',
  20. 'header' => TRUE,
  21. 'width' => '20%',
  22. ],
  23. $analysis->name,
  24. ];
  25. // Implementation row
  26. $software = $analysis->program;
  27. if ($analysis->programversion != 'n/a') {
  28. $software .= " (" . $analysis->programversion . ")";
  29. }
  30. if ($analysis->algorithm) {
  31. $software .= ". " . $analysis->algorithm;
  32. }
  33. $rows[] = [
  34. [
  35. 'data' => 'Method',
  36. 'header' => TRUE,
  37. ],
  38. $software,
  39. ];
  40. // Source row
  41. $source = '';
  42. if ($analysis->sourceuri) {
  43. $source = "<a href=\"$analysis->sourceuri\">$analysis->sourcename</a>";
  44. }
  45. else {
  46. $source = $analysis->sourcename;
  47. }
  48. if ($analysis->sourceversion) {
  49. $source = " (" . $analysis->sourceversion . ")";
  50. }
  51. $rows[] = [
  52. [
  53. 'data' => 'Source',
  54. 'header' => TRUE,
  55. ],
  56. $source,
  57. ];
  58. // Date performed row
  59. $rows[] = [
  60. [
  61. 'data' => 'Date performed',
  62. 'header' => TRUE,
  63. ],
  64. preg_replace("/^(\d+-\d+-\d+) .*/", "$1", $analysis->timeexecuted),
  65. ];
  66. // allow site admins to see the analysis ID
  67. if (user_access('view ids')) {
  68. // Analysis ID
  69. $rows[] = [
  70. [
  71. 'data' => 'Analysis ID',
  72. 'header' => TRUE,
  73. 'class' => 'tripal-site-admin-only-table-row',
  74. ],
  75. [
  76. 'data' => $analysis->analysis_id,
  77. 'class' => 'tripal-site-admin-only-table-row',
  78. ],
  79. ];
  80. }
  81. // the $table array contains the headers and rows array as well as other
  82. // options for controlling the display of the table. Additional
  83. // documentation can be found here:
  84. // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
  85. $table = [
  86. 'header' => $headers,
  87. 'rows' => $rows,
  88. 'attributes' => [
  89. 'id' => 'tripal_analysis-table-base',
  90. 'class' => 'tripal-data-table',
  91. ],
  92. 'sticky' => FALSE,
  93. 'caption' => '',
  94. 'colgroups' => [],
  95. 'empty' => '',
  96. ];
  97. // once we have our table array structure defined, we call Drupal's theme_table()
  98. // function to generate the table.
  99. print theme_table($table);
  100. if (property_exists($analysis, 'description')) { ?>
  101. <div style="text-align: justify"><?php print $analysis->description; ?></div> <?php
  102. } ?>