Turba
in package
Turba Base Class.
Tags
Table of Contents
- VFS_PATH = '.horde/turba/documents'
- The virtual path to use for VFS data.
- $source : string
- The current source.
- $_cache : array<string|int, mixed>
- Cached data.
- addBrowseJs() : mixed
- Add browse.js javascript to page.
- availableSources() : array<string|int, mixed>
- Returns the source entries from config/backends.php that have been configured as available sources in the main Turba configuration.
- createShare() : Horde_Share
- Create a new Turba share.
- formatCompositeField() : string
- Builds and cleans up a composite field.
- formatEmailAddresses() : mixed
- TODO
- formatName() : string
- Formats the name according to the user's preference.
- getAddressBooks() : array<string|int, mixed>
- Get all the address books the user has the requested permissions to and return them in the user's preferred order.
- getAvailableEmailFields() : array<string|int, mixed>
- Return an array of all available attributes of type 'email'. Optionally, ensure the field is defined in the specified $source.
- getColumnName() : string
- Retrieves a column's field name.
- getColumns() : mixed
- TODO
- getConfigFromShares() : array<string|int, mixed>
- 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() : mixed
- Gets extended permissions on an address book.
- getPreferredSortOrder() : array<string|int, mixed>
- Returns the sort order selected by the user.
- getSourceFromShare() : array<string|int, mixed>
- Retrieve a new source config entry based on a Turba share.
- getUserName() : string
- Returns the real name, if available, of a user.
- guessLastname() : string
- Returns a best guess at the lastname in a string.
- hasMaxContacts() : string
- Checks the max_contacts permission.
- listShares() : array<string|int, mixed>
- Returns all shares the current user has specified permissions to.
- permissionsFilter() : array<string|int, mixed>
- Filters sources based on permissions.
- setPreferredSortOrder() : mixed
- Saves the sort order to the preferences backend.
Constants
VFS_PATH
The virtual path to use for VFS data.
public
mixed
VFS_PATH
= '.horde/turba/documents'
Properties
$source
The current source.
public
static string
$source
$_cache
Cached data.
protected
static array<string|int, mixed>
$_cache
= array()
Methods
addBrowseJs()
Add browse.js javascript to page.
public
static addBrowseJs() : mixed
Return values
mixed —availableSources()
Returns the source entries from config/backends.php that have been configured as available sources in the main Turba configuration.
public
static availableSources() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —List of available sources.
createShare()
Create a new Turba share.
public
static createShare(string $share_name, array<string|int, mixed> $params) : Horde_Share
Parameters
- $share_name : string
-
The id for the new share.
- $params : array<string|int, mixed>
-
Parameters for the new share.
Tags
Return values
Horde_Share —The new share object.
formatCompositeField()
Builds and cleans up a composite field.
public
static formatCompositeField(string $format, array<string|int, mixed> $fields) : string
Parameters
- $format : string
-
The sprintf field format.
- $fields : array<string|int, mixed>
-
The fields that compose the composite field.
Return values
string —The formatted composite field.
formatEmailAddresses()
TODO
public
static formatEmailAddresses(mixed $data, string $name) : mixed
Parameters
- $data : mixed
-
Either a single email address or an array of email addresses to format.
- $name : string
-
The personal name phrase.
Return values
mixed —Either the formatted address or an array of formatted addresses.
formatName()
Formats the name according to the user's preference.
public
static formatName(Turba_Object $ob[, string $name_format = null ]) : string
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
- $ob : Turba_Object
-
The object to get a name from.
- $name_format : string = null
-
The formatting. One of 'none', 'last_first' or 'first_last'. Defaults to the user preference.
Return values
string —The formatted name, either "Firstname Lastname" or "Lastname, Firstname" depending on $name_format or the user's preference.
getAddressBooks()
Get all the address books the user has the requested permissions to and return them in the user's preferred order.
public
static getAddressBooks([int $permission = Horde_Perms::READ ][, array<string|int, mixed> $options = array() ]) : array<string|int, mixed>
Parameters
- $permission : int = Horde_Perms::READ
-
The Horde_Perms::* constant to filter on.
- $options : array<string|int, mixed> = array()
-
Any additional options.
Return values
array<string|int, mixed> —The filtered, ordered $cfgSources entries.
getAvailableEmailFields()
Return an array of all available attributes of type 'email'. Optionally, ensure the field is defined in the specified $source.
public
static getAvailableEmailFields([ $source = null ][, $searchable = true ]) : array<string|int, mixed>
Parameters
- $source : = null
-
string An optional source identifier.
- $searchable : = true
-
boolean If true, and $source is provided, ensure that the email field is a configured searchable field.
Tags
Return values
array<string|int, mixed> —An array of email fields.
getColumnName()
Retrieves a column's field name.
public
static getColumnName(int $i, array<string|int, mixed> $columns) : string
Parameters
- $i : int
-
TODO
- $columns : array<string|int, mixed>
-
TODO
Return values
string —TODO
getColumns()
TODO
public
static getColumns() : mixed
Return values
mixed —getConfigFromShares()
Replaces all share-enabled sources in a source list with all shares from this source that the current user has access to.
public
static getConfigFromShares(array<string|int, mixed> $sources[, bool $owner = false ][, array<string|int, mixed> $options = array() ]) : array<string|int, mixed>
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
- $sources : array<string|int, mixed>
-
The default $cfgSources array.
- $owner : bool = false
-
Only return shares that the current user owns?
- $options : array<string|int, mixed> = array()
-
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.
Return values
array<string|int, mixed> —The $cfgSources array.
getDefaultAddressbook()
Returns the current user's default address book.
public
static getDefaultAddressbook() : string
Return values
string —The default address book name.
getExtendedPermission()
Gets extended permissions on an address book.
public
static getExtendedPermission(Turba_Driver $addressBook, string $permission) : mixed
Parameters
- $addressBook : Turba_Driver
-
The address book to get extended permissions for.
- $permission : string
-
What extended permission to get.
Return values
mixed —The requested extended permissions value, or true if it doesn't exist.
getPreferredSortOrder()
Returns the sort order selected by the user.
public
static getPreferredSortOrder() : array<string|int, mixed>
Return values
array<string|int, mixed> —TODO
getSourceFromShare()
Retrieve a new source config entry based on a Turba share.
public
static getSourceFromShare(Horde_Share_Object $share) : array<string|int, mixed>
Parameters
- $share : Horde_Share_Object
Return values
array<string|int, mixed> —The $cfgSource entry for this share source.
getUserName()
Returns the real name, if available, of a user.
public
static getUserName(string $uid) : string
Parameters
- $uid : string
-
The uid of the name to return.
Return values
string —The user's full, real name.
guessLastname()
Returns a best guess at the lastname in a string.
public
static guessLastname(string $name) : string
Parameters
- $name : string
-
String contain the full name.
Return values
string —String containing the last name.
hasMaxContacts()
Checks the max_contacts permission.
public
static hasMaxContacts(Turba_Driver $driver[, bool $notify = true ]) : string
Parameters
- $driver : Turba_Driver
-
The address book to check.
- $notify : bool = true
-
If true, outputs error to notification.
Return values
string —Error message if maximum contacts have been reached. False otherwise.
listShares()
Returns all shares the current user has specified permissions to.
public
static listShares([bool $owneronly = false ][, int $permission = Horde_Perms::READ ]) : array<string|int, mixed>
Parameters
- $owneronly : bool = false
-
Only return address books owned by the user? Defaults to false.
- $permission : int = Horde_Perms::READ
-
Permissions to filter by.
Return values
array<string|int, mixed> —Shares the user has the requested permissions to.
permissionsFilter()
Filters sources based on permissions.
public
static permissionsFilter(array<string|int, mixed> $in[, int $permission = Horde_Perms::READ ][, array<string|int, mixed> $options = array() ]) : array<string|int, mixed>
Parameters
- $in : array<string|int, mixed>
-
The source list we want filtered.
- $permission : int = Horde_Perms::READ
-
The Horde_Perms::* constant we will filter on.
- $options : array<string|int, mixed> = array()
-
Additional options:
- require_add: (boolean) Only return sources that can be added to.
Return values
array<string|int, mixed> —The filtered data.
setPreferredSortOrder()
Saves the sort order to the preferences backend.
public
static setPreferredSortOrder(Horde_Variables $vars, string $source) : mixed
Parameters
- $vars : Horde_Variables
-
Variables object.
- $source : string
-
Source.