Properties

$driver

$driver : \Turba_Driver

Underlying driver.

Type

\Turba_Driver

$attributes

$attributes : array

Hash of attributes for this contact.

Type

array

$sortValue

$sortValue : array

Keeps the normalized values of sort columns.

Type

array

$_options

$_options : boolean

Any additional options.

Type

boolean

$_vfs

$_vfs : \VFS

Reference to this object's VFS instance.

Type

\VFS

$_attributeFields

$_attributeFields : array

Local cache of available values for a specific attribute type.

A hash with turba attribute names as key. Needed to ensure we populate some fields correctly. See bugs 12955, 14046, and 14673.

Type

array

Methods

__construct()

__construct(\Turba_Driver  $driver, array  $attributes = array(), array  $options = array()) 

Constructs a new Turba_Object_Group.

Parameters

\Turba_Driver $driver

The driver object that this group comes from.

array $attributes

Hash of attributes for this group.

array $options

Hash of options for this object. @since Turba 4.2

getAttributes()

getAttributes() : array

Returns a key-value hash containing all properties of this object.

Returns

array —

All properties of this object.

getSource()

getSource() 

Returns the name of the address book that this object is from.

getGuid()

getGuid(string  $delimiter = ':') : string

Get a fully qualified key for this contact.

Parameters

string $delimiter

Delimiter for the parts of the key, defaults to ':'.

Returns

string —

Fully qualified contact id.

getValue()

getValue(string  $attribute) : mixed

Returns the value of the specified attribute.

Parameters

string $attribute

The attribute to retrieve.

Returns

mixed —

The value of $attribute, an array (for photo type) or the empty string.

setValue()

setValue(string  $attribute, string  $value) 

Sets the value of the specified attribute.

Parameters

string $attribute

The attribute to set.

string $value

The value of $attribute.

ensureAttributes()

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.

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.

hasValue()

hasValue(string  $attribute) : boolean

Determines whether or not the object has a value for the specified attribute.

Parameters

string $attribute

The attribute to check.

Returns

boolean —

Whether or not there is a value for $attribute.

synchronizeTags()

synchronizeTags(array  $tags) 

Syncronizes tags from the tagging backend with the contacts storage backend, if necessary.

Parameters

array $tags

Tags from the tagging backend.

lastModification()

lastModification() : integer

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.

Returns

integer —

The timestamp of the last modification or zero.

merge()

merge(\Turba_Object  $contact) 

Merges another contact into this one by filling empty fields of this contact with values from the other.

Parameters

\Turba_Object $contact

Another contact.

getHistory()

getHistory() : array

Returns history information about this contact.

Returns

array —

A hash with the optional entries 'created' and 'modified' and human readable history information as the values.

isGroup()

isGroup() : boolean

Returns true if this object is a group of multiple contacts.

Returns

boolean —

True.

isEditable()

isEditable() : boolean

Returns true if this object is editable by the current user.

Returns

boolean —

Whether or not the current user can edit this object

hasPermission()

hasPermission(integer  $perm) : boolean

Returns whether or not the current user has the requested permission.

Parameters

integer $perm

The permission to check.

Returns

boolean —

True if user has the permission.

url()

url(string  $view = null, boolean  $full = false) : \Horde_Url

Contact url.

Parameters

string $view

The view for the url

boolean $full

Generate a full url?

Returns

\Horde_Url

addFile()

addFile(array  $info) 

Saves a file into the VFS backend associated with this object.

Parameters

array $info

A hash with the file information as returned from a Horde_Form_Type_file.

Throws

\Turba_Exception

deleteFile()

deleteFile(string  $file) 

Deletes a file from the VFS backend associated with this object.

Parameters

string $file

The file name.

Throws

\Turba_Exception

deleteFiles()

deleteFiles() 

Deletes all files from the VFS backend associated with this object.

Throws

\Turba_Exception

listFiles()

listFiles() : array

Returns all files from the VFS backend associated with this object.

Returns

array —

A list of hashes with file informations.

vfsDisplayUrl()

vfsDisplayUrl(string  $file) : string

Returns a link to display and download a file from the VFS backend associated with this object.

Parameters

string $file

The file name.

Returns

string —

The HTML code of the generated link.

vfsEditUrl()

vfsEditUrl(string  $file) : string

Returns a link to display, download, and delete a file from the VFS backend associated with this object.

Parameters

string $file

The file name.

Returns

string —

The HTML code of the generated link.

store()

store() 

Saves the current state of the object to the storage backend.

Throws

\Turba_Exception

vfsInit()

vfsInit() : \Horde_Vfs

Loads the VFS configuration and initializes the VFS backend.

Throws

\Turba_Exception

Returns

\Horde_Vfs —

A VFS object.

addMember()

addMember(string  $contactId, string  $sourceId = null) 

Adds a new contact entry to this group.

Parameters

string $contactId

The id of the contact to add.

string $sourceId

The source $contactId is from.

Throws

\Turba_Exception
\Horde_Exception_NotFound

removeMember()

removeMember(string  $contactId, string  $sourceId = null) 

Deletes a contact from this group.

Parameters

string $contactId

The id of the contact to remove.

string $sourceId

The source $contactId is from.

count()

count() : integer

Count the number of contacts in this group.

Returns

integer

listMembers()

listMembers(array  $sort = null) : \Turba_List

Retrieve the Objects in this group

Parameters

array $sort

The requested sort order which is passed to Turba_List::sort().

Returns

\Turba_List

List containing the members of this group

createGroup()

createGroup(string  $source, array  $members, array  $opts = array()) : object

Add members to a group, creating the group if necessary.

Parameters

string $source

Destination source.

array $members

Members of the group. Array of two-element arrays: source and key.

array $opts

Additional options:

 - attr: (array) Array of attributes to use to create a new group.
         This should include 'name' at a minimum.
 - gid: (string) Existing Group ID.
 - name: (string) Group Name.

Throws

\Turba_Exception

Returns

object —

Object with the following properties:

  - errors: (array) List of errors when adding members.
  - group: (Turba_Object_Group) Group object.
  - success: (integer) Number of members sucessfully added.