tripal_analysis_base.tpl.php 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <?php
  2. $analysis = $variables['node']->analysis;
  3. $analysis = tripal_core_expand_chado_vars($analysis,'field','analysis.description');
  4. ?>
  5. <div id="tripal_analysis-base-box" class="tripal_analysis-info-box tripal-info-box">
  6. <div class="tripal_analysis-info-box-title tripal-info-box-title">Details</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 organism 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. // Software row
  27. $software = '';
  28. if($analysis->programversion and $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' => 'Software',
  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. // the $table array contains the headers and rows array as well as other
  68. // options for controlling the display of the table. Additional
  69. // documentation can be found here:
  70. // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
  71. $table = array(
  72. 'header' => $headers,
  73. 'rows' => $rows,
  74. 'attributes' => array(
  75. 'id' => 'tripal_analysis-table-base',
  76. ),
  77. 'sticky' => FALSE,
  78. 'caption' => '',
  79. 'colgroups' => array(),
  80. 'empty' => '',
  81. );
  82. // once we have our table array structure defined, we call Drupal's theme_table()
  83. // function to generate the table.
  84. print theme_table($table);
  85. if (property_exists($analysis, 'comment')) { ?>
  86. <b>Description</b> <?php
  87. print $analysis->description;
  88. } ?>
  89. </div>