tripal_stock_teaser.tpl.php 3.5 KB

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