Files
pmgr/site/views/contacts/view.ctp
abijah 9bc699bf51 Modified contact grids to use display_name, and the contact model to take company name into account if no other fields will work for display name.
git-svn-id: file:///svn-source/pmgr/branches/pre_0.1_work_20090819@762 97e9348a-65ac-dc4b-aefc-98561f571b83
2009-08-24 19:17:55 +00:00

148 lines
4.4 KiB
PHP

<?php /* -*- mode:PHP -*- */
echo '<div class="contact view">' . "\n";
/**********************************************************************
**********************************************************************
**********************************************************************
**********************************************************************
* Contact Detail Main Section
*/
$phones = $contact['ContactPhone'];
$addresses = $contact['ContactAddress'];
$emails = $contact['ContactEmail'];
if (isset($contact['Contact']))
$contact = $contact['Contact'];
$rows = array();
$rows[] = array('Display Name', $contact['display_name']);
$rows[] = array('First Name', $contact['first_name']);
$rows[] = array('Middle Name', $contact['middle_name']);
$rows[] = array('Last Name', $contact['last_name']);
$rows[] = array('Company', $contact['company_name']);
$rows[] = array('SSN', $contact['id_federal']);
$rows[] = array('ID', ($contact['id_local']
. ($contact['id_local']
? " - ".$contact['id_local_state']
: "")));
$rows[] = array('Comment', $contact['comment']);
echo $this->element('table',
array('class' => 'item contact detail',
'caption' => 'Contact Details',
'rows' => $rows,
'column_class' => array('field', 'value')));
/**********************************************************************
* Contact Info Box
*/
echo '<div class="infobox">' . "\n";
$rows = array();
echo $this->element('table',
array('class' => 'summary',
'rows' => $rows,
'column_class' => array('field', 'value'),
'suppress_alternate_rows' => true,
));
echo '</div>' . "\n";
/**********************************************************************
**********************************************************************
**********************************************************************
**********************************************************************
* Supporting Elements Section
*/
echo '<div CLASS="detail supporting">' . "\n";
/**********************************************************************
* Phones
*/
$headers = array('Phone', 'Preference', 'Comment');
$rows = array();
foreach($phones AS $phone) {
$rows[] = array(FormatHelper::phone($phone['phone']) .
($phone['ext'] ? " x".$phone['ext'] : ""),
$phone['ContactsMethod']['preference'] . " / " .
$phone['ContactsMethod']['type'] . " / " .
$phone['type'],
$phone['comment']);
}
echo $this->element('table',
array('class' => 'item phone list',
'caption' => 'Phone',
'headers' => $headers,
'rows' => $rows,
'column_class' => $headers));
/**********************************************************************
* Addresses
*/
$headers = array('Address', 'Preference', 'Comment');
$rows = array();
foreach($addresses AS $address) {
$rows[] = array(preg_replace("/\n/", "<BR>\n", $address['address']) . "<BR>\n" .
$address['city'] . ", " .
$address['state'] . " " .
$address['postcode'],
//. ? "<BR>\n" . $address['country'],
$address['ContactsMethod']['preference'] . " / " .
$address['ContactsMethod']['type'],
$address['comment']);
}
echo $this->element('table',
array('class' => 'item address list',
'caption' => 'Address',
'headers' => $headers,
'rows' => $rows,
'column_class' => $headers));
/**********************************************************************
* Emails
*/
$headers = array('Email', 'Preference', 'Comment');
$rows = array();
foreach($emails AS $email) {
$rows[] = array($email['email'],
$email['ContactsMethod']['preference'] . " / " .
$email['ContactsMethod']['type'],
$email['comment']);
}
echo $this->element('table',
array('class' => 'item email list',
'caption' => 'Email',
'headers' => $headers,
'rows' => $rows,
'column_class' => $headers));
/**********************************************************************
* Customers
*/
echo $this->element('customers', array
(// Grid configuration
'config' => array
('caption' => 'Related Customers',
'filter' => array('Contact.id' => $contact['id']),
'include' => array('Relationship'),
)));
/* End "detail supporting" div */
echo '</div>' . "\n";
/* End page div */
echo '</div>' . "\n";