tripal_feature_libraries.tpl.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. } elseif (!is_array($library_features)) {
  12. $library_features = array($library_features);
  13. }
  14. ?>
  15. <div id="tripal_feature-libraries-box" class="tripal_feature-info-box tripal-info-box">
  16. <div class="tripal_feature-info-box-title tripal-info-box-title">Libraries</div>
  17. <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>
  18. <?php if(count($library_features) > 0){ ?>
  19. <table id="tripal_feature-libraries-table" class="tripal_feature-table tripal-table tripal-table-horz">
  20. <tr>
  21. <th>Library Name</th>
  22. <th>Type</th>
  23. </tr>
  24. <?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. ?>
  32. <tr class="<?php print $class ?>">
  33. <td><?php
  34. if($library_feature->library_id->nid){
  35. print "<a href=\"". url("node/".$library_feature->library_id->nid) . "\">".$library_feature->library_id->name."</a>";
  36. } else {
  37. print $library_feature->library_id->name;
  38. }
  39. ?>
  40. </td>
  41. <td><?php
  42. if ($library_feature->library_id->type_id->name == 'cdna_library') {
  43. print 'cDNA';
  44. } else if ($library_feature->library_id->type_id->name == 'bac_library') {
  45. print 'BAC';
  46. } else {
  47. print $library_feature->library_id->type_id->name;
  48. }
  49. ?>
  50. </td>
  51. </tr>
  52. <?php
  53. $i++;
  54. } ?>
  55. </table>
  56. <?php } else { ?>
  57. <div class="tripal-no-results">There are no libraries</div>
  58. <?php }?>
  59. </div>