PHP 클래스 Turba_Driver, horde

저자: Chuck Hagenbuch ([email protected])
저자: Jon Parise ([email protected])
상속: implements Countable
파일 보기 프로젝트 열기: horde/horde 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$alternativeName string The name of a field to use as an alternative to the name field if that one is empty.
$approximate array Array of fields to search "approximately" (@see config/backends.php).
$fields array List of all fields that can be accessed in the backend (excludes composite attributes, etc.).
$listNameField string The name of a field to store contact list names in if not the default.
$map array Hash describing the mapping between Turba attributes and driver-specific fields.
$strict array Array of fields that must match exactly.
$tabs array Hash with all tabs and their fields.
$title string The symbolic title of this source.

보호된 프로퍼티들

프로퍼티 타입 설명
$_asMap array Mapping of Turba attributes to ActiveSync fields.
$_capabilities array What can this backend do?
$_contact_owner string Hold the value for the owner of this address book.
$_count integer Number of contacts in this source.
$_name string The internal name of this source.
$_objectOptions array Any additional options passed to Turba_Object constructors.
$_params array Hash holding the driver's additional parameters.

공개 메소드들

메소드 설명
__construct ( string $name = '', array $params = [] ) Constructs a new Turba_Driver object.
add ( array $attributes ) : string Adds a new entry to the contact source.
canAdd ( ) : boolean Returns ability of the backend to add new contacts.
checkDefaultShare ( Horde_Share_Object $share, array $srcconfig ) : boolean Check if the passed in share is the default share for this source.
count ( ) : integer Returns the number of contacts of the current user in this address book.
createShare ( string $share_name, array $params ) : Horde_Share Creates a new Horde_Share for this source type.
delete ( string $object_id, boolean $remove_tags = true ) Deletes the specified entry from the contact source.
deleteAll ( string $sourceName = null ) Deletes all contacts from an address book.
fromASContact ( Horde_ActiveSync_Message_Contact $message ) : array Convert an ActiveSync contact message into a hash suitable for importing via self::add().
getBlobs ( ) : array Returns the attributes that are blob types.
getContactOwner ( ) : string Return the owner to use when searching or creating contacts in this address book.
getCriteria ( ) : array Returns the criteria available for this source except '__key'.
getDateFields ( ) : array Returns the attributes that represent dates.
getFields ( ) : array Returns all non-composite fields for this source. Useful for importing and exporting data, etc.
getName ( ) Return the name of this address book.
getObject ( string $objectId ) : Turba_Object Retrieves one object from the source.
getObjects ( array $objectIds ) : array Retrieves a set of objects from the source.
getParams ( ) : array Returns the current driver's additional parameters.
getTimeObjectTurbaList ( Horde_Date $start, Horde_Date $end, string $field ) : Turba_List Default implementation for obtaining a Turba_List to get TimeObjects out of.
hasCapability ( string $capability ) : boolean Checks if this backend has a certain capability.
hasPermission ( integer $perm ) : boolean Checks if the current user has the requested permissions on this address book.
listTimeObjects ( Horde_Date $start, Horde_Date $end, string $category ) : array Returns a list of birthday or anniversary hashes from this source for a certain period.
makeSearch ( array $criteria, string $search_type, array $strict, boolean $match_begin = false, array $custom_strict = [] ) : array Takes a hash of Turba key => search value and return a (possibly nested) array, using backend attribute names, that can be turned into a search by the driver. The translation is based on the contents of $this->map, and includes nested OR searches for composite fields.
removeUserData ( string $user ) Remove all entries owned by the specified user.
save ( Turba_Object $object ) : string Modifies an existing entry in the contact source.
search ( array $search_criteria, string $sort_order = null, string $search_type = 'AND', array $return_fields = [], array $custom_strict = [], boolean $match_begin = false, boolean $count_only = false ) : mixed Searches the source based on the provided criteria.
searchDuplicates ( ) : array Searches the current address book for duplicate entries.
setContactOwner ( string $owner ) Override the contactOwner setting for this driver.
setDefaultShare ( string $share ) Runs any actions after setting a new default tasklist.
setSourceName ( string $name ) Override the name setting for this driver.
synchronize ( mixed $token = false ) Synchronize, if needed.
toASContact ( Turba_Object $object, array $options = [] ) : Horde_ActiveSync_Message_Contact Convert the contact to an ActiveSync contact message
toDriver ( string $attribute ) : string Translates a single Turba attribute to the driver-specific counterpart. The translation is based on the contents of $this->map. This ignores composite fields.
toDriverKeys ( array $hash ) : array Translates the keys of the first hash from the generalized Turba attributes to the driver-specific fields. The translation is based on the contents of $this->map.
toHash ( Horde_Icalendar_Vcard $vcard ) : array Function to convert a Horde_Icalendar_Vcard object into a Turba Object Hash with Turba attributes suitable as a parameter for add().
toTurbaKeys ( array $entry ) : array Translates a hash from being keyed on driver-specific fields to being keyed on the generalized Turba attributes. The translation is based on the contents of $this->map.
tovCard ( Turba_Object $object, string $version = '2.1', array $fields = null, boolean $skipEmpty = false ) : Horde_Icalendar_Vcard Exports a given Turba_Object as an iCalendar vCard.

보호된 메소드들

메소드 설명
_add ( array $attributes, array $blob_fields = [], array $date_fields = [] ) Adds the specified contact to the addressbook.
_canAdd ( ) : boolean Returns ability of the backend to add new contacts.
_delete ( string $object_key, string $object_id ) Deletes the specified contact from the addressbook.
_deleteAll ( ) : array Deletes all contacts from an address book.
_filterTags ( array $objects, array $tags, Array $sort_order = null ) : Turba_List Returns a Turba_List object containing $objects filtered by $tags.
_getContactOwner ( ) : string Return the owner to use when searching or creating contacts in this address book.
_getTimeObjectTurbaListFallback ( Horde_Date $start, Horde_Date $end, string $field ) : Turba_List Default implementation for obtaining a Turba_List to get TimeObjects out of.
_guessName ( array &$hash ) Helper function for guessing name parts from a single name string.
_hasValEnum ( array $valEnum, string $type ) : boolean Returns whether a ValEnum entry from a DevInf object contains a certain type.
_init ( ) Initialize the driver.
_makeKey ( array $attributes ) : string Creates an object key for a new object.
_makeUid ( ) : string Creates an object UID for a new object.
_read ( string $key, mixed $ids, string $owner, array $fields, array $blobFields = [], array $dateFields = [] ) : array Reads the given data from the address book and returns the results.
_save ( Turba_Object $object ) : string Saves the specified object in the SQL database.
_search ( array $criteria, array $fields, array $blobFields = [], boolean $count_only = false ) : array Searches the address book with the given criteria and returns a filtered list of results. If the criteria parameter is an empty array, all records will be returned.
_toTurbaObjects ( array $objects, array $sort_order = null ) : Turba_List Takes an array of object hashes and returns a Turba_List containing the correct Turba_Objects

메소드 상세

__construct() 공개 메소드

Constructs a new Turba_Driver object.
public __construct ( string $name = '', array $params = [] )
$name string Source name
$params array Hash containing additional configuration parameters.

_add() 보호된 메소드

Adds the specified contact to the addressbook.
protected _add ( array $attributes, array $blob_fields = [], array $date_fields = [] )
$attributes array The attribute values of the contact.
$blob_fields array Fields that represent binary data.
$date_fields array Fields that represent dates. @since 4.2.0

_canAdd() 보호된 메소드

Returns ability of the backend to add new contacts.
protected _canAdd ( ) : boolean
리턴 boolean Can backend add?

_delete() 보호된 메소드

Deletes the specified contact from the addressbook.
protected _delete ( string $object_key, string $object_id )
$object_key string TODO
$object_id string TODO

_deleteAll() 보호된 메소드

Deletes all contacts from an address book.
protected _deleteAll ( ) : array
리턴 array An array of UIDs that have been deleted.

_filterTags() 보호된 메소드

Returns a Turba_List object containing $objects filtered by $tags.
protected _filterTags ( array $objects, array $tags, Array $sort_order = null ) : Turba_List
$objects array A hash of objects, as returned by self::_search.
$tags array An array of tags to filter by.
$sort_order Array The sort order to pass to Turba_List::sort.
리턴 Turba_List The filtered Turba_List object.

_getContactOwner() 보호된 메소드

Return the owner to use when searching or creating contacts in this address book.
protected _getContactOwner ( ) : string
리턴 string Contact owner.

_getTimeObjectTurbaListFallback() 보호된 메소드

Default implementation for obtaining a Turba_List to get TimeObjects out of.
protected _getTimeObjectTurbaListFallback ( Horde_Date $start, Horde_Date $end, string $field ) : Turba_List
$start Horde_Date The starting date.
$end Horde_Date The ending date.
$field string The address book field containing the timeObject information (birthday, anniversary).
리턴 Turba_List A list of objects.

_guessName() 보호된 메소드

Helper function for guessing name parts from a single name string.
protected _guessName ( array &$hash )
$hash array The attributes array.

_hasValEnum() 보호된 메소드

Returns whether a ValEnum entry from a DevInf object contains a certain type.
protected _hasValEnum ( array $valEnum, string $type ) : boolean
$valEnum array A ValEnum hash.
$type string A requested attribute type.
리턴 boolean True if $type exists in $valEnum.

_init() 보호된 메소드

Initialize the driver.
protected _init ( )

_makeKey() 보호된 메소드

Creates an object key for a new object.
protected _makeKey ( array $attributes ) : string
$attributes array The attributes (in driver keys) of the object being added.
리턴 string A unique ID for the new object.

_makeUid() 보호된 메소드

Creates an object UID for a new object.
protected _makeUid ( ) : string
리턴 string A unique ID for the new object.

_read() 보호된 메소드

Reads the given data from the address book and returns the results.
protected _read ( string $key, mixed $ids, string $owner, array $fields, array $blobFields = [], array $dateFields = [] ) : array
$key string The primary key field to use.
$ids mixed The ids of the contacts to load.
$owner string Only return contacts owned by this user.
$fields array List of fields to return.
$blobFields array Array of fields containing binary data.
$dateFields array Array of fields containing date data. @since 4.2.0
리턴 array Hash containing the search results.

_save() 보호된 메소드

Saves the specified object in the SQL database.
protected _save ( Turba_Object $object ) : string
$object Turba_Object The object to save
리턴 string The object id, possibly updated.

_toTurbaObjects() 보호된 메소드

Takes an array of object hashes and returns a Turba_List containing the correct Turba_Objects
protected _toTurbaObjects ( array $objects, array $sort_order = null ) : Turba_List
$objects array An array of object hashes (keyed to backend).
$sort_order array Array of hashes describing sort fields. Each hash has the following fields:
ascending - (boolean) Indicating sort direction.
field - (string) Sort field.
리턴 Turba_List A list object.

add() 공개 메소드

Adds a new entry to the contact source.
public add ( array $attributes ) : string
$attributes array The attributes of the new object to add.
리턴 string The new __key value on success.

canAdd() 공개 메소드

Returns ability of the backend to add new contacts.
public canAdd ( ) : boolean
리턴 boolean Can backend add?

checkDefaultShare() 공개 메소드

Check if the passed in share is the default share for this source.
public checkDefaultShare ( Horde_Share_Object $share, array $srcconfig ) : boolean
$share Horde_Share_Object The share object.
$srcconfig array The cfgSource entry for the share.
리턴 boolean TODO

count() 공개 메소드

Returns the number of contacts of the current user in this address book.
public count ( ) : integer
리턴 integer The number of contacts that the user owns.

createShare() 공개 메소드

Creates a new Horde_Share for this source type.
public createShare ( string $share_name, array $params ) : Horde_Share
$share_name string The share name
$params array The params for the share.
리턴 Horde_Share The share object.

delete() 공개 메소드

Deletes the specified entry from the contact source.
public delete ( string $object_id, boolean $remove_tags = true )
$object_id string The ID of the object to delete.
$remove_tags boolean Remove tags if true.

deleteAll() 공개 메소드

Deletes all contacts from an address book.
public deleteAll ( string $sourceName = null )
$sourceName string The identifier of the address book to delete. If omitted, will clear the current user's 'default' address book for this source type.

fromASContact() 공개 메소드

Convert an ActiveSync contact message into a hash suitable for importing via self::add().
public fromASContact ( Horde_ActiveSync_Message_Contact $message ) : array
$message Horde_ActiveSync_Message_Contact The contact message object.
리턴 array A contact hash.

getBlobs() 공개 메소드

Returns the attributes that are blob types.
public getBlobs ( ) : array
리턴 array List of blob attributes in the array keys.

getContactOwner() 공개 메소드

Return the owner to use when searching or creating contacts in this address book.
public getContactOwner ( ) : string
리턴 string Contact owner.

getCriteria() 공개 메소드

Returns the criteria available for this source except '__key'.
public getCriteria ( ) : array
리턴 array An array containing the criteria.

getDateFields() 공개 메소드

Returns the attributes that represent dates.
부터: 4.2.0
public getDateFields ( ) : array
리턴 array List of date attributes in the array keys.

getFields() 공개 메소드

Returns all non-composite fields for this source. Useful for importing and exporting data, etc.
public getFields ( ) : array
리턴 array The field list.

getName() 공개 메소드

(This is the key into the cfgSources array)
public getName ( )

getObject() 공개 메소드

Retrieves one object from the source.
public getObject ( string $objectId ) : Turba_Object
$objectId string The unique id of the object to retrieve.
리턴 Turba_Object The retrieved object.

getObjects() 공개 메소드

Retrieves a set of objects from the source.
public getObjects ( array $objectIds ) : array
$objectIds array The unique ids of the objects to retrieve.
리턴 array The array of retrieved objects (Turba_Objects).

getParams() 공개 메소드

Returns the current driver's additional parameters.
public getParams ( ) : array
리턴 array Hash containing the driver's additional parameters.

getTimeObjectTurbaList() 공개 메소드

Default implementation for obtaining a Turba_List to get TimeObjects out of.
public getTimeObjectTurbaList ( Horde_Date $start, Horde_Date $end, string $field ) : Turba_List
$start Horde_Date The starting date.
$end Horde_Date The ending date.
$field string The address book field containing the timeObject information (birthday, anniversary).
리턴 Turba_List A list of objects.

hasCapability() 공개 메소드

Checks if this backend has a certain capability.
public hasCapability ( string $capability ) : boolean
$capability string The capability to check for.
리턴 boolean Supported or not.

hasPermission() 공개 메소드

Checks if the current user has the requested permissions on this address book.
public hasPermission ( integer $perm ) : boolean
$perm integer The permission to check for.
리턴 boolean True if the user has permission, otherwise false.

listTimeObjects() 공개 메소드

Returns a list of birthday or anniversary hashes from this source for a certain period.
public listTimeObjects ( Horde_Date $start, Horde_Date $end, string $category ) : array
$start Horde_Date The start date of the valid period.
$end Horde_Date The end date of the valid period.
$category string The timeObjects category to return.
리턴 array A list of timeObject hashes.

makeSearch() 공개 메소드

Takes a hash of Turba key => search value and return a (possibly nested) array, using backend attribute names, that can be turned into a search by the driver. The translation is based on the contents of $this->map, and includes nested OR searches for composite fields.
public makeSearch ( array $criteria, string $search_type, array $strict, boolean $match_begin = false, array $custom_strict = [] ) : array
$criteria array Hash of criteria using Turba keys.
$search_type string OR search or AND search?
$strict array Fields that must be matched exactly.
$match_begin boolean Whether to match only at beginning of words.
$custom_strict array Custom set of fields that are to matched exactly, but are glued using $search_type and 'AND' together with $strict fields. Allows an 'OR' search pm a custom set of $strict fields.
리턴 array An array of search criteria.

removeUserData() 공개 메소드

Remove all entries owned by the specified user.
public removeUserData ( string $user )
$user string The user's data to remove.

save() 공개 메소드

Modifies an existing entry in the contact source.
public save ( Turba_Object $object ) : string
$object Turba_Object The object to update.
리턴 string The object id, possibly updated.

searchDuplicates() 공개 메소드

Duplicates are determined by comparing email and name or last name and first name values.
public searchDuplicates ( ) : array
리턴 array A hash with the following format: array('name' => array('John Doe' => Turba_List, ...), ...)

setContactOwner() 공개 메소드

Override the contactOwner setting for this driver.
public setContactOwner ( string $owner )
$owner string The contact owner.

setDefaultShare() 공개 메소드

Runs any actions after setting a new default tasklist.
public setDefaultShare ( string $share )
$share string The default share ID.

setSourceName() 공개 메소드

Override the name setting for this driver.
public setSourceName ( string $name )
$name string The source name. This is the key into the $cfgSources array.

synchronize() 공개 메소드

Synchronize, if needed.
public synchronize ( mixed $token = false )
$token mixed A value indicating the last synchronization point, if available.

toASContact() 공개 메소드

Convert the contact to an ActiveSync contact message
public toASContact ( Turba_Object $object, array $options = [] ) : Horde_ActiveSync_Message_Contact
$object Turba_Object The turba object to convert
$options array Options: - protocolversion: (float) The EAS version to support DEFAULT: 2.5 - bodyprefs: (array) A BODYPREFERENCE array. DEFAULT: none (No body prefs enforced). - truncation: (integer) Truncate event body to this length DEFAULT: none (No truncation). - device: (Horde_ActiveSync_Device) The device object.
리턴 Horde_ActiveSync_Message_Contact

toDriver() 공개 메소드

Translates a single Turba attribute to the driver-specific counterpart. The translation is based on the contents of $this->map. This ignores composite fields.
public toDriver ( string $attribute ) : string
$attribute string The Turba attribute to translate.
리턴 string The driver name for this attribute.

toDriverKeys() 공개 메소드

Translates the keys of the first hash from the generalized Turba attributes to the driver-specific fields. The translation is based on the contents of $this->map.
public toDriverKeys ( array $hash ) : array
$hash array Hash using Turba keys.
리턴 array Translated version of $hash.

toHash() 공개 메소드

Function to convert a Horde_Icalendar_Vcard object into a Turba Object Hash with Turba attributes suitable as a parameter for add().
또한 보기: add()
public toHash ( Horde_Icalendar_Vcard $vcard ) : array
$vcard Horde_Icalendar_Vcard The Horde_Icalendar_Vcard object to parse.
리턴 array A Turba attribute hash.

toTurbaKeys() 공개 메소드

Translates a hash from being keyed on driver-specific fields to being keyed on the generalized Turba attributes. The translation is based on the contents of $this->map.
public toTurbaKeys ( array $entry ) : array
$entry array A hash using driver-specific keys.
리턴 array Translated version of $entry.

tovCard() 공개 메소드

Exports a given Turba_Object as an iCalendar vCard.
public tovCard ( Turba_Object $object, string $version = '2.1', array $fields = null, boolean $skipEmpty = false ) : Horde_Icalendar_Vcard
$object Turba_Object Turba_Object.
$version string The vcard version to produce.
$fields array Hash of field names and Horde_SyncMl_Property properties with the requested fields.
$skipEmpty boolean Whether to skip empty fields.
리턴 Horde_Icalendar_Vcard A vcard object.

프로퍼티 상세

$_asMap 보호되어 있는 정적으로 프로퍼티

Mapping of Turba attributes to ActiveSync fields.
protected static array $_asMap
리턴 array

$_capabilities 보호되어 있는 프로퍼티

What can this backend do?
protected array $_capabilities
리턴 array

$_contact_owner 보호되어 있는 프로퍼티

Hold the value for the owner of this address book.
protected string $_contact_owner
리턴 string

$_count 보호되어 있는 프로퍼티

Number of contacts in this source.
protected int $_count
리턴 integer

$_name 보호되어 있는 프로퍼티

The internal name of this source.
protected string $_name
리턴 string

$_objectOptions 보호되어 있는 프로퍼티

Any additional options passed to Turba_Object constructors.
protected array $_objectOptions
리턴 array

$_params 보호되어 있는 프로퍼티

Hash holding the driver's additional parameters.
protected array $_params
리턴 array

$alternativeName 공개적으로 프로퍼티

The name of a field to use as an alternative to the name field if that one is empty.
public string $alternativeName
리턴 string

$approximate 공개적으로 프로퍼티

Array of fields to search "approximately" (@see config/backends.php).
public array $approximate
리턴 array

$fields 공개적으로 프로퍼티

List of all fields that can be accessed in the backend (excludes composite attributes, etc.).
public array $fields
리턴 array

$listNameField 공개적으로 프로퍼티

The name of a field to store contact list names in if not the default.
public string $listNameField
리턴 string

$map 공개적으로 프로퍼티

Hash describing the mapping between Turba attributes and driver-specific fields.
public array $map
리턴 array

$strict 공개적으로 프로퍼티

Array of fields that must match exactly.
public array $strict
리턴 array

$tabs 공개적으로 프로퍼티

Hash with all tabs and their fields.
public array $tabs
리턴 array

$title 공개적으로 프로퍼티

The symbolic title of this source.
public string $title
리턴 string