tripal_stock_teaser.tpl.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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
  26. $stock = $node->stock;
  27. $organism = $node->stock->organism_id;
  28. $main_db_reference = $stock->dbxref_id;
  29. ?>
  30. <div id="tripal_stock-base-box" class="tripal_stock-info-box tripal-info-box">
  31. <div class="tripal_stock-info-box-title tripal-info-box-title">
  32. <?php print l($node->stock->name, 'node/'.$node->nid); ?>
  33. </div>
  34. <div class="tripal_stock-info-box-desc tripal-info-box-desc"></div>
  35. <?php if($stock->is_obsolete == 't'){ ?>
  36. <div class="tripal_stock-obsolete">This stock is obsolete and no longer used in analysis, but is here for reference</div>
  37. <?php }?>
  38. <table class="tripal_stock-table tripal-table tripal-table-vert">
  39. <tr class="tripal_stock-table-odd-row tripal-table-even-row">
  40. <th>Name</th>
  41. <td><?php print $stock->name; ?></td>
  42. </tr>
  43. <tr class="tripal_stock-table-odd-row tripal-table-odd-row">
  44. <th nowrap>Unique Name</th>
  45. <td><?php print $stock->uniquename; ?></td>
  46. </tr>
  47. <tr class="tripal_stock-table-odd-row tripal-table-even-row">
  48. <th>Internal ID</th>
  49. <?php if (!empty($main_db_reference->dbxref_id)) { ?>
  50. <?php
  51. if ($main_db_reference->db_id->urlprefix) {
  52. $accession = l($main_db_reference->accession, $main_db_reference->db_id->urlprefix.$main_db_reference->accession);
  53. } else {
  54. $accession = $main_db_reference->accession;
  55. }
  56. if ($main_db_reference->db_id->url) {
  57. $accession .= ' ('.l($main_db_reference->db_id->name, $main_db_reference->db_id->url).')';
  58. } else {
  59. $accession .= ' ('.$main_db_reference->db_id->name.')';
  60. }
  61. ?>
  62. <td><?php print $accession; ?></td>
  63. <?php } else { ?>
  64. <td></td>
  65. <?php } ?>
  66. </tr>
  67. <tr class="tripal_stock-table-odd-row tripal-table-odd-row">
  68. <th>Type</th>
  69. <td><?php print $stock->type_id->name; ?></td>
  70. </tr>
  71. <tr class="tripal_stock-table-odd-row tripal-table-even-row">
  72. <th>Organism</th>
  73. <td>
  74. <?php if ($organism->nid) { ?>
  75. <a href="<?php print url("node/$organism->nid") ?>"><?php print $organism->genus ." " . $organism->species ." (" .$organism->common_name ." )"?></a>
  76. <?php
  77. } else {
  78. print $organism->genus ." " . $organism->species ." (" .$organism->common_name ." )";
  79. } ?>
  80. </td>
  81. </tr>
  82. </table>
  83. </div>