Documentation

Turba_Object_Group extends Turba_Object
in package

This class provides a set of methods for dealing with contact groups.

Tags
author

Chuck Hagenbuch chuck@horde.org

author

Jon Parise jon@csh.rit.edu

category

Horde

copyright

2000-2017 Horde LLC

license

http://www.horde.org/licenses/apache ASL

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_Group.
addFile()  : mixed
Saves a file into the VFS backend associated with this object.
addMember()  : mixed
Adds a new contact entry to this group.
count()  : int
Count the number of contacts in this group.
createGroup()  : object
Add members to a group, creating the group if necessary.
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.
listMembers()  : Turba_List
Retrieve the Objects in this group
merge()  : mixed
Merges another contact into this one by filling empty fields of this contact with values from the other.
removeMember()  : mixed
Deletes a contact from this group.
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()  : Horde_Url
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

$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_Group.

public __construct(Turba_Driver $driver[, array<string|int, mixed> $attributes = array() ][, array<string|int, mixed> $options = array() ]) : mixed
Parameters
$driver : Turba_Driver

The driver object that this group comes from.

$attributes : array<string|int, mixed> = array()

Hash of attributes for this group.

$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
throws
Turba_Exception
Return values
mixed

addMember()

Adds a new contact entry to this group.

public addMember(string $contactId[, string $sourceId = null ]) : mixed
Parameters
$contactId : string

The id of the contact to add.

$sourceId : string = null

The source $contactId is from.

Tags
throws
Turba_Exception
throws
Horde_Exception_NotFound
Return values
mixed

count()

Count the number of contacts in this group.

public count() : int
Return values
int

createGroup()

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

public static createGroup(string $source, array<string|int, mixed> $members[, array<string|int, mixed> $opts = array() ]) : object
Parameters
$source : string

Destination source.

$members : array<string|int, mixed>

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

$opts : array<string|int, mixed> = array()

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.
Tags
throws
Turba_Exception
Return values
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.

deleteFile()

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

public deleteFile(string $file) : mixed
Parameters
$file : string

The file name.

Tags
throws
Turba_Exception
Return values
mixed

deleteFiles()

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

public deleteFiles() : mixed
Tags
throws
Turba_Exception
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.

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.

listMembers()

Retrieve the Objects in this group

public listMembers([array<string|int, mixed> $sort = null ]) : Turba_List
Parameters
$sort : array<string|int, mixed> = null

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

Return values
Turba_List

List containing the members of this group

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

removeMember()

Deletes a contact from this group.

public removeMember(string $contactId[, string $sourceId = null ]) : mixed
Parameters
$contactId : string

The id of the contact to remove.

$sourceId : string = null

The source $contactId is from.

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
throws
Turba_Exception
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([mixed $view = null ][, mixed $full = false ]) : Horde_Url
Parameters
$view : mixed = null

The view for the url

$full : mixed = false

Generate a full url?

Return values
Horde_Url

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
throws
Turba_Exception
Return values
Horde_Vfs

A VFS object.

Search results