tripal_stock_teaser.tpl.php 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <?php
  2. // Copyright 2010 University of Saskatchewan (Lacey-Anne Sanderson)
  3. //
  4. // Purpose: Provide layout and content for the basic stock details. This
  5. // includes all fields in the chado stock table supplemented with extra
  6. // details for each foreign key to provide human-readable output
  7. //
  8. // Note: This template controls the layout/content for the default stock node
  9. // template (node-chado_stock.tpl.php) and the Stock Details 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. // NOTE: For a full listing of fields available in the node object the
  18. // print_r $node line below or install the Drupal Devel module which
  19. // provides an extra tab at the top of the node page labelled Devel
  20. ?>
  21. <?php
  22. //uncomment this line to see a full listing of the fields avail. to $node
  23. //print '<pre>'.print_r($node,TRUE).'</pre>';
  24. ?>
  25. <?php $organism = $node->organism->organism; ?>
  26. <div id="tripal_stock-base-box" class="tripal_stock-info-box tripal-info-box">
  27. <div class="tripal_stock-info-box-title tripal-info-box-title">
  28. <?php print l($node->stock_name, 'node/'.$node->nid); ?>
  29. </div>
  30. <div class="tripal_stock-info-box-desc tripal-info-box-desc"></div>
  31. <?php if($node->is_obsolete == 't'){ ?>
  32. <div class="tripal_stock-obsolete">This stock is obsolete and no longer used in analysis, but is here for reference</div>
  33. <?php }?>
  34. <table class="tripal_stock-table tripal-table tripal-table-vert">
  35. <tr class="tripal_stock-table-odd-row tripal-table-even-row">
  36. <th>Name</th>
  37. <td><?php print $node->stock_name; ?></td>
  38. </tr>
  39. <tr class="tripal_stock-table-odd-row tripal-table-odd-row">
  40. <th nowrap>Unique Name</th>
  41. <td><?php print $node->uniquename; ?></td>
  42. </tr>
  43. <tr class="tripal_stock-table-odd-row tripal-table-even-row">
  44. <th>Internal ID</th>
  45. <?php if (!empty($node->main_db_reference->dbxref_id)) { ?>
  46. <?php
  47. if ($node->main_db_reference->db_urlprefix) {
  48. $accession = l($node->main_db_reference->accession, $node->main_db_reference->db_urlprefix.$node->main_db_reference->accession);
  49. } else {
  50. $accession = $node->main_db_reference->accession;
  51. }
  52. if ($node->main_db_reference->db_url) {
  53. $accession .= ' ('.l($node->main_db_reference->db_name, $node->main_db_reference->db_url).')';
  54. } else {
  55. $accession .= ' ('.$node->main_db_reference->db_name.')';
  56. }
  57. ?>
  58. <td><?php print $accession; ?></td>
  59. <?php } else { ?>
  60. <td></td>
  61. <?php } ?>
  62. </tr>
  63. <tr class="tripal_stock-table-odd-row tripal-table-odd-row">
  64. <th>Type</th>
  65. <td><?php print $node->stock_type; ?></td>
  66. </tr>
  67. <tr class="tripal_stock-table-odd-row tripal-table-even-row">
  68. <th>Organism</th>
  69. <td>
  70. <?php if ($node->organism->nid) { ?>
  71. <a href="<?php print url("node/$organism->nid") ?>"><?php print $organism->genus ." " . $organism->species ." (" .$organism->common_name ." )"?></a>
  72. <?php
  73. } else {
  74. print $organism->genus ." " . $organism->species ." (" .$organism->common_name ." )";
  75. } ?>
  76. </td>
  77. </tr>
  78. </table>
  79. </div>