Overview

Packages

  • Horde
    • Data
  • None
  • Turba

Classes

  • Turba
  • Turba_Api
  • Turba_Driver
  • Turba_Driver_Facebook
  • Turba_Driver_Favourites
  • Turba_Driver_Group
  • Turba_Driver_Imsp
  • Turba_Driver_Kolab
  • Turba_Driver_Ldap
  • Turba_Driver_Prefs
  • Turba_Driver_Share
  • Turba_Driver_Sql
  • Turba_Driver_Vbook
  • Turba_Exception
  • Turba_Factory_Driver
  • Turba_Form_AddContact
  • Turba_Form_Contact
  • Turba_Form_ContactBase
  • Turba_Form_CreateAddressBook
  • Turba_Form_DeleteAddressBook
  • Turba_Form_EditAddressBook
  • Turba_Form_EditContact
  • Turba_Form_EditContactGroup
  • Turba_List
  • Turba_LoginTasks_SystemTask_Upgrade
  • Turba_Object
  • Turba_Object_Group
  • Turba_Test
  • Turba_View_Browse
  • Turba_View_Contact
  • Turba_View_DeleteContact
  • Turba_View_Duplicates
  • Turba_View_EditContact
  • Turba_View_List
  • Overview
  • Package
  • Class
  • Tree

Class Turba_Driver

The Turba_Driver:: class provides a common abstracted interface to the various directory search drivers. It includes functions for searching, adding, removing, and modifying directory entries.

Copyright 2000-2012 Horde LLC (http://www.horde.org/)

See the enclosed file LICENSE for license information (ASL). If you did not receive this file, see http://www.horde.org/licenses/apache.

Turba_Driver implements Countable

Direct known subclasses

Turba_Driver_Facebook, Turba_Driver_Favourites, Turba_Driver_Group, Turba_Driver_Imsp, Turba_Driver_Kolab, Turba_Driver_Ldap, Turba_Driver_Prefs, Turba_Driver_Share, Turba_Driver_Sql, Turba_Driver_Vbook
Package: Turba
Category: Horde
License: ASL
Author: Chuck Hagenbuch chuck@horde.org
Author: Jon Parise jon@csh.rit.edu
Located at Driver.php
Methods summary
public
# __construct( string $name = '', array $params = array() )

Constructs a new Turba_Driver object.

Constructs a new Turba_Driver object.

Parameters

$name
Source name
$params
<p>Hash containing additional configuration parameters.</p>
public array
# getParams( )

Returns the current driver's additional parameters.

Returns the current driver's additional parameters.

Returns

array
Hash containing the driver's additional parameters.
public boolean
# hasCapability( string $capability )

Checks if this backend has a certain capability.

Checks if this backend has a certain capability.

Parameters

$capability
The capability to check for.

Returns

boolean
Supported or not.
public array
# getBlobs( )

Returns the attributes that are blob types.

Returns the attributes that are blob types.

Returns

array
List of blob attributes in the array keys.
public array
# toDriverKeys( array $hash )

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.

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.

Parameters

$hash
Hash using Turba keys.

Returns

array
Translated version of $hash.
public array
# makeSearch( array $criteria, string $search_type, array $strict, boolean $match_begin = false )

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.

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.

Parameters

$criteria
Hash of criteria using Turba keys.
$search_type
OR search or AND search?
$strict
Fields that must be matched exactly.
$match_begin
<p>Whether to match only at beginning of words.</p>

Returns

array
An array of search criteria.
public string
# toDriver( string $attribute )

Translates a single Turba attribute to the driver-specific counterpart. The translation is based on the contents of $this->map. This ignores composite fields.

Translates a single Turba attribute to the driver-specific counterpart. The translation is based on the contents of $this->map. This ignores composite fields.

Parameters

$attribute
The Turba attribute to translate.

Returns

string
The driver name for this attribute.
public array
# toTurbaKeys( array $entry )

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.

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.

Parameters

$entry
A hash using driver-specific keys.

Returns

array
Translated version of $entry.
public mixed
# search( array $search_criteria, string $sort_order = null, string $search_type = 'AND', array $return_fields = array(), array $custom_strict = array(), boolean $match_begin = false, boolean $count_only = false )

Searches the source based on the provided criteria.

Searches the source based on the provided criteria.

Parameters

$search_criteria
Hash containing the search criteria.
$sort_order
<p>The requested sort order which is passed to Turba_List::sort().</p>
$search_type
<p>Do an AND or an OR search (defaults to AND).</p>
$return_fields
<p>A list of fields to return; defaults to all fields.</p>
$custom_strict
A list of fields that must match exactly.
$match_begin
<p>Whether to match only at beginning of words.</p>
$count_only
<p>Only return the count of matching entries, not the entries themselves.</p>

Returns

mixed

Turba_List|integer The sorted, filtered list of search results or the number of matching entries (if $count_only is true).

Throws

Turba_Exception
public array
# searchDuplicates( )

Searches the current address book for duplicate entries.

Searches the current address book for duplicate entries.

Duplicates are determined by comparing email and name or last name and first name values.

Returns

array
A hash with the following format: array('name' => array('John Doe' => Turba_List, ...), ...)

Throws

Turba_Exception
public array
# listTimeObjects( Horde_Date $start, Horde_Date $end, string $category )

Returns a list of birthday or anniversary hashes from this source for a certain period.

Returns a list of birthday or anniversary hashes from this source for a certain period.

Parameters

$start
The start date of the valid period.
$end
The end date of the valid period.
$category
The timeObjects category to return.

Returns

array
A list of timeObject hashes.

Throws

Turba
Exception
public Turba_List
# getTimeObjectTurbaList( Horde_Date $start, Horde_Date $end, string $field )

Default implementation for obtaining a Turba_List to get TimeObjects out of.

Default implementation for obtaining a Turba_List to get TimeObjects out of.

Parameters

$start
The starting date.
$end
The ending date.
$field
<p>The address book field containing the timeObject information (birthday, anniversary).</p>

Returns

Turba_List
A list of objects.

Throws

Turba_Exception
public array
# getObjects( array $objectIds )

Retrieves a set of objects from the source.

Retrieves a set of objects from the source.

Parameters

$objectIds
The unique ids of the objects to retrieve.

Returns

array
The array of retrieved objects (Turba_Objects).

Throws

Turba_Exception
public Turba_Object
# getObject( string $objectId )

Retrieves one object from the source.

Retrieves one object from the source.

Parameters

$objectId
The unique id of the object to retrieve.

Returns

Turba_Object
The retrieved object.

Throws

Turba_Exception
public string
# add( array $attributes )

Adds a new entry to the contact source.

Adds a new entry to the contact source.

Parameters

$attributes
The attributes of the new object to add.

Returns

string
The new __key value on success.

Throws

Turba_Exception
public boolean
# canAdd( )

Returns ability of the backend to add new contacts.

Returns ability of the backend to add new contacts.

Returns

boolean
Can backend add?
public
# delete( string $object_id )

Deletes the specified entry from the contact source.

Deletes the specified entry from the contact source.

Parameters

$object_id
The ID of the object to delete.

Throws

Turba_Exception
public
# deleteAll( string $sourceName = null )

Deletes all contacts from an address book.

Deletes all contacts from an address book.

Parameters

$sourceName
<p>The identifier of the address book to delete. If omitted, will clear the current user's 'default' address book for this source type.</p>

Throws

Turba_Exception
public string
# save( Turba_Object $object )

Modifies an existing entry in the contact source.

Modifies an existing entry in the contact source.

Parameters

$object
The object to update.

Returns

string
The object id, possibly updated.

Throws

Turba_Exception
public array
# getCriteria( )

Returns the criteria available for this source except '__key'.

Returns the criteria available for this source except '__key'.

Returns

array
An array containing the criteria.
public array
# getFields( )

Returns all non-composite fields for this source. Useful for importing and exporting data, etc.

Returns all non-composite fields for this source. Useful for importing and exporting data, etc.

Returns

array
The field list.
public Horde_Icalendar_Vcard
# tovCard( Turba_Object $object, string $version = '2.1', array $fields = null, boolean $skipEmpty = false )

Exports a given Turba_Object as an iCalendar vCard.

Exports a given Turba_Object as an iCalendar vCard.

Parameters

$object
Turba_Object.
$version
The vcard version to produce.
$fields
<p>Hash of field names and Horde_SyncMl_Property properties with the requested fields.</p>
$skipEmpty
Whether to skip empty fields.

Returns

Horde_Icalendar_Vcard
A vcard object.
public array
# toHash( Horde_Icalendar_Vcard $vcard )

Function to convert a Horde_Icalendar_Vcard object into a Turba Object Hash with Turba attributes suitable as a parameter for add().

Function to convert a Horde_Icalendar_Vcard object into a Turba Object Hash with Turba attributes suitable as a parameter for add().

Parameters

$vcard
<p>The Horde_Icalendar_Vcard object to parse.</p>

Returns

array
A Turba attribute hash.

See

Turba_Driver::add()
public Horde_ActiveSync_Message_Contact
# toASContact( Turba_Object $object )

Convert the contact to an ActiveSync contact message

Convert the contact to an ActiveSync contact message

Parameters

$object
The turba object to convert

Returns

Horde_ActiveSync_Message_Contact
public array
# fromASContact( Horde_ActiveSync_Message_Contact $message )

Convert an ActiveSync contact message into a hash suitable for importing via self::add().

Convert an ActiveSync contact message into a hash suitable for importing via self::add().

Parameters

$message
<p>The contact message object.</p>

Returns

array
A contact hash.
public boolean
# hasPermission( integer $perm )

Checks if the current user has the requested permissions on this address book.

Checks if the current user has the requested permissions on this address book.

Parameters

$perm
The permission to check for.

Returns

boolean
True if the user has permission, otherwise false.
public
# getName( )

Return the name of this address book. (This is the key into the cfgSources array)

Return the name of this address book. (This is the key into the cfgSources array)

String

Address book name
public string
# getContactOwner( )

Return the owner to use when searching or creating contacts in this address book.

Return the owner to use when searching or creating contacts in this address book.

Returns

string
Contact owner.
public
# setContactOwner( string $owner )

Override the contactOwner setting for this driver.

Override the contactOwner setting for this driver.

Parameters

$owner
The contact owner.
public
# setSourceName( string $name )

Override the name setting for this driver.

Override the name setting for this driver.

Parameters

$name
<p>The source name. This is the key into the $cfgSources array.</p>
public Horde_Share
# createShare( string $share_name, array $params )

Creates a new Horde_Share for this source type.

Creates a new Horde_Share for this source type.

Parameters

$share_name
The share name
$params
The params for the share.

Returns

Horde_Share
The share object.
public
# removeUserData( string $user )

Remove all entries owned by the specified user.

Remove all entries owned by the specified user.

Parameters

$user
The user's data to remove.

Throws

Turba_Exception
public boolean
# checkDefaultShare( Horde_Share_Object $share, array $srcconfig )

Check if the passed in share is the default share for this source.

Check if the passed in share is the default share for this source.

Parameters

$share
The share object.
$srcconfig
The cfgSource entry for the share.

Returns

boolean
TODO
public integer
# count( )

Returns the number of contacts of the current user in this address book.

Returns the number of contacts of the current user in this address book.

Returns

integer
The number of contacts that the user owns.

Throws

Turba_Exception

Implementation of

Countable::count()
Properties summary
public string $title

The symbolic title of this source.

The symbolic title of this source.

#
public array $map

Hash describing the mapping between Turba attributes and driver-specific fields.

Hash describing the mapping between Turba attributes and driver-specific fields.

# array()
public array $tabs

Hash with all tabs and their fields.

Hash with all tabs and their fields.

# array()
public array $fields

List of all fields that can be accessed in the backend (excludes composite attributes, etc.).

List of all fields that can be accessed in the backend (excludes composite attributes, etc.).

# array()
public array $strict

Array of fields that must match exactly.

Array of fields that must match exactly.

# array()
public array $approximate

Array of fields to search "approximately" (@see config/backends.php).

Array of fields to search "approximately" (@see config/backends.php).

# array()
public string $listNameField

The name of a field to store contact list names in if not the default.

The name of a field to store contact list names in if not the default.

# null
public string $alternativeName

The name of a field to use as an alternative to the name field if that one is empty.

The name of a field to use as an alternative to the name field if that one is empty.

# null
API documentation generated by ApiGen