tripal_stock_references.tpl.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. // Copyright 2010 University of Saskatchewan (Lacey-Anne Sanderson)
  3. //
  4. // Purpose: Provides the layout and content for stock external database
  5. // references (this doesn't include the main database reference from the
  6. // stock table). This includes all fields from the dbxref and db chado tables
  7. // where each dbxref is associated with the current stock through the
  8. // stock_dbxref table
  9. //
  10. // Note: This template controls the layout/content for the default stock node
  11. // template (node-chado_stock.tpl.php) and the Stock Database References Block
  12. //
  13. // Variables Available:
  14. // - $node: a standard object which contains all the fields associated with
  15. // nodes including nid, type, title, taxonomy. It also includes stock
  16. // specific fields such as stock_name, uniquename, stock_type, synonyms,
  17. // properties, db_references, object_relationships, subject_relationships,
  18. // organism, etc.
  19. // - $node->db_references: an array of stock database reference objects
  20. // where each object has the following fields: dbxref_id, accession,
  21. // version, description, db_id, db_name, db_description, db_url,
  22. // db_urlprefix
  23. // NOTE: For a full listing of fields available in the node object the
  24. // print_r $node line below or install the Drupal Devel module which
  25. // provides an extra tab at the top of the node page labelled Devel
  26. ?>
  27. <?php
  28. //uncomment this line to see a full listing of the fields avail. to $node
  29. //print '<pre>'.print_r($node,TRUE).'</pre>';
  30. ?>
  31. <div id="tripal_stock-references-box" class="tripal_stock-info-box tripal-info-box">
  32. <div class="tripal_stock-info-box-title tripal-info-box-title">References</div>
  33. <div class="tripal_stock-info-box-desc tripal-info-box-desc">The stock '<?php print $node->stock_name ?>' is also available at these locations</div>
  34. <?php if(count($node->db_references) > 0){ ?>
  35. <table class="tripal_stock-table tripal-table tripal-table-horz">
  36. <tr>
  37. <th>Dababase</th>
  38. <th>Accession</th>
  39. </tr>
  40. <?php
  41. $i = 0;
  42. foreach ($node->db_references as $result){
  43. $class = 'tripal_stock-table-odd-row tripal-table-odd-row';
  44. if($i % 2 == 0 ){
  45. $class = 'tripal_stock-table-odd-row tripal-table-even-row';
  46. }
  47. ?>
  48. <tr class="<?php print $class ?>">
  49. <td><?php print $result->db_name?></td>
  50. <td><?php
  51. if($result->db_urlprefix){
  52. print l($result->accession, $result->db_urlprefix.$result->accession);
  53. } else {
  54. print $result->accession;
  55. }
  56. ?>
  57. </td>
  58. </tr>
  59. <?php
  60. $i++;
  61. } ?>
  62. </table>
  63. <?php } ?>
  64. </div>