tripal_pub_featuremaps.tpl.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. $pub = $variables['node']->pub;
  3. $featuremaps = array();
  4. // expand the pub object to include the records from the pub_dbxref table
  5. // specify the number of genotypes to show by default and the unique pager ID
  6. $num_results_per_page = 25;
  7. $featuremap_pager_id = 5;
  8. // get the genotypes from the featuremap_genotype table
  9. $options = array(
  10. 'return_array' => 1,
  11. 'pager' => array('limit' => $num_results_per_page, 'element' => $featuremap_pager_id),
  12. );
  13. $pub = tripal_core_expand_chado_vars($pub, 'table', 'featuremap_pub', $options);
  14. $featuremap_pubs = $pub->featuremap_pub;
  15. if (count($featuremap_pubs) > 0 ) {
  16. foreach ($featuremap_pubs as $featuremap_pub) {
  17. $featuremaps[] = $featuremap_pub->featuremap_id;
  18. }
  19. }
  20. // create the pager.
  21. global $pager_total_items;
  22. $featuremap_pager = theme('pager', array(), $num_results_per_page, $featuremap_pager_id, array('block' => 'featuremaps'));
  23. $total_featuremaps = $pager_total_items[$featuremap_pager_id];
  24. if(count($featuremaps) > 0){ ?>
  25. <div id="tripal_pub-featuremaps-box" class="tripal_pub-info-box tripal-info-box">
  26. <div class="tripal_pub-info-box-title tripal-info-box-title">Maps</div>
  27. <div class="tripal_pub-info-box-desc tripal-info-box-desc">This publication contains information about <?php print number_format($total_featuremaps) ?> map(s):</div>
  28. <table id="tripal_pub-featuremap-table" class="tripal_pub-table tripal-table tripal-table-horz">
  29. <tr>
  30. <th>Map Name</th>
  31. </tr> <?php
  32. $i = 0;
  33. foreach ($featuremaps as $featuremap){
  34. $class = 'tripal_pub-table-odd-row tripal-table-odd-row';
  35. if($i % 2 == 0 ){
  36. $class = 'tripal_pub-table-even-row tripal-table-even-row';
  37. } ?>
  38. <tr class="<?php print $class ?>">
  39. <td> <?php
  40. if ($featuremap->nid) {
  41. print l($featuremap->name, 'node/' . $featuremap->nid, array('attributes' => array('target' => '_blank')));
  42. }
  43. else {
  44. print $featuremap->name;
  45. } ?>
  46. </td>
  47. </tr> <?php
  48. $i++;
  49. } ?>
  50. </table> <?php
  51. print $featuremap_pager ?>
  52. </div><?php
  53. }?>