Location: PHPKode > scripts > IMC Objects > imc-objects/class.imcVCard.php
<?
/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// | PHP version 4                                                        |
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2003 The PHP Group                                |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the PHP license,       |
// | that is bundled with this package in the file LICENSE, and is        |
// | available through the world-wide-web at                              |
// | http://www.php.net/license/2_02.txt.                                 |
// | If you did not receive a copy of the PHP license and are unable to   |
// | obtain it through the world-wide-web, please send a note to          |
// | hide@address.com so we can mail you a copy immediately.               |
// +----------------------------------------------------------------------+
// | Authors: Andreas Haberstroh <hide@address.com>                      |
// +----------------------------------------------------------------------+
//
// $Id$

require_once('class.imcComponent.php');
require_once('class.imcProperty.php');
require_once('class.imcPropertyN.php');
require_once('class.imcPropertyADR.php');

class	imc_vCard    extends imcComponent
{
    function    imc_vCard() {

        $this->imcComponent();
        $this->setComponentName('VCARD');
    }

    /**
    *   Property factory to build the named property
    *   Used by the readFile function
    *
    *   @param  string  Name of the property to build
    *   @param  object  Property Object to return
    */
    function    _propertyFactory( $typedef, &$propertyObject ) {

        switch( $typedef ) {
        case 'N':
            $propertyObject = new imcPropertyN();
            break;
        
        case 'ADR':
            $propertyObject = new imcPropertyAdr();
            break;

        default:
            $propertyObject = new imcProperty();
        }
    }

    // {{{ setVersion
    /**
    *   Sets the version. Used to identify the IMC base spec
    *
    *   @param  string  Version string
    *   @see    getVersion
    */
    function    setVersion($version) {

        $this->getProperty('VERSION', $propertyObject, 0);
        $propertyObject->setValue($version);
        $this->setProperty('VERSION', $propertyObject, 0);
    }

    // {{{ getVersion
    /**
    *   Gets the version. Used to identify the IMC base spec
    *
    *   @return string  Version string
    *   @see    setVersion
    */
    function    getVersion() {

        $this->getProperty('VERSION', $propertyObject, 0);
        return $propertyObject->getValue();
    }

    // {{{ setN
    /**
    *   Sets the N property value
    *
    *   @param  string  N Property string
    *   @see    getN
    */
    function    setN($n) {

        $this->getProperty('N', $propertyObject, 0);
        $propertyObject->setEncodedValue($n);
        $this->setProperty('N', $propertyObject, 0);
    }

    // {{{ getN
    /**
    *   Gets the N property value
    *
    *   @return string  N Property string
    *   @see    setN
    */
    function    getN() {

        $this->getProperty('N', $propertyObject, 0);
        return $propertyObject->getEncodedValue();
    }


    // {{{ setFamilyName
    /**
    *   Sets the last name of the vcard
    *
    *   @param  string  Last name value
    *   @see    getFamilyName
    */
    function    setFamilyName($value) {

        $this->getProperty('N', $propertyObject, 0);
        $propertyObject->setFamilyName($value);
        $this->setProperty('N', $propertyObject, 0);
    }

    // {{{ getFamilyName
    /**
    *   Gets the last name of the vcard
    *
    *   @return string  Last name value
    *   @see    setFamilyName
    */
    function    getFamilyName() {

        $this->getProperty('N', $propertyObject, 0);
        return $propertyObject->getFamilyName();
    }

    // {{{ setGivenName
    /**
    *   Sets the first name of the vcard
    *
    *   @param  string  First name value
    *   @see    getGivenName
    */
    function    setGivenName($value) 
    {
        $this->getProperty('N', $propertyObject, 0);
        $propertyObject->setGivenName($value);
        $this->setProperty('N', $propertyObject, 0);
    }

    // {{{ getGivenName
    /**
    *   Gets the first name of the vcard
    *
    *   @return string  First name value
    *   @see    setGivenName
    */
    function    getGivenName() {

        $this->getProperty('N', $propertyObject, 0);
        return $propertyObject->getGivenName();
    }

    // {{{ setAdditionalNames
    /**
    *   Sets the middle name of the vcard
    *
    *   @param  string  Middle name value
    *   @see    getAdditionalNames
    */
    function    setAdditionalNames($value) {

        $this->getProperty('N', $propertyObject, 0);
        $propertyObject->setAdditionalNames($value);
        $this->setProperty('N', $propertyObject, 0);
    }

    // {{{ getAdditionalNames
    /**
    *   Gets the middle name of the vcard
    *
    *   @return string  Middle name value
    *   @see    setAdditionalNames
    */
    function    getAdditionalNames() {

        $this->getProperty('N', $propertyObject, 0);
        return $propertyObject->getAdditionalNames();
    }

    // {{{ setNamePrefix
    /**
    *   Sets the prefix of the vcard
    *   Common values are: Mr., Mrs., Ms., etc.
    *
    *   @param  string  Middle name value
    *   @see    getNamePrefix
    */
    function    setNamePrefix($value) {
        
        $this->getProperty('N', $propertyObject, 0);
        $propertyObject->setNamePrefix($value);
        $this->setProperty('N', $propertyObject, 0);
    }

    // {{{ getNamePrefix
    /**
    *   Gets the prefix of the vcard
    *
    *   @return string  Middle name value
    *   @see    setNamePrefix
    */
    function    getNamePrefix() {

        $this->getProperty('N', $propertyObject, 0);
        return $propertyObject->getNamePrefix();
    }

    // {{{ setNameSuffix
    /**
    *   Sets the suffix of the vcard
    *   Common values are: Jr., Sr., I, II and III
    *
    *   @param  string  Middle name value
    *   @see    getNameSuffix
    */
    function    setNameSuffix($value) {

        $this->getProperty('N', $propertyObject, 0);
        $propertyObject->setNameSuffix($value);
        $this->setProperty('N', $propertyObject, 0);
    }

    // {{{ getNameSuffix
    /**
    *   Gets the suffix of the vcard
    *
    *   @return string  Middle name value
    *   @see    setNameSuffix
    */
    function    getNameSuffix() {

        $this->getProperty('N', $propertyObject, 0);
        return $propertyObject->getNameSuffix();
    }


    // {{{ setFN
    /**
    *   Sets the full name value of the vcard
    *
    *   @param  string  Full name value
    *   @see    getFN
    */
    function    setFN($value) {
    
        $this->getProperty('FN', $propertyObject, 0);
        $propertyObject->setValue($value);
        $this->setProperty('FN', $propertyObject, 0);
    }

    // {{{ getFN
    /**
    *   Gets the full name value of the vcard
    *
    *   @return string  Full name value
    *   @see    setFN
    */
    function    getFN() {

        $this->getProperty('FN', $propertyObject, 0);
        return $propertyObject->getValue();
    }

    // {{{ setPostOfficeAddress
    /**
    *   Sets the Post Office Box value of the vcard's address
    *
    *   @param  string  Value to set
    *   @param  mixed   Identifies the Delivery Address Type. This can be a
    *                   single string, array of strings or '-1' for the first
    *                   type found. Use the following acceptable values:
    *
    *           DOM     - Indicates a domestic address
    *           INTL    - Indicates an international address
    *           POSTAL  - Indicates a postal delivery address
    *           PARCEL  - Indicates a parcel delivery address
    *           HOME    - Indicates a home delivery address
    *           WORK    - Indicates a work delivery address
    *
    *   @see    getPostOfficeAddress
    */
    function    setPostOfficeAddress( $adr, $type = '-1') {

        $seq = $this->findPropertySequenceByType('ADR', $type);
        if( $seq == -1 )
            $seq = $this->getPropertyCount('ADR');

        $this->getProperty('ADR', $propertyObject, $seq);
        
        $propertyObject->setParamType($type);
        $propertyObject->setPostOfficeAddress($adr);

        $this->setProperty('ADR', $propertyObject, $seq);
    }

    // {{{ getPostOfficeAddress
    /**
    *   Gets the Post Office Box value of the vcard's address
    *
    *   @param  mixed   Identifies the Delivery Address Type. This can be a
    *                   single string, array of strings or '-1' for the first
    *                   type found. Use the following acceptable values:
    *
    *           DOM     - Indicates a domestic address
    *           INTL    - Indicates an international address
    *           POSTAL  - Indicates a postal delivery address
    *           PARCEL  - Indicates a parcel delivery address
    *           HOME    - Indicates a home delivery address
    *           WORK    - Indicates a work delivery address
    *
    *   @return string  Value to get
    *   @see    setPostOfficeAddress
    */
    function    getPostOfficeAddress( $type = '-1') {

        $seq = $this->findPropertySequenceByType('ADR', $type);
        if( $seq == -1 )
            return '';

        $this->getProperty('ADR', $propertyObject, $seq);
        return $propertyObject->getPostOfficeAddress();
    }

    // {{{ setExtendedAddress
    /**
    *   Sets the Extended address value of the vcard's address
    *
    *   @param  string  Value to set
    *   @param  mixed   Identifies the Delivery Address Type. This can be a
    *                   single string, array of strings or '-1' for the first
    *                   type found. Use the following acceptable values:
    *
    *           DOM     - Indicates a domestic address
    *           INTL    - Indicates an international address
    *           POSTAL  - Indicates a postal delivery address
    *           PARCEL  - Indicates a parcel delivery address
    *           HOME    - Indicates a home delivery address
    *           WORK    - Indicates a work delivery address
    *
    *   @see    getExtendedAddress
    */
    function    setExtendedAddress( $adr, $type = '-1') {

        $seq = $this->findPropertySequenceByType('ADR', $type);
        if( $seq == -1 )
            $seq = $this->getPropertyCount('ADR');

        $this->getProperty('ADR', $propertyObject, $seq);
        
        $propertyObject->setParamType($type);
        $propertyObject->setExtendedAddress($adr);

        $this->setProperty('ADR', $propertyObject, $seq);
    }

    // {{{ getExtendedAddress
    /**
    *   Gets the Extended address value of the vcard's address
    *
    *   @param  mixed   Identifies the Delivery Address Type. This can be a
    *                   single string, array of strings or '-1' for the first
    *                   type found. Use the following acceptable values:
    *
    *           DOM     - Indicates a domestic address
    *           INTL    - Indicates an international address
    *           POSTAL  - Indicates a postal delivery address
    *           PARCEL  - Indicates a parcel delivery address
    *           HOME    - Indicates a home delivery address
    *           WORK    - Indicates a work delivery address
    *
    *   @return string  Value to get
    *   @see    setExtendedAddress
    */
    function    getExtendedAddress( $type = '-1' ) {

        $seq = $this->findPropertySequenceByType('ADR', $type);
        if( $seq == -1 )
            return '';

        $this->getProperty('ADR', $propertyObject, $seq);
        return $propertyObject->getExtendedAddress();
    }

    // {{{ setStreetAddress
    /**
    *   Sets the street value of the vcard's address
    *
    *   @param  string  Value to set
    *   @param  mixed   Identifies the Delivery Address Type. This can be a
    *                   single string, array of strings or '-1' for the first
    *                   type found. Use the following acceptable values:
    *
    *           DOM     - Indicates a domestic address
    *           INTL    - Indicates an international address
    *           POSTAL  - Indicates a postal delivery address
    *           PARCEL  - Indicates a parcel delivery address
    *           HOME    - Indicates a home delivery address
    *           WORK    - Indicates a work delivery address
    *
    *   @see    getExtendedAddress
    */
    function    setStreetAddress( $adr, $type = '-1' ) {

        $seq = $this->findPropertySequenceByType('ADR', $type);
        if( $seq == -1 )
            $seq = $this->getPropertyCount('ADR');

        $this->getProperty('ADR', $propertyObject, $seq);
        
        $propertyObject->setParamType($type);
        $propertyObject->setStreetAddress($adr);

        $this->setProperty('ADR', $propertyObject, $seq);
    }

    // {{{ getStreetAddress
    /**
    *   Gets the street value of the vcard's address
    *
    *   @param  mixed   Identifies the Delivery Address Type. This can be a
    *                   single string, array of strings or '-1' for the first
    *                   type found. Use the following acceptable values:
    *
    *           DOM     - Indicates a domestic address
    *           INTL    - Indicates an international address
    *           POSTAL  - Indicates a postal delivery address
    *           PARCEL  - Indicates a parcel delivery address
    *           HOME    - Indicates a home delivery address
    *           WORK    - Indicates a work delivery address
    *
    *   @return string  Value to get
    *   @see    setStreetAddress
    */
    function    getStreetAddress( $type = '-1' ) {

        $seq = $this->findPropertySequenceByType('ADR', $type);
        if( $seq == -1 )
            return '';

        $this->getProperty('ADR', $propertyObject, $seq);
        return $propertyObject->getStreetAddress();
    }

    // {{{ setLocality
    /**
    *   Sets the locality value of the vcard's address
    *   This is normally the City
    *
    *   @param  string  Value to set
    *   @param  mixed   Identifies the Delivery Address Type. This can be a
    *                   single string, array of strings or '-1' for the first
    *                   type found. Use the following acceptable values:
    *
    *           DOM     - Indicates a domestic address
    *           INTL    - Indicates an international address
    *           POSTAL  - Indicates a postal delivery address
    *           PARCEL  - Indicates a parcel delivery address
    *           HOME    - Indicates a home delivery address
    *           WORK    - Indicates a work delivery address
    *
    *   @see    getLocality
    */
    function    setLocality( $adr, $type = '-1' ) {

        $seq = $this->findPropertySequenceByType('ADR', $type);
        if( $seq == -1 )
            $seq = $this->getPropertyCount('ADR');

        $this->getProperty('ADR', $propertyObject, $seq);
        
        $propertyObject->setParamType($type);
        $propertyObject->setLocality($adr);

        $this->setProperty('ADR', $propertyObject, $seq);
    }

    // {{{ getLocality
    /**
    *   Gets the locality value of the vcard's address
    *   This is normally the City
    *
    *   @param  mixed   Identifies the Delivery Address Type. This can be a
    *                   single string, array of strings or '-1' for the first
    *                   type found. Use the following acceptable values:
    *
    *           DOM     - Indicates a domestic address
    *           INTL    - Indicates an international address
    *           POSTAL  - Indicates a postal delivery address
    *           PARCEL  - Indicates a parcel delivery address
    *           HOME    - Indicates a home delivery address
    *           WORK    - Indicates a work delivery address
    *
    *   @return string  Value to get
    *   @see    setLocality
    */
    function    getLocality( $type = '-1' ) {

        $seq = $this->findPropertySequenceByType('ADR', $type);
        if( $seq == -1 )
            return '';

        $this->getProperty('ADR', $propertyObject, $seq);
        return $propertyObject->getLocality();
    }

    // {{{ setRegion
    /**
    *   Sets the region value of the vcard's address
    *   This is normally the State
    *
    *   @param  string  Value to set
    *   @param  mixed   Identifies the Delivery Address Type. This can be a
    *                   single string, array of strings or '-1' for the first
    *                   type found. Use the following acceptable values:
    *
    *           DOM     - Indicates a domestic address
    *           INTL    - Indicates an international address
    *           POSTAL  - Indicates a postal delivery address
    *           PARCEL  - Indicates a parcel delivery address
    *           HOME    - Indicates a home delivery address
    *           WORK    - Indicates a work delivery address
    *
    *   @see    getRegion
    */
    function    setRegion( $adr, $type = '-1' ) {

        $seq = $this->findPropertySequenceByType('ADR', $type);
        if( $seq == -1 )
            $seq = $this->getPropertyCount('ADR');

        $this->getProperty('ADR', $propertyObject, $seq);
        
        $propertyObject->setParamType($type);
        $propertyObject->setRegion($adr);

        $this->setProperty('ADR', $propertyObject, $seq);
    }

    // {{{ getRegion
    /**
    *   Sets the region value of the vcard's address
    *
    *   @param  mixed   Identifies the Delivery Address Type. This can be a
    *                   single string, array of strings or '-1' for the first
    *                   type found. Use the following acceptable values:
    *
    *           DOM     - Indicates a domestic address
    *           INTL    - Indicates an international address
    *           POSTAL  - Indicates a postal delivery address
    *           PARCEL  - Indicates a parcel delivery address
    *           HOME    - Indicates a home delivery address
    *           WORK    - Indicates a work delivery address
    *
    *   @return string  Value to get
    *   @see    setRegion
    */
    function    getRegion( $type = '-1' ) {

        $seq = $this->findPropertySequenceByType('ADR', $type);
        if( $seq == -1 )
            return '';

        $this->getProperty('ADR', $propertyObject, $seq);
        return $propertyObject->getRegion();
    }

    // {{{ setPostalCode
    /**
    *   Sets the postal code value of the vcard's address
    *   This is normally the Zip code
    *
    *   @param  string  Value to set
    *   @param  mixed   Identifies the Delivery Address Type. This can be a
    *                   single string, array of strings or '-1' for the first
    *                   type found. Use the following acceptable values:
    *
    *           DOM     - Indicates a domestic address
    *           INTL    - Indicates an international address
    *           POSTAL  - Indicates a postal delivery address
    *           PARCEL  - Indicates a parcel delivery address
    *           HOME    - Indicates a home delivery address
    *           WORK    - Indicates a work delivery address
    *
    *   @see    getPostalCode
    */
    function    setPostalCode( $adr, $type = '-1' ) {

        $seq = $this->findPropertySequenceByType('ADR', $type);
        if( $seq == -1 )
            $seq = $this->getPropertyCount('ADR');

        $this->getProperty('ADR', $propertyObject, $seq);
        
        $propertyObject->setParamType($type);
        $propertyObject->setPostalCode($adr);

        $this->setProperty('ADR', $propertyObject, $seq);
    }

    // {{{ getPostalCode
    /**
    *   Gets the postal code value of the vcard's address
    *
    *   @param  mixed   Identifies the Delivery Address Type. This can be a
    *                   single string, array of strings or '-1' for the first
    *                   type found. Use the following acceptable values:
    *
    *           DOM     - Indicates a domestic address
    *           INTL    - Indicates an international address
    *           POSTAL  - Indicates a postal delivery address
    *           PARCEL  - Indicates a parcel delivery address
    *           HOME    - Indicates a home delivery address
    *           WORK    - Indicates a work delivery address
    *
    *   @return string  Value to get
    *   @see    setPostalCode
    */
    function    getPostalCode( $type = '-1' ) {

        $seq = $this->findPropertySequenceByType('ADR', $type);
        if( $seq == -1 )
            return '';

        $this->getProperty('ADR', $propertyObject, $seq);
        return $propertyObject->getPostalCode();
    }

    // {{{ setCountry
    /**
    *   Sets the country value of the vcard's address
    *
    *   @param  string  Value to set
    *   @param  mixed   Identifies the Delivery Address Type. This can be a
    *                   single string, array of strings or '-1' for the first
    *                   type found. Use the following acceptable values:
    *
    *           DOM     - Indicates a domestic address
    *           INTL    - Indicates an international address
    *           POSTAL  - Indicates a postal delivery address
    *           PARCEL  - Indicates a parcel delivery address
    *           HOME    - Indicates a home delivery address
    *           WORK    - Indicates a work delivery address
    *
    *   @see    getCountry
    */
    function    setCountry( $adr, $type = '-1' ) {

        $seq = $this->findPropertySequenceByType('ADR', $type);
        if( $seq == -1 )
            $seq = $this->getPropertyCount('ADR');

        $this->getProperty('ADR', $propertyObject, $seq);
        
        $propertyObject->setParamType($type);
        $propertyObject->setCountry($adr);

        $this->setProperty('ADR', $propertyObject, $seq);    
    }

    // {{{ getCountry
    /**
    *   Gets the country value of the vcard's address
    *
    *   @param  mixed   Identifies the Delivery Address Type. This can be a
    *                   single string, array of strings or '-1' for the first
    *                   type found. Use the following acceptable values:
    *
    *           DOM     - Indicates a domestic address
    *           INTL    - Indicates an international address
    *           POSTAL  - Indicates a postal delivery address
    *           PARCEL  - Indicates a parcel delivery address
    *           HOME    - Indicates a home delivery address
    *           WORK    - Indicates a work delivery address
    *
    *   @return string  Value to get
    *   @see    setCountry
    */
    function    getCountry( $type = '-1' ) {

        $seq = $this->findPropertySequenceByType('ADR', $type);
        if( $seq == -1 )
            return '';

        $this->getProperty('ADR', $propertyObject, $seq);
        return $propertyObject->getCountry();
    }

    // {{{ setLabel
    /**
    *   Sets the address mailing label for the vcard.
    *
    *   @param  string  Mailling label to set
    *   @param  mixed   Identifies the Delivery Address Type. This can be a
    *                   single string, array of strings or '-1' for the first
    *                   type found. Use the following acceptable values:
    *
    *           DOM     - Indicates a domestic address
    *           INTL    - Indicates an international address
    *           POSTAL  - Indicates a postal delivery address
    *           PARCEL  - Indicates a parcel delivery address
    *           HOME    - Indicates a home delivery address
    *           WORK    - Indicates a work delivery address
    *
    *   @see    getLabel
    */
    function    setLabel($label, $type = '-1' ) {

        $seq = $this->findPropertySequenceByType('LABEL', $type);
        if( $seq == -1 )
            $seq = $this->getPropertyCount('LABEL');

        $this->getProperty('LABEL', $propertyObject, $seq);
        
        $propertyObject->setParamType($type);
        $propertyObject->setValue($adr);

        $this->setProperty('LABEL', $propertyObject, $seq);
    }

    // {{{ getLabel
    /**
    *   Gets the address mailing label for the vcard.
    *
    *   @param  mixed   Identifies the Delivery Address Type. This can be a
    *                   single string, array of strings or '-1' for the first
    *                   type found. Use the following acceptable values:
    *
    *           DOM     - Indicates a domestic address
    *           INTL    - Indicates an international address
    *           POSTAL  - Indicates a postal delivery address
    *           PARCEL  - Indicates a parcel delivery address
    *           HOME    - Indicates a home delivery address
    *           WORK    - Indicates a work delivery address
    *
    *   @return string  Mailling label to set
    *   @see    setLabel
    */
    function    getLabel( $type = '-1' ) {

        $seq = $this->findPropertySequenceByType('LABEL', $type);
        if( $seq == -1 )
            return '';

        $this->getProperty('LABEL', $propertyObject, $seq);
        return $propertyObject->getValue();
    }

    // {{{ setTelephone
    /**
    *   Sets the telephone number for the vcard.
    *
    *   @param  string  Telephone number to set
    *   @param  mixed   Identifies the telephone association type. This can be a
    *                   single string, array of strings or '-1' for the first
    *                   type found. Use the following acceptable values:
    *
    *           PREF    - Indicates preferred number
    *           WORK    - Indicates a work number
    *           HOME    - Indicates a home number
    *           VOICE   - Indicates a voice number
    *           FAX     - Indicates a facsimile number
    *           MSG     - Indicates a messaging service on the number
    *           CELL    - Indicates a cellular number
    *           PAGER   - Indicates a pager number
    *           BBS     - Indicates a bulletin board service number
    *           MODEM   - Indicates a MODEM number
    *           CAR     - Indicates a car-phone number
    *           ISDN    - Indicates an ISDN number
    *
    *
    *   @see    getTelephone
    */
    function    setTelephone($tel, $type = '-1' ) {

        $seq = $this->findPropertySequenceByType('TEL', $type);
        if( $seq == -1 )
            $seq = $this->getPropertyCount('TEL');

        $this->getProperty('TEL', $propertyObject, $seq);
        
        $propertyObject->setParamType($type);
        $propertyObject->setValue($tel);

        $this->setProperty('TEL', $propertyObject, $seq);
    }

    // {{{ getTelephone
    /**
    *   Gets the telephone number for the vcard.
    *
    *   @param  mixed   Identifies the telephone association type. This can be a
    *                   single string, array of strings or '-1' for the first
    *                   type found. Use the following acceptable values:
    *
    *           PREF    - Indicates preferred number
    *           WORK    - Indicates a work number
    *           HOME    - Indicates a home number
    *           VOICE   - Indicates a voice number
    *           FAX     - Indicates a facsimile number
    *           MSG     - Indicates a messaging service on the number
    *           CELL    - Indicates a cellular number
    *           PAGER   - Indicates a pager number
    *           BBS     - Indicates a bulletin board service number
    *           MODEM   - Indicates a MODEM number
    *           CAR     - Indicates a car-phone number
    *           ISDN    - Indicates an ISDN number
    *
    *   @return string  Telephone number to get
    *   @see    setTelephone
    */
    function    getTelephone( $type = '-1' ) {

        $seq = $this->findPropertySequenceByType('TEL', $type);
        if( $seq == -1 )
            return '';

        $this->getProperty('TEL', $propertyObject, $seq);
        return $propertyObject->getValue();
    }

    // {{{ setEmail
    /**
    *   Sets the email address for the vcard.
    *
    *   @param  string  Email address to set
    *   @param  mixed   Identifies the email address association type. 
    *                   This can be a single string, array of strings 
    *                   or '-1' for the first type found. Use the following 
    *                   acceptable values:
    *
    *           AOL         - Indicates America On-Line
    *           AppleLink   - Indicates AppleLink
    *           ATTMail     - Indicates AT&T Mail
    *           CIS         - Indicates CompuServe Information Service
    *           eWorld      - Indicates eWorld
    *           INTERNET    - Indicates Internet SMTP
    *           IBMMail     - Indicates IBM Mail
    *           MCIMail     - Indicates MCI Mail
    *           POWERSHARE  - Indicates PowerShare	
    *           PRODIGY     - Indicates Prodigy information service
    *           TLX         - Indicates Telex number
    *           X400        - Indicates X.400 service
    *
    *   @see    getEmail
    */
    function    setEmail($email, $type = '-1' ) {

        $seq = $this->findPropertySequenceByType('EMAIL', $type);
        if( $seq == -1 )
            $seq = $this->getPropertyCount('EMAIL');

        $this->getProperty('EMAIL', $propertyObject, $seq);
        
        $propertyObject->setParamType($type);
        $propertyObject->setValue($email);

        $this->setProperty('EMAIL', $propertyObject, $seq);
    }

    // {{{ getEmail
    /**
    *   Gets the email address for the vcard.
    *
    *   @param  mixed   Identifies the email address association type. 
    *                   This can be a single string, array of strings 
    *                   or '-1' for the first type found. Use the following 
    *                   acceptable values:
    *
    *           AOL         - Indicates America On-Line
    *           AppleLink   - Indicates AppleLink
    *           ATTMail     - Indicates AT&T Mail
    *           CIS         - Indicates CompuServe Information Service
    *           eWorld      - Indicates eWorld
    *           INTERNET    - Indicates Internet SMTP
    *           IBMMail     - Indicates IBM Mail
    *           MCIMail     - Indicates MCI Mail
    *           POWERSHARE  - Indicates PowerShare	
    *           PRODIGY     - Indicates Prodigy information service
    *           TLX         - Indicates Telex number
    *           X400        - Indicates X.400 service
    *
    *   @return string  Email address to get
    *   @see    setEmail
    */
    function    getEmail( $type = '-1' ) {

        $seq = $this->findPropertySequenceByType('EMAIL', $type);
        if( $seq == -1 )
            return '';

        $this->getProperty('EMAIL', $propertyObject, $seq);
        return $propertyObject->getValue();
    }

    // {{{ setNote()
    /**
    *   Sets the note property for this vcard.
    *
    *   @param  string  Note value to set
    *   @see    getNote
    */
    function    setNote($note) { 
    
        $this->getProperty('NOTE', $propertyObject, 0);
        
        $propertyObject->setValue($note);

        $this->setProperty('NOTE', $propertyObject, $seq);
    }

    // {{{ getNote()
    /**
    *   Gets the note property for this vcard.
    *
    *   @return string  Note value to get
    *   @see    getNote
    */
    function    getNote() {
        
        $this->getProperty('NOTE', $propertyObject, 0);
        return $propertyObject->getValue();
    }

    // {{{ setPhoto()
    /**
    *   Sets the photo which is related to this vcard.
    *       Right now, we only allow 1 photo per vcard
    *
    *   @param  string  Type of photo - JPG/GIF
    *   @param  string  Data value - could be raw data OR url
    *   @param  string  What the value type is - URL or ''
    *   @see    getPhoto
    */
    function    setPhoto($type, $data, $value = '') {

        $this->getProperty('PHOTO', $propertyObject, 0);

        $propertyObject->setParamType(array($type));
        $propertyObject->setParamValue(array($value));
        if( $value == 'URL' ) {
            $propertyObject->setParamEncoding(NULL);
        } else {
            $propertyObject->setParamEncoding('BASE64');
        }

        $propertyObject->setValue($data);

        $this->setProperty('PHOTO', $propertyObject, 0);
    }

    // {{{ getPhoto()
    /**
    *   Gets the photo which is related to this vcard.
    *       Right now, we only allow 1 photo per vcard
    *
    *   @param  string  Type of photo - JPG/GIF
    *   @param  string  Data value - could be raw data OR url
    *   @param  string  What the value type is - URL or ''
    *   @see    getPhoto
    */
    function    getPhoto(&$type, &$data, &$value) {
        $this->getProperty('PHOTO', $propertyObject, 0);

        $array = $propertyObject->getParamType();
        $type   = $array[0];

        $array = $propertyObject->getParamValue();
        $value  = $array[0]; 
        $data   = $propertyObject->getValue();
    }
}
?>
Return current item: IMC Objects