tripal_contact_properties.tpl.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. $contact = $node->contact;
  3. // expand the contact to include the properties.
  4. $contact = tripal_core_expand_chado_vars($contact,'table', 'contactprop', array('return_array' => 1));
  5. $contactprops = $contact->contactprop;
  6. $properties = array();
  7. if (is_array($contactprops)) {
  8. foreach ($contactprops as $property) {
  9. // we want to keep all properties but the contact_description as that
  10. // property is shown on the base template page.
  11. if($property->type_id->name != 'contact_description') {
  12. $property = tripal_core_expand_chado_vars($property,'field','contactprop.value');
  13. $properties[] = $property;
  14. }
  15. }
  16. }
  17. if (count($properties) > 0) { ?>
  18. <div id="tripal_contact-properties-box" class="tripal_contact-info-box tripal-info-box">
  19. <div class="tripal_contact-info-box-title tripal-info-box-title">More Details</div>
  20. <div class="tripal_contact-info-box-desc tripal-info-box-desc">Additional information about this contact:</div>
  21. <table class="tripal_contact-table tripal-table tripal-table-horz">
  22. <tr>
  23. <th>Property Name</th>
  24. <th>Value</th>
  25. </tr> <?php
  26. $i = 0;
  27. foreach ($properties as $property) {
  28. $class = 'tripal_contact-table-odd-row tripal-table-odd-row';
  29. if ($i % 2 == 0 ) {
  30. $class = 'tripal_contact-table-odd-row tripal-table-even-row';
  31. }
  32. $i++;
  33. ?>
  34. <tr class="<?php print $class ?>">
  35. <td><?php print ucfirst(preg_replace('/_/', ' ', $property->type_id->name)) ?></td>
  36. <td><?php print $property->value ?></td>
  37. </tr><?php
  38. } ?>
  39. </table>
  40. </div> <?php
  41. }