tripal_library_references.tpl.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. $library = $variables['node']->library;
  3. // expand the library object to include the external references stored
  4. // in the library_dbxref table
  5. $options = array('return_array' => 1);
  6. $library = tripal_core_expand_chado_vars($library,'table','library_dbxref', $options);
  7. $references = $library->library_dbxref;
  8. if(count($references) > 0){ ?>
  9. <div id="tripal_library-references-box" class="tripal_library-info-box tripal-info-box">
  10. <div class="tripal_library-info-box-title tripal-info-box-title">Cross References</div>
  11. <div class="tripal_library-info-box-desc tripal-info-box-desc">External references for this <?php print $library->type_id->name ?> library</div>
  12. <table id="tripal_library-references-table" class="tripal_library-table tripal-table tripal-table-horz">
  13. <tr>
  14. <th>Dababase</th>
  15. <th>Accession</th>
  16. </tr> <?php
  17. $i = 0;
  18. foreach ($references as $library_dbxref) {
  19. $dbxref = $library_dbxref->dbxref_id;
  20. $class = 'tripal_library-table-odd-row tripal-table-odd-row';
  21. if ($i % 2 == 0 ) {
  22. $class = 'tripal_library-table-odd-row tripal-table-even-row';
  23. } ?>
  24. <tr class="<?php print $class ?>">
  25. <td> <?php
  26. if ($dbxref->db_id->url) {
  27. print l($dbxref->db_id->name, $dbxref->db_id->url);
  28. }
  29. else {
  30. print $dbxref->db_id->name;
  31. } ?>
  32. </td>
  33. <td> <?php
  34. if ($dbxref->db_id->urlprefix) {
  35. print l($dbxref->accession, $dbxref->db_id->urlprefix.$dbxref->accession);
  36. }
  37. else {
  38. print $dbxref->accession;
  39. } ?>
  40. </td>
  41. </tr> <?php
  42. $i++;
  43. } ?>
  44. </table>
  45. </div><?
  46. }