tripal_project_contact.tpl.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. $project = $variables['node']->project;
  3. // expand the project object to include the contacts from the project_contact
  4. // table in chado.
  5. $project = tripal_core_expand_chado_vars($project,'table','project_contact', array('return_array' => 1));
  6. $contacts = $project->project_contact;
  7. if (count($contacts) > 0) { ?>
  8. <div id="tripal_project-contacts-box" class="tripal_project-info-box tripal-info-box">
  9. <div class="tripal_project-info-box-title tripal-info-box-title">People</div>
  10. <div class="tripal_project-info-box-desc tripal-info-box-desc">The following people particpated in development or execution of this project</div><?php
  11. $i = 0;
  12. foreach ($contacts as $contact) { ?>
  13. <b><?php print $contact->contact_id->name ?></b>, <?php print $contact->contact_id->description ?>
  14. <table id="tripal_project-contacts-table" class="tripal_project-table tripal-table tripal-table-horz"> <?php
  15. // expand the contact to include the properties. This table doesn't
  16. // actually exist in Chado v1.11 or Chado v1.2. But, for some sites it has been
  17. // added manually, and it is expected that this table will be added to fiture
  18. // versions of Chado, so the code is included below to handle contact properties.
  19. $contact = tripal_core_expand_chado_vars($contact,'table','contactprop');
  20. if ($contact->contactprop) {
  21. foreach ($contact->contactprop as $prop) {
  22. $class = 'tripal-table-odd-row';
  23. if ($i % 2 == 0 ) {
  24. $class = 'tripal-table-even-row';
  25. }
  26. # make the type a bit more reader friendly
  27. $type = $prop->type_id->name;
  28. $type = preg_replace("/_/", " ", $type);
  29. $type = ucwords($type);
  30. ?>
  31. <tr class="<?php print $class ?>">
  32. <td> <?php print $type ?></td>
  33. <td> <?php print $prop->value ?></td>
  34. </tr> <?php
  35. $i++;
  36. }
  37. }
  38. /* else { ?>
  39. <tr class="tripal-table-odd-row">
  40. <td>No contact information available for <?php print $contact->contact_id->name ?></td>
  41. </tr> <?php
  42. } */
  43. ?>
  44. </table> <?php
  45. } ?>
  46. </div> <?php
  47. }