Пример #1
0
 function getAllEmails()
 {
     return ContactEmails::findAll(array('conditions' => array("`contact_id` = ?", $this->getId())));
 }
Пример #2
0
<?php

$genid = gen_id();
$contact = $object;
$hasEmailAddrs = false;
$main_email = $contact->getEmailAddress('personal');
$personal_emails = $contact->getContactEmails('personal');
$all_phones = ContactTelephones::findAll(array('conditions' => 'contact_id = ' . $contact->getId()));
$all_addresses = ContactAddresses::findAll(array('conditions' => 'contact_id = ' . $contact->getId()));
$all_webpages = ContactWebpages::findAll(array('conditions' => 'contact_id = ' . $contact->getId()));
$all_other_emails = ContactEmails::findAll(array('conditions' => 'is_main=0 AND contact_id = ' . $contact->getId()));
$all_telephone_types = TelephoneTypes::getAllTelephoneTypesInfo();
$all_address_types = AddressTypes::getAllAddressTypesInfo();
$all_webpage_types = WebpageTypes::getAllWebpageTypesInfo();
$all_email_types = EmailTypes::getAllEmailTypesInfo();
// types ordered
$all_type_codes = array('work', 'mobile', 'home', 'personal', 'other', 'assistant', 'callback', 'pager', 'fax');
$all_types_by_code = array();
foreach ($all_type_codes as $code) {
    $t = null;
    foreach ($all_telephone_types as $type) {
        if ($type['code'] == $code) {
            $t = $type;
        }
    }
    if (!$t) {
        foreach ($all_address_types as $type) {
            if ($type['code'] == $code) {
                $t = $type;
            }
        }