tripal_featuremap_references.tpl.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. $featuremap = $variables['node']->featuremap;
  3. $references = array();
  4. // expand the featuremap object to include the records from the featuremap_dbxref table
  5. $options = array('return_array' => 1);
  6. $featuremap = tripal_core_expand_chado_vars($featuremap, 'table', 'featuremap_dbxref', $options);
  7. $featuremap_dbxrefs = $featuremap->featuremap_dbxref;
  8. if (count($featuremap_dbxrefs) > 0 ) {
  9. foreach ($featuremap_dbxrefs as $featuremap_dbxref) {
  10. $references[] = $featuremap_dbxref->dbxref_id;
  11. }
  12. }
  13. if(count($references) > 0){ ?>
  14. <div id="tripal_featuremap-references-box" class="tripal_featuremap-info-box tripal-info-box">
  15. <div class="tripal_featuremap-info-box-title tripal-info-box-title">Cross References</div>
  16. <div class="tripal_featuremap-info-box-desc tripal-info-box-desc">This Map is also available in the following databases:</div>
  17. <table id="tripal_featuremap-references-table" class="tripal_featuremap-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_featuremap-table-odd-row tripal-table-odd-row';
  25. if($i % 2 == 0 ){
  26. $class = 'tripal_featuremap-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. }?>