tripal_feature_synonyms.tpl.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. $feature = $variables['node']->feature;
  3. // expand the feature object to include the synonyms from the feature_synonym
  4. // table in chado.
  5. $feature = tripal_core_expand_chado_vars($feature,'table','feature_synonym');
  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. $synonyms = $feature->feature_synonym;
  9. if (!$synonyms) {
  10. $synonyms = array();
  11. } elseif (!is_array($synonyms)) {
  12. $synonyms = array($synonyms);
  13. }
  14. ?>
  15. <div id="tripal_feature-synonyms-box" class="tripal_feature-info-box tripal-info-box">
  16. <div class="tripal_feature-info-box-title tripal-info-box-title">Synonyms</div>
  17. <div class="tripal_feature-info-box-desc tripal-info-box-desc">The feature '<?php print $feature->name ?>' has the following synonyms</div>
  18. <?php if(count($synonyms) > 0){ ?>
  19. <table id="tripal_feature-synonyms-table" class="tripal_feature-table tripal-table tripal-table-horz">
  20. <tr>
  21. <th>Synonym</th>
  22. </tr>
  23. <?php
  24. $i = 0;
  25. foreach ($synonyms as $feature_synonym){
  26. $class = 'tripal-table-odd-row';
  27. if($i % 2 == 0 ){
  28. $class = 'tripal-table-even-row';
  29. }
  30. ?>
  31. <tr class="<?php print $class ?>">
  32. <td><?php print $feature_synonym->synonym_id->name?></td>
  33. </tr>
  34. <?php
  35. $i++;
  36. } ?>
  37. </table>
  38. <?php } else { ?>
  39. <div class="tripal-no-results">There are no synonyms for this feature</div>
  40. <?php }?>
  41. </div>