LABEL_NAME
LABEL_NAME
A contact has numerous properties (full name, nickname, title, company, division, role can belong to zero or more categories (which can be nested) and can have one or more objects some objects (name) can only exist once other objects can exist multiple times these objects each have a label and can be preferred names: if a fullname is set, it is used as the display name.
else if nickname is set, it is used as the display name else if a name object exists, it is formatted and used as the display name preferred: if no object of a certain type is set as 'preferred' then the first object of that type is returned. Multiple objects of a certain type can be preferred but only the first one will be returned when asking for the preferred object of a type. labels user defiend, but system may create numerous standard labels (i.e: home/work) labels cannot be empty.
Note: This class (and it's dependent classes) use heavy use of exceptions.
add_object(\CGContacts\contact_sub $object) : void
Add an object to the contact
| \CGContacts\contact_sub | $object | The object to add (must be a valid object) |
get_object(string $class_name, string $label) : \CGContacts\contact_sub
Get an object of a specific class with a specific label
| string | $class_name | |
| string | $label |
get_preferred_object(string $class_name) : \CGContacts\contact_sub
Get the preferred object of a certain class
Multiple objects of a class can be preferred. Or none. If no objects of the specified class are preferred, the first object of the specified class will be returned.
| string | $class_name |
set_name(string $prefix, string $first, string $middle, string $last, string $suffix) : void
Set the name associated with this contact
| string | $prefix | The prefix (i.e: Mr, Mrs. Dr, etc) |
| string | $first | The first name |
| string | $middle | The middle name (optional) |
| string | $last | The surname (optional) |
| string | $suffix | The suffix (i.e: PHD, B.S., P.Geo) |
get_name() : \CGContacts\contact_sub
Return the name object (if any) associated with this contact
add_email(string $email, string $label, bool $preferred) : void
Add an email address to this contact
Multiple email objects with the same label are permitted. and multiple preferred are permitted in the database.
| string | The email address |
|
| string | $label | The label |
| bool | $preferred | Wether this is the preferred email address |
insert_add_email(string $value, string $label, bool $preferred)
Set an email object with the specifiede label.
This method will first search email objects for the same label. if a match is found, it's value and preferred flag are updated. if no match is found, a new object is created.
| string | $value | |
| string | $label | |
| bool | $preferred |
get_preferred_email_obj() : \CGContacts\contact_email
Return the preferred email object (if any)
insert_add_phone(string $type, string $value, string $label, bool $preferred)
Set a phone object with the specifiede label and type.
This method will first search phone objects for the same label and type if a match is found, it's value and preferred flag are updated. if no match is found, a new object is created.
| string | $type | The type (one of voice,msg,fax,mobile,pager,video,satellite) |
| string | $value | |
| string | $label | |
| bool | $preferred |
get_phone_object(string $label) : \CGContacts\contact_sub
Get the first phone object with the specified label (if any)
| string | $label |
get_phone_object_by_type(string $type) : \CGContacts\contact_sub
Get first phone object of the specified type
| string | $type |
get_preferred_phone_obj() : \CGContacts\contact_sub
Get the first preferred phone object (if any)
add_address(string $street, string $pobox, string $city, string $state, string $zip, string $country, string $label, bool $preferred)
Add an address object manually.
Any of the values may be empty (except label). However, at least one value must be specified.
| string | $street | |
| string | $pobox | |
| string | $city | |
| string | $state | |
| string | $zip | |
| string | $country | |
| string | $label | |
| bool | $preferred |
insert_add_address(string $street, string $pobox, string $city, string $state, string $zip, string $country, string $label, bool $preferred)
Update an address object with the specified label.
If no address object with that label exists, create a new address record.
| string | $street | |
| string | $pobox | |
| string | $city | |
| string | $state | |
| string | $zip | |
| string | $country | |
| string | $label | |
| bool | $preferred |
get_address(string $label) : \CGContacts\contact_sub
Get an address with the specified label
| string | $label |
get_preferred_address() : \CGContacts\contact_sub
Return the preferred address
get_coords(string $label) : \CGContacts\contact_sub
Get the coordinates with the specified label (if any)
| string | $label |
get_preferred_coords() : \CGContacts\contact_sub
Get the preferred coordinates object (if any)
load_by_guid(string $uid) : \CGContacts\contact
Load the specified content object (by unique id)
The loaded object is cached so that subsequent requests for that contact will not hit the database
| string | $uid | The contact uid |