tripal_feature_analyses.tpl.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. $feature = $variables['node']->feature;
  3. $options = array('return_array' => 1);
  4. $feature = tripal_core_expand_chado_vars($feature, 'table', 'analysisfeature', $options);
  5. $analyses = $feature->analysisfeature;
  6. // don't show this page if there are no analyses
  7. if (count($analyses) > 0) { ?>
  8. <div id="tripal_feature-analyses-box" class="tripal_feature-info-box tripal-info-box">
  9. <div class="tripal_feature-info-box-title tripal-info-box-title">Analyses</div>
  10. <div class="tripal_feature-info-box-desc tripal-info-box-desc">This <?php print $feature->type_id->name ?> is derived from or has results from the following analyses</div> <?php
  11. // the $headers array is an array of fields to use as the colum headers.
  12. // additional documentation can be found here
  13. // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
  14. $headers = array('Analysis Name' ,'Date Performed');
  15. // the $rows array contains an array of rows where each row is an array
  16. // of values for each column of the table in that row. Additional documentation
  17. // can be found here:
  18. // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
  19. $rows = array();
  20. foreach ($analyses as $analysis) {
  21. $analysis_name = $analysis->analysis_id->name;
  22. if (property_exists($analysis->analysis_id, 'nid')) {
  23. $analysis_name = l($analysis_name, "node/" . $analysis->analysis_id->nid);
  24. }
  25. $rows[] = array(
  26. $analysis_name,
  27. preg_replace('/\d\d:\d\d:\d\d/', '', $analysis->analysis_id->timeexecuted),
  28. );
  29. }
  30. // the $table array contains the headers and rows array as well as other
  31. // options for controlling the display of the table. Additional
  32. // documentation can be found here:
  33. // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
  34. $table = array(
  35. 'header' => $headers,
  36. 'rows' => $rows,
  37. 'attributes' => array(
  38. 'id' => 'tripal_feature-table-analyses',
  39. ),
  40. 'sticky' => FALSE,
  41. 'caption' => '',
  42. 'colgroups' => array(),
  43. 'empty' => '',
  44. );
  45. // once we have our table array structure defined, we call Drupal's theme_table()
  46. // function to generate the table.
  47. print theme_table($table); ?>
  48. </div><?php
  49. }