tripal_analysis_base.tpl.php

  1. 2.x tripal_analysis/theme/templates/tripal_analysis_base.tpl.php
  2. 3.x legacy/tripal_analysis/theme/templates/tripal_analysis_base.tpl.php
1 theme call to tripal_analysis_base.tpl.php
tripal_analysis_node_view in tripal_analysis/includes/tripal_analysis.chado_node.inc
Implements hook_node_view(). Called for all node types.

File

tripal_analysis/theme/templates/tripal_analysis_base.tpl.php
View source
  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 = 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. '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[] = array(
  34. array(
  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[] = array(
  52. array(
  53. 'data' => 'Source',
  54. 'header' => TRUE
  55. ),
  56. $source
  57. );
  58. // Date performed row
  59. $rows[] = array(
  60. array(
  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[] = array(
  70. array(
  71. 'data' => 'Analysis ID',
  72. 'header' => TRUE,
  73. 'class' => 'tripal-site-admin-only-table-row',
  74. ),
  75. array(
  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 = array(
  86. 'header' => $headers,
  87. 'rows' => $rows,
  88. 'attributes' => array(
  89. 'id' => 'tripal_analysis-table-base',
  90. 'class' => 'tripal-data-table'
  91. ),
  92. 'sticky' => FALSE,
  93. 'caption' => '',
  94. 'colgroups' => array(),
  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. } ?>