tripal_feature_analyses.tpl.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. $feature = $variables['node']->feature;
  3. // expand the feature object to include the libraries from the library_feature
  4. // table in chado.
  5. $feature = tripal_core_expand_chado_vars($feature,'table','analysisfeature');
  6. // get the references. if only one reference exists then we want to convert
  7. // the object into an array, otherwise the value is an array
  8. $analyses = $feature->analysisfeature;
  9. if (!$analyses) {
  10. $analyses = array();
  11. }
  12. elseif (!is_array($analyses)) {
  13. $analyses = array($analyses);
  14. }
  15. // don't show this page if there are no libraries
  16. if (count($analyses) > 0) { ?>
  17. <div id="tripal_feature-analyses-box" class="tripal_feature-info-box tripal-info-box">
  18. <div class="tripal_feature-info-box-title tripal-info-box-title">Analyses</div>
  19. <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>
  20. <table id="tripal_feature-analyses-table" class="tripal_feature-table tripal-table tripal-table-horz">
  21. <tr>
  22. <th>Analysis Name</th>
  23. <th>Date Performed</th>
  24. </tr> <?php
  25. $i = 0;
  26. foreach ($analyses as $analysis) {
  27. $class = 'tripal-table-odd-row';
  28. if ($i % 2 == 0 ) {
  29. $class = 'tripal-table-even-row';
  30. } ?>
  31. <tr class="<?php print $class ?>">
  32. <td><?php
  33. $nid = chado_get_node_id('analysis', $analysis->analysis_id->analysis_id);
  34. if ($nid) {
  35. print "<a href=\"". url("node/".$nid) . "\">".$analysis->analysis_id->name."</a>";
  36. } else {
  37. print $analysis->analysis_id->name;
  38. } ?>
  39. </td>
  40. <td> <?php print preg_replace('/\d\d:\d\d:\d\d/', '', $analysis->analysis_id->timeexecuted) ?>
  41. </td>
  42. </tr> <?php
  43. $i++;
  44. } ?>
  45. </table>
  46. </div><?php
  47. }