tripal_pub_references.tpl.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. $pub = $variables['node']->pub;
  3. $references = array();
  4. // expand the pub object to include the records from the pub_dbxref table
  5. $options = array('return_array' => 1);
  6. $pub = tripal_core_expand_chado_vars($pub, 'table', 'pub_dbxref', $options);
  7. $pub_dbxrefs = $pub->pub_dbxref;
  8. if (count($pub_dbxrefs) > 0 ) {
  9. foreach ($pub_dbxrefs as $pub_dbxref) {
  10. $references[] = $pub_dbxref->dbxref_id;
  11. }
  12. }
  13. if(count($references) > 0){ ?>
  14. <div id="tripal_pub-references-box" class="tripal_pub-info-box tripal-info-box">
  15. <div class="tripal_pub-info-box-title tripal-info-box-title">Cross References</div>
  16. <div class="tripal_pub-info-box-desc tripal-info-box-desc">This publication is also available in the following databases:</div>
  17. <table id="tripal_pub-references-table" class="tripal_pub-table tripal-table tripal-table-horz">
  18. <tr>
  19. <th>Dababase</th>
  20. <th>Accession</th>
  21. </tr> <?php
  22. $i = 0;
  23. foreach ($references as $dbxref){
  24. $class = 'tripal_pub-table-odd-row tripal-table-odd-row';
  25. if($i % 2 == 0 ){
  26. $class = 'tripal_pub-table-even-row tripal-table-even-row';
  27. } ?>
  28. <tr class="<?php print $class ?>">
  29. <td> <?php
  30. if ($dbxref->db_id->url) {
  31. print l($dbxref->db_id->name, $dbxref->db_id->url, array('attributes' => array('target' => '_blank'))) . '<br>' . $dbxref->db_id->description;
  32. }
  33. else {
  34. print $dbxref->db_id->name . '<br>' . $dbxref->db_id->description;
  35. } ?>
  36. </td>
  37. <td> <?php
  38. if ($dbxref->db_id->urlprefix) {
  39. print l($dbxref->db_id->name . ':' . $dbxref->accession, $dbxref->db_id->urlprefix . $dbxref->accession, array('attributes' => array('target' => '_blank')));
  40. }
  41. else {
  42. print $dbxref->db_id->name . ':' . $dbxref->accession;
  43. }
  44. if ($dbxref->is_primary) {
  45. print " <i>(primary cross-reference)</i>";
  46. } ?>
  47. </td>
  48. </tr> <?php
  49. $i++;
  50. } ?>
  51. </table>
  52. </div><?php
  53. }?>