tripal_analysis_properties.tpl.php 2.0 KB

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