| 1 |
<?php
|
| 2 |
// $Id$
|
| 3 |
|
| 4 |
//Test civicrm contact formatter
|
| 5 |
function phptemplate_crm_contact(&$contact, &$field) {
|
| 6 |
if (!civinode_check_init())
|
| 7 |
return;
|
| 8 |
$contact_id = $contact['contact_id'];
|
| 9 |
$pid = $field['default_profile_id'] ?
|
| 10 |
$field['default_profile_id'] :
|
| 11 |
civinode_get_default_profile_id(0);
|
| 12 |
|
| 13 |
$field_list = civinode_get_profile_field_list($pid, 'view');
|
| 14 |
$field_info = array();
|
| 15 |
//profiles name some fields using the location id, we want
|
| 16 |
//to strip this out:
|
| 17 |
foreach ($field_list as $node_field => $raw_field) {
|
| 18 |
$field_desc = civinode_get_field_info($pid, $raw_field, 'view');
|
| 19 |
$field_info[$node_field] = $field_desc;
|
| 20 |
}
|
| 21 |
|
| 22 |
$variables = array(
|
| 23 |
'contact' => $contact,
|
| 24 |
'cck_field' => $field,
|
| 25 |
'field_info' => $field_info,
|
| 26 |
'profile_id' => $pid,
|
| 27 |
);
|
| 28 |
|
| 29 |
return _phptemplate_callback('crm_contact', $variables, array('crm_contact_'. $pid));
|
| 30 |
}
|
| 31 |
//end of test code.
|