tripal_stock_properties.tpl.php 2.2 KB

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