Constants

VFS_PATH

VFS_PATH

The virtual path to use for VFS data.

Properties

$source

$source : string

The current source.

Type

string

$_cache

$_cache : array

Cached data.

Type

array

Methods

availableSources()

availableSources() : array

Returns the source entries from config/backends.php that have been configured as available sources in the main Turba configuration.

Throws

\Horde_Exception

Returns

array —

List of available sources.

getAddressBooks()

getAddressBooks(integer  $permission = \Horde_Perms::READ, array  $options = array()) : array

Get all the address books the user has the requested permissions to and return them in the user's preferred order.

Parameters

integer $permission

The Horde_Perms::* constant to filter on.

array $options

Any additional options.

Returns

array —

The filtered, ordered $cfgSources entries.

getDefaultAddressbook()

getDefaultAddressbook() : string

Returns the current user's default address book.

Returns

string —

The default address book name.

getPreferredSortOrder()

getPreferredSortOrder() : array

Returns the sort order selected by the user.

Returns

array —

TODO

setPreferredSortOrder()

setPreferredSortOrder(\Horde_Variables  $vars, string  $source) 

Saves the sort order to the preferences backend.

Parameters

\Horde_Variables $vars

Variables object.

string $source

Source.

getColumnName()

getColumnName(integer  $i, array  $columns) : string

Retrieves a column's field name.

Parameters

integer $i

TODO

array $columns

TODO

Returns

string —

TODO

getColumns()

getColumns() 

TODO

formatCompositeField()

formatCompositeField(string  $format, array  $fields) : string

Builds and cleans up a composite field.

Parameters

string $format

The sprintf field format.

array $fields

The fields that compose the composite field.

Returns

string —

The formatted composite field.

guessLastname()

guessLastname(string  $name) : string

Returns a best guess at the lastname in a string.

Parameters

string $name

String contain the full name.

Returns

string —

String containing the last name.

formatName()

formatName(\Turba_Object  $ob, string  $name_format = null) : string

Formats the name according to the user's preference.

If the format is 'none', the full name with all parts is returned. If the format is 'last_first' or 'first_last', only the first name and last name are returned.

Parameters

\Turba_Object $ob

The object to get a name from.

string $name_format

The formatting. One of 'none', 'last_first' or 'first_last'. Defaults to the user preference.

Returns

string —

The formatted name, either "Firstname Lastname" or "Lastname, Firstname" depending on $name_format or the user's preference.

formatEmailAddresses()

formatEmailAddresses(mixed  $data, string  $name) : mixed

TODO

Parameters

mixed $data

Either a single email address or an array of email addresses to format.

string $name

The personal name phrase.

Returns

mixed —

Either the formatted address or an array of formatted addresses.

getUserName()

getUserName(string  $uid) : string

Returns the real name, if available, of a user.

Parameters

string $uid

The uid of the name to return.

Returns

string —

The user's full, real name.

getExtendedPermission()

getExtendedPermission(\Turba_Driver  $addressBook, string  $permission) : mixed

Gets extended permissions on an address book.

Parameters

\Turba_Driver $addressBook

The address book to get extended permissions for.

string $permission

What extended permission to get.

Returns

mixed —

The requested extended permissions value, or true if it doesn't exist.

hasMaxContacts()

hasMaxContacts(\Turba_Driver  $driver, boolean  $notify = true) : string

Checks the max_contacts permission.

Parameters

\Turba_Driver $driver

The address book to check.

boolean $notify

If true, outputs error to notification.

Returns

string —

Error message if maximum contacts have been reached. False otherwise.

permissionsFilter()

permissionsFilter(array  $in, integer  $permission = \Horde_Perms::READ, array  $options = array()) : array

Filters sources based on permissions.

Parameters

array $in

The source list we want filtered.

integer $permission

The Horde_Perms::* constant we will filter on.

array $options

Additional options:

  • require_add: (boolean) Only return sources that can be added to.

Returns

array —

The filtered data.

getConfigFromShares()

getConfigFromShares(array  $sources, boolean  $owner = false, array  $options = array()) : array

Replaces all share-enabled sources in a source list with all shares from this source that the current user has access to.

This will only sync shares that are unique to Horde (such as a SQL or Kolab sources). Any backend that supports ACLs or similar mechanism should be configured from within backends.local.php or via Horde's share_* hooks.

Parameters

array $sources

The default $cfgSources array.

boolean $owner

Only return shares that the current user owns?

array $options

An array of options:

  • shares: Use this list of provided shares. Default is to get the list from the share system using the current user.
  • auth_user: Use this as the authenticated user name.

Returns

array —

The $cfgSources array.

getSourceFromShare()

getSourceFromShare(\Horde_Share_Object  $share) : array

Retrieve a new source config entry based on a Turba share.

Parameters

\Horde_Share_Object $share

Returns

array —

The $cfgSource entry for this share source.

listShares()

listShares(boolean  $owneronly = false, integer  $permission = \Horde_Perms::READ) : array

Returns all shares the current user has specified permissions to.

Parameters

boolean $owneronly

Only return address books owned by the user? Defaults to false.

integer $permission

Permissions to filter by.

Returns

array —

Shares the user has the requested permissions to.

createShare()

createShare(string  $share_name, array  $params) : \Horde_Share

Create a new Turba share.

Parameters

string $share_name

The id for the new share.

array $params

Parameters for the new share.

Throws

\Turba_Exception

Returns

\Horde_Share —

The new share object.

addBrowseJs()

addBrowseJs() 

Add browse.js javascript to page.

getAvailableEmailFields()

getAvailableEmailFields(  $source = null,   $searchable = true) : array

Return an array of all available attributes of type 'email'. Optionally, ensure the field is defined in the specified $source.

Parameters

$source

string An optional source identifier.

$searchable

boolean If true, and $source is provided, ensure that the email field is a configured searchable field.

Returns

array —

An array of email fields.