tripal_contact_base.tpl.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. $contact = $variables['node']->contact; ?>
  3. <div class="tripal_contact-data-block-desc tripal-data-block-desc"></div> <?php
  4. // the $headers array is an array of fields to use as the colum headers.
  5. // additional documentation can be found here
  6. // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
  7. // This table for the contact has a vertical header (down the first column)
  8. // so we do not provide headers here, but specify them in the $rows array below.
  9. $headers = array();
  10. // the $rows array contains an array of rows where each row is an array
  11. // of values for each column of the table in that row. Additional documentation
  12. // can be found here:
  13. // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
  14. $rows = array();
  15. // Contact Name row
  16. $rows[] = array(
  17. array(
  18. 'data' => 'Name',
  19. 'header' => TRUE
  20. ),
  21. $contact->name,
  22. );
  23. // Contact Type row
  24. $rows[] = array(
  25. array(
  26. 'data' => 'Type',
  27. 'header' => TRUE
  28. ),
  29. $contact->type_id->name,
  30. );
  31. // allow site admins to see the contact ID
  32. if (user_access('access administration pages')) {
  33. // Pub ID
  34. $rows[] = array(
  35. array(
  36. 'data' => 'Contact ID',
  37. 'header' => TRUE,
  38. 'class' => 'tripal-site-admin-only-table-row',
  39. ),
  40. array(
  41. 'data' => $contact->contact_id,
  42. 'class' => 'tripal-site-admin-only-table-row',
  43. ),
  44. );
  45. }
  46. // the $table array contains the headers and rows array as well as other
  47. // options for controlling the display of the table. Additional
  48. // documentation can be found here:
  49. // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
  50. $table = array(
  51. 'header' => $headers,
  52. 'rows' => $rows,
  53. 'attributes' => array(
  54. 'id' => 'tripal_contact-table-base',
  55. ),
  56. 'sticky' => FALSE,
  57. 'caption' => '',
  58. 'colgroups' => array(),
  59. 'empty' => '',
  60. );
  61. // once we have our table array structure defined, we call Drupal's theme_table()
  62. // function to generate the table.
  63. print theme_table($table);
  64. if (property_exists($contact, 'description')) { ?>
  65. <div style="text-align: justify"><?php print $contact->description; ?></div> <?php
  66. } ?>