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_Api

Turba external API interface.

This file defines Turba's external API interface. Other applications can interact with Turba through this API.

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

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

Horde_Registry_Api
Extended by Turba_Api
Package: Turba
Category: Horde
License: ASL
Author: Michael Slusarz slusarz@horde.org
Located at Api.php
Methods summary
public mixed
# commentCallback( integer $id )

Callback for comment API.

Callback for comment API.

Parameters

$id
Internal data identifier.

Returns

mixed
Name of object on success, false on failure.
public boolean
# hasComments( )

Returns if applications allows comments

Returns if applications allows comments

Returns

boolean
public array
# sources( boolean $writeable = false )

Returns a list of available sources.

Returns a list of available sources.

Parameters

$writeable
Set to true to limit to writeable sources.

Returns

array
An array of the available sources.
public array
# fields( string $source = null )

Returns a list of fields avaiable in a source.

Returns a list of fields avaiable in a source.

Parameters

$source
The name of the source

Returns

array
An array describing the fields.

Throws

Turba_Exception
public
# getDefaultShare( )

Retrieve the UID for the current user's default Turba share.

Retrieve the UID for the current user's default Turba share.

public string
# getGalUid( )

Retrieve the UID for the Global Address List source, or false if none configured.

Retrieve the UID for the Global Address List source, or false if none configured.

Returns

string
| boolean The UID or false if none configured.
public array
# browse( string $path = '', array $properties = array() )

Browses through Turba's object tree.

Browses through Turba's object tree.

Parameters

$path
The path of the tree to browse.
$properties
<p>The item properties to return. Defaults to 'name', 'icon', and 'browseable'.</p>

Returns

array
Content of the specified path.

Throws

Turba_Exception
public string
# path_delete( string $path )

Deletes a file from the Turba tree.

Deletes a file from the Turba tree.

Parameters

$path
The path to the file.

Returns

string
The event's UID.

Throws

Turba_Exception
public array
# listUids( string|array $sources = null )

Returns an array of UIDs for all contacts that the current user is authorized to see.

Returns an array of UIDs for all contacts that the current user is authorized to see.

Parameters

$sources
<p>The name(s) of the source(s) to return contacts of. If left empty, the current user's sync sources or default source are used.</p>

Returns

array
An array of UIDs for all contacts the user can access.

Throws

Turba_Exception
public array
# listBy( string $action, integer $timestamp, string|array $sources = null, integer $end = null )

Returns an array of UIDs for contacts that have had $action happen since $timestamp.

Returns an array of UIDs for contacts that have had $action happen since $timestamp.

Parameters

$action
<p>The action to check for - add, modify, or delete.</p>
$timestamp
The time to start the search.
$sources
<p>The source(s) for which to retrieve the history.</p>
$end
The optinal ending timestamp.

Returns

array
An array of UIDs matching the action and time criteria.

Throws

Turba_Exception
InvalidArgumentException
public array
# getChanges( integer $start, integer $end )

Method for obtaining all server changes between two timestamps. Basically a wrapper around listBy(), but returns an array containing all adds, edits and deletions.

Method for obtaining all server changes between two timestamps. Basically a wrapper around listBy(), but returns an array containing all adds, edits and deletions.

Parameters

$start
The starting timestamp
$end
The ending timestamp.

Returns

array
An hash with 'add', 'modify' and 'delete' arrays.
public integer
# getActionTimestamp( string $uid, string $action, string|array $sources = null )

Returns the timestamp of an operation for a given uid an action.

Returns the timestamp of an operation for a given uid an action.

Parameters

$uid
The uid to look for.
$action
<p>The action to check for - add, modify, or delete.</p>
$sources
<p>The source(s) for which to retrieve the history.</p>

Returns

integer
The timestamp for this action.

Throws

Turba_Exception
InvalidArgumentException
public string
# import( string $content, string $contentType = 'array', string $import_source = null )

Import a contact represented in the specified contentType.

Import a contact represented in the specified contentType.

Parameters

$content
The content of the contact.
$contentType
<p>What format is the data in? Currently supports array, text/directory, text/vcard, text/x-vcard, and activesync.</p>
$import_source
<p>$source The source into which the contact will be imported.</p>

Returns

string
The new UID, or false on failure.

Throws

Turba_Exception
public mixed
# export( string $uid, mixed $contentType, string|array $sources = null, array $fields = null )

Export a contact, identified by UID, in the requested contentType.

Export a contact, identified by UID, in the requested contentType.

Parameters

$uid
Identify the contact to export.
$contentType
<p>What format should the data be in? Either a string with one of: - text/directory - text/vcard - text/x-vcard The first two produce a vcard3.0 (rfc2426), the second produces a vcard in old 2.1 format defined by imc.org Also supports a raw array</p>
$sources
<p>The source(s) from which the contact will be exported.</p>
$fields
<p>Hash of field names and Horde_SyncMl_Property properties with the requested fields.</p>

Returns

mixed
The requested data.

Throws

Turba_Exception
public string
# ownVCard( )

Exports the user's own contact as a vCard string.

Exports the user's own contact as a vCard string.

Returns

string
The requested vCard data.

Throws

Turba_Exception
public array
# ownContact( )

Export the user's own contact as a hash

Export the user's own contact as a hash

Returns

array
The contact hash.

Throws

Turba_Exception
public array
# getOwnContactObject( )

Helper function to return the user's own contact object

Helper function to return the user's own contact object

Returns

array

A hash containing the Turba_Object representing the user's own contact and the source that it is from.

Throws

Turba_Exception
public boolean
# delete( string|array $uid, string|array $sources = null )

Deletes a contact identified by UID.

Deletes a contact identified by UID.

Parameters

$uid
<p>Identify the contact to delete, either a single UID or an array.</p>
$sources
<p>The source(s) from which the contact will be deleted.</p>

Returns

boolean
Success or failure.

Throws

Turba_Exception
public boolean
# replace( string $uid, string $content, string $contentType, string|array $sources = null )

Replaces the contact identified by UID with the content represented in the specified contentType.

Replaces the contact identified by UID with the content represented in the specified contentType.

Parameters

$uid
Idenfity the contact to replace.
$content
The content of the contact.
$contentType
<p>What format is the data in? Currently supports array, text/directory, text/vcard, text/x-vcard and activesync.</p>
$sources
<p>The source(s) where the contact will be replaced.</p>

Returns

boolean
Success or failure.

Throws

Turba_Exception
public array
# search( array $names = array(), array $sources = array(), array $fields = array(), boolean $matchBegin = false, boolean $forceSource = false, array $returnFields = array(), boolean $count_only = false )

Returns a contact search result.

Returns a contact search result.

Parameters

$names
The search filter values.
$sources
The sources to search in.
$fields
The fields to search on.
$matchBegin
Match word boundaries only?
$forceSource
<p>Whether to use the specified sources, even if they have been disabled in the preferences?</p>
$returnFields
<p>Only return these fields. Returns all fields if empty.</p>
$count_only
<p>Only return the count of matching entries, not the entries themselves.</p>

Returns

array
Hash containing the search results.

Throws

Turba_Exception
public array
# getContact( string $source = null, string $objectId = '' )

Retrieves a contact.

Retrieves a contact.

Parameters

$source
The source name where the contact is stored
$objectId
The unique id of the contact to retrieve

Returns

array
The retrieved contact.

Throws

Turba_Exception
public array
# getContacts( string $source = '', array $objectIds = array() )

Retrieves a set of contacts from a single source.

Retrieves a set of contacts from a single source.

Parameters

$source
The source name where the contact is stored
$objectIds
The unique ids of the contact to retrieve.

Returns

array
The retrieved contact.

Throws

Turba_Exception
public array
# getAllAttributeValues( string $field = '', array $sources = array() )

Retrieves a list of all possible values of a field in specified source(s).

Retrieves a list of all possible values of a field in specified source(s).

Parameters

$field
Field name to check
$sources
Array containing the sources to look in

Returns

array
An array of fields and possible values.

Throws

Turba_Exception
public array
# listTimeObjectCategories( )

Retrieves a list of available time objects categories

Retrieves a list of available time objects categories

Returns

array
An array of all configured time object categories.
public array
# listTimeObjects( array $time_categories, mixed $start, mixed $end )

Lists birthdays and/or anniversaries as time objects.

Lists birthdays and/or anniversaries as time objects.

Parameters

$time_categories
<p>The time categories (from listTimeObjectCategories) to list.</p>
$start
The start date of the period.
$end
The end date of the period.

Returns

array
An array of timeObject results.

Throws

Turba_Exception
public string
# getClientSource( )

Returns the client source name

Returns the client source name

Returns

string
The name of the source to use with the clients api.
public array
# clientFields( )

Returns the available client fields

Returns the available client fields

Returns

array
An array describing the fields.
public array
# getClient( string $objectId = '' )

Returns a contact from the client source.

Returns a contact from the client source.

Parameters

$objectId
Client unique ID

Returns

array
Array of client data.

Throws

Turba_Exception
public array
# getClients( array $objectIds = array() )

Returns mulitple contacts from the client source

Returns mulitple contacts from the client source

Parameters

$objectIds
client unique ids

Returns

array
An array of clients data.

Throws

Turba_Exception
public
# addClient( array $attributes = array() )

Adds a client to the client source

Adds a client to the client source

Parameters

$attributes
Array containing the client attributes
public boolean
# updateClient( string $objectId = '', array $attributes = array() )

Updates client data

Updates client data

Parameters

$objectId
The unique id of the client
$attributes
An array of client attributes

Returns

boolean
public boolean
# deleteClient( string $objectId = '' )

Deletes a client

Deletes a client

Parameters

$objectId
The unique id of the client

Returns

boolean
public array
# searchClients( array $names = array(), array $fields = array(), boolean $matchBegin = false )

Search for clients

Search for clients

Parameters

$names
The search filter values
$fields
The fields to search in
$matchBegin
Match word boundaries only

Returns

array
A hash containing the search results.

Throws

Turba_Exception
public
# addField( string|array $address = '', string $name = '', string $field = '', string $value = '', string $source = '' )

Sets the value of the specified attribute of a contact

Sets the value of the specified attribute of a contact

Parameters

$address
Contact email address(es).
$name
Contact name.
$field
Field to update.
$value
Field value to set.
$source
Contact source.

Throws

Turba_Exception
public array
# getField( string $address = '', string $field = '', array $sources = array(), boolean $strict = false, boolean $multiple = false )

Returns a field value

Returns a field value

Parameters

$address
Contact email address
$field
Field to get
$sources
Sources to check
$strict
Match the email address strictly
$multiple
<p>Return more than one entry if found and true, return an error if this is false.</p>

Returns

array
An array of field value(s).

Throws

Turba_Exception
public boolean
# deleteField( string $address = '', string $field = '', array $sources = array() )

Deletes a field value

Deletes a field value

Parameters

$address
Contact email address
$field
Field to delete value for
$sources
Sources to delete value from

Returns

boolean
TODO

Throws

Turba_Exception
public array
# getSourcesConfig( type $filter = array() )

Obtain an array of $cfgSource entries matching the filter criteria.

Obtain an array of $cfgSource entries matching the filter criteria.

Parameters

$filter
A single key -> value hash to filter the sources.

Returns

array
public array
# listShares( integer $perms = Horde_Perms::READ )

Lists all shares the current user has access to.

Lists all shares the current user has access to.

Parameters

$perms

Returns

array
of Turba_Share objects.
public array
# listUserGroupObjects( )

GroupObject API - Lists all turba lists for the current user that can be treated as Horde_Group objects.

GroupObject API - Lists all turba lists for the current user that can be treated as Horde_Group objects.

Returns

array

A hash of all visible groups in the form of group_id => group_name

Throws

Horde_Exception
public array
# getGroupObjects( )

Returns all contact groups.

Returns all contact groups.

Returns

array
A list of group hashes.

Throws

Turba_Exception
public array
# getGroupMemberships( string $user, boolean $parentGroups = false )

Returns all contact groups that the specified user is a member of.

Returns all contact groups that the specified user is a member of.

Parameters

$user
The user
$parentGroups
<p>Include user as a member of the any parent group as well.</p>

Returns

array

An array of group identifiers that the specified user is a member of.

Throws

Horde_Exception
public array
# getGroupObject( string $gid )

Returns a contact group hash.

Returns a contact group hash.

Parameters

$gid
The group identifier.

Returns

array
A hash defining the group.

Throws

Turba_Exception
public array
# getGroupMembers( string $gid, boolean $subGroups = false )

Returns a list of all members belonging to a contact group.

Returns a list of all members belonging to a contact group.

Parameters

$gid
The group identifier
$subGroups
Also include members of any subgroups?

Returns

array
An array of group members (identified by email address).

Throws

Horde_Exception
Properties summary
public array $links

Links.

Links.

# array( 'show' => '%application%/contact.php?source=|source|&key=|key|&uid=|uid|' )
public array $noPerms

The listing of API calls that do not require permissions checking.

The listing of API calls that do not require permissions checking.

# array( 'getClientSource', 'getClient', 'getClients', 'searchClients' )
API documentation generated by ApiGen