tripal_feature_libraries.tpl.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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','library_feature');
  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. $library_features = $feature->library_feature;
  9. if (!$library_features) {
  10. $library_features = array();
  11. }
  12. elseif (!is_array($library_features)) {
  13. $library_features = array($library_features);
  14. }
  15. // don't show this page if there are no libraries
  16. if (count($library_features) > 0) { ?>
  17. <div id="tripal_feature-libraries-box" class="tripal_feature-info-box tripal-info-box">
  18. <div class="tripal_feature-info-box-title tripal-info-box-title">Libraries</div>
  19. <div class="tripal_feature-info-box-desc tripal-info-box-desc">This <?php print $feature->type_id->name ?> is derived, or can be located in the following libraries</div>
  20. <table id="tripal_feature-libraries-table" class="tripal_feature-table tripal-table tripal-table-horz">
  21. <tr>
  22. <th>Library Name</th>
  23. <th>Type</th>
  24. </tr> <?php
  25. $i = 0;
  26. foreach ($library_features as $library_feature) {
  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. if ($library_feature->library_id->nid) {
  34. print "<a href=\"". url("node/".$library_feature->library_id->nid) . "\">".$library_feature->library_id->name."</a>";
  35. } else {
  36. print $library_feature->library_id->name;
  37. } ?>
  38. </td>
  39. <td> <?php
  40. if ($library_feature->library_id->type_id->name == 'cdna_library') {
  41. print 'cDNA';
  42. } else if ($library_feature->library_id->type_id->name == 'bac_library') {
  43. print 'BAC';
  44. } else {
  45. print $library_feature->library_id->type_id->name;
  46. } ?>
  47. </td>
  48. </tr> <?php
  49. $i++;
  50. } ?>
  51. </table>
  52. </div><?php
  53. }