tripal_analysis_properties.tpl.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. // get the analysis object and expand it to include the records from the analysisprop table
  3. $analysis = $variables['node']->analysis;
  4. $analysis = tripal_core_expand_chado_vars($analysis,'table', 'analysisprop', array('return_array' => 1));
  5. $analysisprops = $analysis->analysisprop;
  6. // put the properties in an array for easier access
  7. $properties = array();
  8. foreach ($analysisprops as $property) {
  9. $property = tripal_core_expand_chado_vars($property,'field','analysisprop.value');
  10. $properties[] = $property;
  11. }
  12. if (count($properties) > 0) { ?>
  13. <div id="tripal_analysis-properties-box" class="tripal_analysis-info-box tripal-info-box">
  14. <div class="tripal_analysis-info-box-title tripal-info-box-title">More Details</div>
  15. <div class="tripal_analysis-info-box-desc tripal-info-box-desc">Additional information about this analysis:</div><?php
  16. // the $headers array is an array of fields to use as the colum headers.
  17. // additional documentation can be found here
  18. // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
  19. $headers = array('Property Name', 'Value');
  20. // the $rows array contains an array of rows where each row is an array
  21. // of values for each column of the table in that row. Additional documentation
  22. // can be found here:
  23. // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
  24. $rows = array();
  25. foreach ($properties as $property) {
  26. $rows[] = array(
  27. ucfirst(preg_replace('/_/', ' ', $property->type_id->name)),
  28. $property->value
  29. );
  30. }
  31. // the $table array contains the headers and rows array as well as other
  32. // options for controlling the display of the table. Additional
  33. // documentation can be found here:
  34. // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
  35. $table = array(
  36. 'header' => $headers,
  37. 'rows' => $rows,
  38. 'attributes' => array(
  39. 'id' => 'tripal_analysis-table-properties',
  40. ),
  41. 'sticky' => FALSE,
  42. 'caption' => '',
  43. 'colgroups' => array(),
  44. 'empty' => '',
  45. );
  46. // once we have our table array structure defined, we call Drupal's theme_table()
  47. // function to generate the table.
  48. print theme_table($table); ?>
  49. </div> <?php
  50. }