tripal_analysis_base.tpl.php 3.1 KB

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