tripal_stock_base.tpl.php 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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">Stock Details</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>