tripal_stock_synonyms.tpl.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. // Copyright 2010 University of Saskatchewan (Lacey-Anne Sanderson)
  3. //
  4. // Purpose: Provides layout and content for Synonyms of the Current Stock.
  5. // Stock synonyms are stored in the stockprop table with a type corresponding
  6. // to the cvterm synonym.
  7. //
  8. // Note: This template controls the layout/content for the default stock node
  9. // template (node-chado_stock.tpl.php) and the Stock Synonyms Block
  10. //
  11. // Variables Available:
  12. // - $node: a standard object which contains all the fields associated with
  13. // nodes including nid, type, title, taxonomy. It also includes stock
  14. // specific fields such as stock_name, uniquename, stock_type, synonyms,
  15. // properties, db_references, object_relationships, subject_relationships,
  16. // organism, etc.
  17. // - $node->synonyms: an array of stock property objects where each object
  18. // has type=synonyms and the following fields: stockprop_id, type_id,
  19. // type, value, rank
  20. // NOTE: For a full listing of fields available in the node object the
  21. // print_r $node line below or install the Drupal Devel module which
  22. // provides an extra tab at the top of the node page labelled Devel
  23. ?>
  24. <?php
  25. //uncomment this line to see a full listing of the fields avail. to $node
  26. //print '<pre>'.print_r($node,TRUE).'</pre>';
  27. ?>
  28. <?php
  29. $synonyms = $node->stock->stock_synonyms;
  30. if (!$synonyms) {
  31. $synonyms = array();
  32. } elseif (!is_array($synonyms)) {
  33. $synonyms = array($synonyms);
  34. }
  35. ?>
  36. <div id="tripal_stock-synonyms-box" class="tripal_stock-info-box tripal-info-box">
  37. <div class="tripal_stock-info-box-title tripal-info-box-title">Synonyms</div>
  38. <div class="tripal_stock-info-box-desc tripal-info-box-desc">Synonyms for the stock '<?php print $node->stock->name ?>' include:</div>
  39. <?php if(count($synonyms) > 0){
  40. print '<ul>';
  41. // iterate through each synonym
  42. foreach ($synonyms as $result){
  43. print '<li>'.$result->value.'</li>';
  44. }
  45. print '</ul>';
  46. } else {
  47. print '<b>There are no synonyms for the current stock.</b>';
  48. } ?>
  49. </div>