tripal_analysis_properties.tpl.php 1.8 KB

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