tripal_analysis_base.tpl.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <?php
  2. $analysis = $variables['node']->analysis;
  3. $analysis = tripal_core_expand_chado_vars($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 = array();
  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 = array();
  16. // Analysis Name row
  17. $rows[] = array(
  18. array(
  19. 'data' => 'Analysis Name',
  20. 'header' => TRUE
  21. ),
  22. $analysis->name
  23. );
  24. // Implementation row
  25. $software = $analysis->program;
  26. if($analysis->programversion != 'n/a'){
  27. $software .= " (" . $analysis->programversion . ")";
  28. }
  29. if($analysis->algorithm){
  30. $software .= ". " . $analysis->algorithm;
  31. }
  32. $rows[] = array(
  33. array(
  34. 'data' => 'Method',
  35. 'header' => TRUE
  36. ),
  37. $software
  38. );
  39. // Source row
  40. $source = '';
  41. if($analysis->sourceuri){
  42. $source = "<a href=\"$analysis->sourceuri\">$analysis->sourcename</a>";
  43. }
  44. else {
  45. $source = $analysis->sourcename;
  46. }
  47. if($analysis->sourceversion){
  48. $source = " (" . $analysis->sourceversion . ")";
  49. }
  50. $rows[] = array(
  51. array(
  52. 'data' => 'Source',
  53. 'header' => TRUE
  54. ),
  55. $source
  56. );
  57. // Date performed row
  58. $rows[] = array(
  59. array(
  60. 'data' => 'Date performed',
  61. 'header' => TRUE
  62. ),
  63. preg_replace("/^(\d+-\d+-\d+) .*/","$1", $analysis->timeexecuted),
  64. );
  65. // allow site admins to see the analysis ID
  66. if (user_access('access administration pages')) {
  67. // Analysis ID
  68. $rows[] = array(
  69. array(
  70. 'data' => 'Analysis ID',
  71. 'header' => TRUE,
  72. 'class' => 'tripal-site-admin-only-table-row',
  73. ),
  74. array(
  75. 'data' => $analysis->analysis_id,
  76. 'class' => 'tripal-site-admin-only-table-row',
  77. ),
  78. );
  79. }
  80. // the $table array contains the headers and rows array as well as other
  81. // options for controlling the display of the table. Additional
  82. // documentation can be found here:
  83. // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
  84. $table = array(
  85. 'header' => $headers,
  86. 'rows' => $rows,
  87. 'attributes' => array(
  88. 'id' => 'tripal_analysis-table-base',
  89. ),
  90. 'sticky' => FALSE,
  91. 'caption' => '',
  92. 'colgroups' => array(),
  93. 'empty' => '',
  94. );
  95. // once we have our table array structure defined, we call Drupal's theme_table()
  96. // function to generate the table.
  97. print theme_table($table);
  98. if (property_exists($analysis, 'description')) { ?>
  99. <div style="text-align: justify"><?php print $analysis->description; ?></div> <?php
  100. } ?>