Turba_Object
in package
A base implementation for Turba objects - people, groups, restaurants, etc.
Tags
Table of Contents
- $attributes : array<string|int, mixed>
- Hash of attributes for this contact.
- $driver : Turba_Driver
- Underlying driver.
- $sortValue : array<string|int, mixed>
- Keeps the normalized values of sort columns.
- $_attributeFields : array<string|int, mixed>
- Local cache of available values for a specific attribute type.
- $_options : bool
- Any additional options.
- $_vfs : VFS
- Reference to this object's VFS instance.
- __construct() : mixed
- Constructs a new Turba_Object object.
- addFile() : mixed
- Saves a file into the VFS backend associated with this object.
- deleteFile() : mixed
- Deletes a file from the VFS backend associated with this object.
- deleteFiles() : mixed
- Deletes all files from the VFS backend associated with this object.
- ensureAttributes() : mixed
- Ensures we save attributes of a certain type to attributes of the same type but a different attribute name, if the original name didn't exist.
- getAttributes() : array<string|int, mixed>
- Returns a key-value hash containing all properties of this object.
- getGuid() : string
- Get a fully qualified key for this contact.
- getHistory() : array<string|int, mixed>
- Returns history information about this contact.
- getSource() : mixed
- Returns the name of the address book that this object is from.
- getValue() : mixed
- Returns the value of the specified attribute.
- hasPermission() : bool
- Returns whether or not the current user has the requested permission.
- hasValue() : bool
- Determines whether or not the object has a value for the specified attribute.
- isEditable() : bool
- Returns true if this object is editable by the current user.
- isGroup() : bool
- Returns true if this object is a group of multiple contacts.
- lastModification() : int
- Returns the timestamp of the last modification, whether this was the creation or editing of the object and stores it as the attribute __modified. The value is cached for the lifetime of the object.
- listFiles() : array<string|int, mixed>
- Returns all files from the VFS backend associated with this object.
- merge() : mixed
- Merges another contact into this one by filling empty fields of this contact with values from the other.
- setValue() : mixed
- Sets the value of the specified attribute.
- store() : mixed
- Saves the current state of the object to the storage backend.
- synchronizeTags() : mixed
- Syncronizes tags from the tagging backend with the contacts storage backend, if necessary.
- url() : string
- Contact url.
- vfsDisplayUrl() : string
- Returns a link to display and download a file from the VFS backend associated with this object.
- vfsEditUrl() : string
- Returns a link to display, download, and delete a file from the VFS backend associated with this object.
- vfsInit() : Horde_Vfs
- Loads the VFS configuration and initializes the VFS backend.
Properties
$attributes
Hash of attributes for this contact.
public
array<string|int, mixed>
$attributes
$driver
Underlying driver.
public
Turba_Driver
$driver
$sortValue
Keeps the normalized values of sort columns.
public
array<string|int, mixed>
$sortValue
= array()
$_attributeFields
Local cache of available values for a specific attribute type.
protected
array<string|int, mixed>
$_attributeFields
= array()
A hash with turba attribute names as key. Needed to ensure we populate some fields correctly. See bugs 12955, 14046, and 14673.
$_options
Any additional options.
protected
bool
$_options
= array()
$_vfs
Reference to this object's VFS instance.
protected
VFS
$_vfs
Methods
__construct()
Constructs a new Turba_Object object.
public
__construct(Turba_Driver $driver[, array<string|int, mixed> $attributes = array() ][, array<string|int, mixed> $options = array() ]) : mixed
Parameters
- $driver : Turba_Driver
-
The source that this object came from.
- $attributes : array<string|int, mixed> = array()
-
Hash of attributes for this object.
- $options : array<string|int, mixed> = array()
-
Hash of options for this object. @since Turba 4.2
Return values
mixed —addFile()
Saves a file into the VFS backend associated with this object.
public
addFile(array<string|int, mixed> $info) : mixed
Parameters
- $info : array<string|int, mixed>
-
A hash with the file information as returned from a Horde_Form_Type_file.
Tags
Return values
mixed —deleteFile()
Deletes a file from the VFS backend associated with this object.
public
deleteFile(string $file) : mixed
Parameters
- $file : string
-
The file name.
Tags
Return values
mixed —deleteFiles()
Deletes all files from the VFS backend associated with this object.
public
deleteFiles() : mixed
Tags
Return values
mixed —ensureAttributes()
Ensures we save attributes of a certain type to attributes of the same type but a different attribute name, if the original name didn't exist.
public
ensureAttributes() : mixed
Needed to cover the case where a contact might have been imported via vCard with email/phone/etc TYPEs that do not match the configured attributes for this source. E.g., the vCard contains a TYPE=HOME but we only have the generic 'email' field available or vice versa.
Return values
mixed —getAttributes()
Returns a key-value hash containing all properties of this object.
public
getAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed> —All properties of this object.
getGuid()
Get a fully qualified key for this contact.
public
getGuid([string $delimiter = ':' ]) : string
Parameters
- $delimiter : string = ':'
-
Delimiter for the parts of the key, defaults to ':'.
Return values
string —Fully qualified contact id.
getHistory()
Returns history information about this contact.
public
getHistory() : array<string|int, mixed>
Return values
array<string|int, mixed> —A hash with the optional entries 'created' and 'modified' and human readable history information as the values.
getSource()
Returns the name of the address book that this object is from.
public
getSource() : mixed
Return values
mixed —getValue()
Returns the value of the specified attribute.
public
getValue(string $attribute) : mixed
Parameters
- $attribute : string
-
The attribute to retrieve.
Return values
mixed —The value of $attribute, an array (for photo type) or the empty string.
hasPermission()
Returns whether or not the current user has the requested permission.
public
hasPermission(int $perm) : bool
Parameters
- $perm : int
-
The permission to check.
Return values
bool —True if user has the permission.
hasValue()
Determines whether or not the object has a value for the specified attribute.
public
hasValue(string $attribute) : bool
Parameters
- $attribute : string
-
The attribute to check.
Return values
bool —Whether or not there is a value for $attribute.
isEditable()
Returns true if this object is editable by the current user.
public
isEditable() : bool
Return values
bool —Whether or not the current user can edit this object
isGroup()
Returns true if this object is a group of multiple contacts.
public
isGroup() : bool
Return values
bool —True if this object is a group of multiple contacts.
lastModification()
Returns the timestamp of the last modification, whether this was the creation or editing of the object and stores it as the attribute __modified. The value is cached for the lifetime of the object.
public
lastModification() : int
Return values
int —The timestamp of the last modification or zero.
listFiles()
Returns all files from the VFS backend associated with this object.
public
listFiles() : array<string|int, mixed>
Return values
array<string|int, mixed> —A list of hashes with file informations.
merge()
Merges another contact into this one by filling empty fields of this contact with values from the other.
public
merge(Turba_Object $contact) : mixed
Parameters
- $contact : Turba_Object
-
Another contact.
Return values
mixed —setValue()
Sets the value of the specified attribute.
public
setValue(string $attribute, string $value) : mixed
Parameters
- $attribute : string
-
The attribute to set.
- $value : string
-
The value of $attribute.
Return values
mixed —store()
Saves the current state of the object to the storage backend.
public
store() : mixed
Tags
Return values
mixed —synchronizeTags()
Syncronizes tags from the tagging backend with the contacts storage backend, if necessary.
public
synchronizeTags(array<string|int, mixed> $tags) : mixed
Parameters
- $tags : array<string|int, mixed>
-
Tags from the tagging backend.
Return values
mixed —url()
Contact url.
public
url([string $view = null ][, bool $full = false ]) : string
Parameters
- $view : string = null
-
The view for the url
- $full : bool = false
-
Generate a full url?
Return values
string —vfsDisplayUrl()
Returns a link to display and download a file from the VFS backend associated with this object.
public
vfsDisplayUrl(string $file) : string
Parameters
- $file : string
-
The file name.
Return values
string —The HTML code of the generated link.
vfsEditUrl()
Returns a link to display, download, and delete a file from the VFS backend associated with this object.
public
vfsEditUrl(string $file) : string
Parameters
- $file : string
-
The file name.
Return values
string —The HTML code of the generated link.
vfsInit()
Loads the VFS configuration and initializes the VFS backend.
public
vfsInit() : Horde_Vfs
Tags
Return values
Horde_Vfs —A VFS object.