<?php
	
/* $Id: vcard_tel.php,v 1.1 2002/10/22 13:45:10 kfish Exp $ */

class VCard_TEL {

 /*
 Telephone Number
 This property specifies the canonical number string for a telephone number for telephony 
 communication with the vCard object. The value of this property is specified in a canonical 
 form in order to specify an unambiguous representation of the globally unique telephony endpoint. 
 This property is based on the X.520 Telephone Number attribute.
 The canonical form cannot be dialed without first being transformed by a dialing algorithm. 
 The dialing algorithm combines the canonical number string with knowledge of the local dialing 
 procedures, in effect at the time of call placement to produce actual dialing instructions. 
 The actual dialing algorithm is outside the scope of this specification.
 Two important canonical forms allowed by this specification are:
  * Apple Computer's Representation of a Canonical Static DeviceID in The Telephony Suite, version 1.0,
  * Microsoft TAPI in the Microsoft Windows 3.1 Telephony Programmer's Guide, version 1.0.
 Software which creates this property can store a string in these allowed formats. 
 Dialing software should be prepared to parse numbers from either of the supported formats; 
 as neither format is considered to be technically costly to support.

 This property is identified by the property name TEL. An example of this property follows:
  TEL;PREF;WORK;MSG;FAX:+1-800-555-1234
 Support for this property is OPTIONAL for vCard Writers conforming to this specification.
 Telephone Type
 This property parameter specifies the sub-type of telephone that is associated with the telephone number 
 (e.g., Home, Work, Cellular, Facsimile, Video, Modem, Message Service, or Preferred). 
 One or more sub-type values can be specified for a given telephone number.
 The property parameter can have one or more of the following values:

 Description
 Property Parameter Value
  TYPE=
 PREF  - Indicates preferred number
 WORK  - Indicates a work number
 HOME  - Indicates a home number
 VOICE - Indicates a voice number (Default)
 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
 VIDEO - Indicates a video-phone number

 The default property parameter is overridden to some other set of values by specifying one or more alternate values. 
 For example, the default of a VOICE telephone number can be reset to a WORK and HOME, VOICE and FAX telephone number 
 in the following example:
  TEL;WORK;HOME;VOICE;FAX:+1-800-555-1234

 */

    var $type;
    var $value;
 
    function setTeleNr($m_value) {
	$this->value = $m_value;
    }

    function getTeleNr() {
	return $this->value ;
    }
 
    function setIsPrefNumber() {
	$this->type["PREF"] = true;  
    }

    function resetPrefNumber() {
	$this->type["PREF"] = false;  
    }

    function IsPrefNumber() {
	return $this->type["PREF"];	
    }

    function setIsWorkNumber() {
	$this->type["WORK"] = true; 
    }

    function resetWorkNumber() {
	$this->type["WORK"] = false; 
    } 

    function IsWorkNumber() {
	return $this->type["WORK"];	
    }

    function setIsVoiceNumber() {
	$this->type["VOICE"] = true; 
    }

    function resetVoiceNumber() {
	$this->type["VOICE"] = false; 
    } 

    function IsVoiceNumber() {
	return $this->type["VOICE"];	
    }


    function setIsHomeNumber() {
	$this->type["HOME"] = true; 
    }
    
    function resetHomeNumber() {
	$this->type["HOME"] = false; 
    } 

    function IsHomeNumber() {
	return $this->type["HOME"];	
    }

    function setIsMobileNumber() {
	$this->type["CELL"] = true; 
    }

    function resetMobileNumber() {
	$this->type["CELL"] = false; 
    } 

    function IsMobileNumber() {
	return $this->type["CELL"];	
    }

    function setIsFaxNumber() {
	$this->type["FAX"] = true; 
    }

    function resetFaxNumber() {
	$this->type["FAX"] = false; 
    } 

    function IsFaxNumber() {
	return $this->type["FAX"];	
    }
  
    function getKey() {
	$tmpString = "TEL";
	while (list ($key, $val) = each ($this->type)) {
	    if ($val=="true"){
		$tmpString = $tmpString.";".$key;	
	    }
	}
	return $tmpString.":";
    }
 
    function VCard_TEL () {
	$this->type["PREF"] = false;
	$this->type["WORK"] = false;
	$this->type["HOME"] = false;
	$this->type["VOICE"] = true;
    }
}

class VCard_WorkTel extends VCard_TEL {
    function VCard_WorkTel($teleNr) {
	$this->setIsVoiceNumber();
	$this->setIsWorkNumber();
	$this->setTeleNr($teleNr); 
    }
}

class VCard_HomeTel extends VCard_TEL {
    function VCard_HomeTel($teleNr) {
	$this->setIsVoiceNumber();
	$this->setIsHomeNumber();
	$this->setTeleNr($teleNr); 
    }
}

class VCard_MobileTel extends VCard_TEL {
    function VCard_MobileTel($teleNr) {
	$this->setIsVoiceNumber();
	$this->setIsMobileNumber();
	$this->setTeleNr($teleNr); 
    }
}

class VCard_WorkFax extends VCard_TEL {
    function VCard_WorkFax($teleNr) {
	$this->setIsFaxNumber();
	$this->setIsWorkNumber();
	$this->setTeleNr($teleNr); 
    }
}

class VCard_HomeFax extends VCard_TEL {
    function VCard_HomeFax($teleNr) {
	$this->setIsFaxNumber();
	$this->setIsHomeNumber();
	$this->setTeleNr($teleNr); 
    }
}

?>