tripal_stock_synonyms.tpl.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. // there is no stock_synonym table, analogous to the feature_synonym table.
  3. // Therefore, synonyms have been stored in the stockprop table with a type
  4. // of 'synonym' or 'alias'.
  5. $stock = $node->stock;
  6. $synonyms = array();
  7. // expand the stock object to include the stockprop records
  8. $options = array('return_array' => 1);
  9. $stock = tripal_core_expand_chado_vars($stock, 'table', 'stockprop', $options);
  10. $stockprops = $stock->stockprop;
  11. // iterate through all of the properties and pull out only the synonyms
  12. if ($stockprops) {
  13. foreach ($stockprops as $stockprop){
  14. if($stockprop->type_id->name == 'synonym' or $stockprop->type_id->name == 'alias'){
  15. $synonyms[] = $stockprop;
  16. }
  17. }
  18. }
  19. if(count($synonyms) > 0){ ?>
  20. <div id="tripal_stock-synonyms-box" class="tripal_stock-info-box tripal-info-box">
  21. <div class="tripal_stock-info-box-title tripal-info-box-title">Synonyms</div>
  22. <div class="tripal_stock-info-box-desc tripal-info-box-desc">The feature '<?php print $stock->name ?>' has the following synonyms</div>
  23. <table id="tripal_stock-synonyms-table" class="tripal_stock-table tripal-table tripal-table-horz">
  24. <tr>
  25. <th>Name</th>
  26. </tr> <?php
  27. $i = 0;
  28. foreach ($synonyms as $synonym){
  29. $class = 'tripal-table-odd-row';
  30. if($i % 2 == 0 ){
  31. $class = 'tripal-table-even-row';
  32. } ?>
  33. <tr class="<?php print $class ?>">
  34. <td><?php print $synonym->value?></td>
  35. </tr> <?php
  36. $i++;
  37. } ?>
  38. </table>
  39. </div><?php
  40. }