PHP Class Turba, horde

Author: Chuck Hagenbuch ([email protected])
Author: Jon Parise ([email protected])
Show file Open project: horde/horde Class Usage Examples

Public Properties

Property Type Description
$source string The current source.

Protected Properties

Property Type Description
$_cache array Cached data.

Public Methods

Method Description
addBrowseJs ( ) Add browse.js javascript to page.
availableSources ( ) : array Returns the source entries from config/backends.php that have been configured as available sources in the main Turba configuration.
createShare ( string $share_name, array $params ) : Horde_Share Create a new Turba share.
formatCompositeField ( string $format, array $fields ) : string Builds and cleans up a composite field.
formatEmailAddresses ( mixed $data, string $name ) : mixed TODO
formatName ( Turba_Object $ob, string $name_format = null ) : string Formats the name according to the user's preference.
getAddressBooks ( integer $permission = Horde_Perms::READ, array $options = [] ) : array Get all the address books the user has the requested permissions to and return them in the user's preferred order.
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.
getColumnName ( integer $i, array $columns ) : string Retrieves a column's field name.
getColumns ( ) TODO
getConfigFromShares ( array $sources, boolean $owner = false ) : array Replaces all share-enabled sources in a source list with all shares from this source that the current user has access to.
getDefaultAddressbook ( ) : string Returns the current user's default address book.
getExtendedPermission ( Turba_Driver $addressBook, string $permission ) : mixed Gets extended permissions on an address book.
getPreferredSortOrder ( ) : array Returns the sort order selected by the user.
getSourceFromShare ( Horde_Share_Object $share ) : array Retrieve a new source config entry based on a Turba share.
getUserName ( string $uid ) : string Returns the real name, if available, of a user.
guessLastname ( string $name ) : string Returns a best guess at the lastname in a string.
hasMaxContacts ( Turba_Driver $driver, boolean $notify = true ) : string Checks the max_contacts permission.
listShares ( boolean $owneronly = false, integer $permission = Horde_Perms::READ ) : array Returns all shares the current user has specified permissions to.
permissionsFilter ( array $in, integer $permission = Horde_Perms::READ, array $options = [] ) : array Filters sources based on permissions.
setPreferredSortOrder ( Horde_Variables $vars, string $source ) Saves the sort order to the preferences backend.

Method Details

addBrowseJs() public static method

Add browse.js javascript to page.
public static addBrowseJs ( )

availableSources() public static method

Returns the source entries from config/backends.php that have been configured as available sources in the main Turba configuration.
public static availableSources ( ) : array
return array List of available sources.

createShare() public static method

Create a new Turba share.
public static createShare ( string $share_name, array $params ) : Horde_Share
$share_name string The id for the new share.
$params array Parameters for the new share.
return Horde_Share The new share object.

formatCompositeField() public static method

Builds and cleans up a composite field.
public static formatCompositeField ( string $format, array $fields ) : string
$format string The sprintf field format.
$fields array The fields that compose the composite field.
return string The formatted composite field.

formatEmailAddresses() public static method

TODO
public static formatEmailAddresses ( mixed $data, string $name ) : mixed
$data mixed Either a single email address or an array of email addresses to format.
$name string The personal name phrase.
return mixed Either the formatted address or an array of formatted addresses.

formatName() public static method

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.
public static formatName ( Turba_Object $ob, string $name_format = null ) : string
$ob Turba_Object The object to get a name from.
$name_format string The formatting. One of 'none', 'last_first' or 'first_last'. Defaults to the user preference.
return string The formatted name, either "Firstname Lastname" or "Lastname, Firstname" depending on $name_format or the user's preference.

getAddressBooks() public static method

Get all the address books the user has the requested permissions to and return them in the user's preferred order.
public static getAddressBooks ( integer $permission = Horde_Perms::READ, array $options = [] ) : array
$permission integer The Horde_Perms::* constant to filter on.
$options array Any additional options.
return array The filtered, ordered $cfgSources entries.

getAvailableEmailFields() public static method

Return an array of all available attributes of type 'email'. Optionally, ensure the field is defined in the specified $source.
Since: 4.2.9
public static getAvailableEmailFields ( $source = null, $searchable = true ) : array
$source string An optional source identifier.
$searchable boolean If true, and $source is provided, ensure that the email field is a configured searchable field.
return array An array of email fields.

getColumnName() public static method

Retrieves a column's field name.
public static getColumnName ( integer $i, array $columns ) : string
$i integer TODO
$columns array TODO
return string TODO

getColumns() public static method

TODO
public static getColumns ( )

getConfigFromShares() public static method

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.
public static getConfigFromShares ( array $sources, boolean $owner = false ) : array
$sources array The default $cfgSources array.
$owner boolean Only return shares that the current user owns?
return array The $cfgSources array.

getDefaultAddressbook() public static method

Returns the current user's default address book.
public static getDefaultAddressbook ( ) : string
return string The default address book name.

getExtendedPermission() public static method

Gets extended permissions on an address book.
public static getExtendedPermission ( Turba_Driver $addressBook, string $permission ) : mixed
$addressBook Turba_Driver The address book to get extended permissions for.
$permission string What extended permission to get.
return mixed The requested extended permissions value, or true if it doesn't exist.

getPreferredSortOrder() public static method

Returns the sort order selected by the user.
public static getPreferredSortOrder ( ) : array
return array TODO

getSourceFromShare() public static method

Retrieve a new source config entry based on a Turba share.
public static getSourceFromShare ( Horde_Share_Object $share ) : array
$share Horde_Share_Object
return array The $cfgSource entry for this share source.

getUserName() public static method

Returns the real name, if available, of a user.
public static getUserName ( string $uid ) : string
$uid string The uid of the name to return.
return string The user's full, real name.

guessLastname() public static method

Returns a best guess at the lastname in a string.
public static guessLastname ( string $name ) : string
$name string String contain the full name.
return string String containing the last name.

hasMaxContacts() public static method

Checks the max_contacts permission.
public static hasMaxContacts ( Turba_Driver $driver, boolean $notify = true ) : string
$driver Turba_Driver The address book to check.
$notify boolean If true, outputs error to notification.
return string Error message if maximum contacts have been reached. False otherwise.

listShares() public static method

Returns all shares the current user has specified permissions to.
public static listShares ( boolean $owneronly = false, integer $permission = Horde_Perms::READ ) : array
$owneronly boolean Only return address books owned by the user? Defaults to false.
$permission integer Permissions to filter by.
return array Shares the user has the requested permissions to.

permissionsFilter() public static method

Filters sources based on permissions.
public static permissionsFilter ( array $in, integer $permission = Horde_Perms::READ, array $options = [] ) : array
$in array The source list we want filtered.
$permission integer The Horde_Perms::* constant we will filter on.
$options array Additional options: - require_add: (boolean) Only return sources that can be added to.
return array The filtered data.

setPreferredSortOrder() public static method

Saves the sort order to the preferences backend.
public static setPreferredSortOrder ( Horde_Variables $vars, string $source )
$vars Horde_Variables Variables object.
$source string Source.

Property Details

$_cache protected static property

Cached data.
protected static array $_cache
return array

$source public static property

The current source.
public static string $source
return string