tripal_contact_base.tpl.php 2.2 KB

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