Overview

Packages

  • Prefs

Classes

  • Horde_Prefs
  • Horde_Prefs_Cache_Base
  • Horde_Prefs_Cache_Null
  • Horde_Prefs_Cache_Session
  • Horde_Prefs_CategoryManager
  • Horde_Prefs_Exception
  • Horde_Prefs_Identity
  • Horde_Prefs_Scope
  • Horde_Prefs_Storage_Base
  • Horde_Prefs_Storage_File
  • Horde_Prefs_Storage_Imsp
  • Horde_Prefs_Storage_KolabImap
  • Horde_Prefs_Storage_Ldap
  • Horde_Prefs_Storage_Null
  • Horde_Prefs_Storage_Sql
  • Horde_Prefs_Translation
  • Overview
  • Package
  • Class
  • Tree

Class Horde_Prefs_Identity

This class provides an interface to all identities a user might have.

Copyright 2001-2012 Horde LLC (http://www.horde.org/)

See the enclosed file COPYING for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.

Package: Prefs
Category: Horde
License: LGPL 2.1
Author: Jan Schneider jan@horde.org
Located at Horde/Prefs/Identity.php
Methods summary
public
# __construct( array $params = array() )

Constructor.

Constructor.

Parameters

$params
Parameters: <pre>default_identity: (string) The preference name <span class="php-keyword1">for</span> the <span class="php-keyword1">default</span> identity. <span class="php-keyword1">DEFAULT</span>: <span class="php-quote">'default_identity'</span> from_addr: (string) The preference name <span class="php-keyword1">for</span> the user<span class="php-quote">'s from e-mail address. DEFAULT: '</span>from_addr<span class="php-quote">' fullname: (string) The preference name for the user'</span>s full name. <span class="php-keyword1">DEFAULT</span>: <span class="php-quote">'fullname'</span> id: (string) The preference name <span class="php-keyword1">for</span> the identity name. <span class="php-keyword1">DEFAULT</span>: <span class="php-quote">'id'</span> identities: (string) The preference name <span class="php-keyword1">for</span> the identity store. <span class="php-keyword1">DEFAULT</span>: <span class="php-quote">'identities'</span> prefs: (Horde_Prefs) [REQUIRED] The prefs object to <span class="php-keyword1">use</span>. properties: (<span class="php-keyword1">array</span>) The <span class="php-keyword1">list</span> of properties <span class="php-keyword1">for</span> the identity. <span class="php-keyword1">DEFAULT</span>: <span class="php-keyword1">array</span>(<span class="php-quote">'from_addr'</span>, <span class="php-quote">'fullname'</span>, <span class="php-quote">'id'</span>) user: (string) [REQUIRED] The user whose prefs we are handling.</pre>
public
# init( )

Creates a default identity if none exists yet and sets the preferences up if the identities are locked.

Creates a default identity if none exists yet and sets the preferences up if the identities are locked.

public
# save( )

Saves all identities in the prefs backend.

Saves all identities in the prefs backend.

public integer
# add( array $identity = array() )

Adds a new identity to the array of identities.

Adds a new identity to the array of identities.

Parameters

$identity
An identity hash to add.

Returns

integer
The pointer to the created identity
public array
# get( integer $identity = null )

Returns a complete identity hash.

Returns a complete identity hash.

Parameters

$identity
The identity to retrieve.

Returns

array
An identity hash.
public array
# delete( integer $identity )

Removes an identity from the array of identities.

Removes an identity from the array of identities.

Parameters

$identity
The pointer to the identity to be removed

Returns

array
The removed identity.
public integer
# getDefault( )

Returns a pointer to the current default identity.

Returns a pointer to the current default identity.

Returns

integer
The pointer to the current default identity.
public boolean
# setDefault( integer $identity )

Sets the current default identity. If the identity doesn't exist, the old default identity stays the same.

Sets the current default identity. If the identity doesn't exist, the old default identity stays the same.

Parameters

$identity
The pointer to the new default identity.

Returns

boolean
True on success, false on failure.
public mixed
# getValue( string $key, integer $identity = null )

Returns a property from one of the identities. If this value doesn't exist or is locked, the property is retrieved from the prefs backend.

Returns a property from one of the identities. If this value doesn't exist or is locked, the property is retrieved from the prefs backend.

Parameters

$key
The property to retrieve.
$identity
The identity to retrieve the property from.

Returns

mixed
The value of the property.
public array
# getAll( string $key )

Returns an array with the specified property from all existing identities.

Returns an array with the specified property from all existing identities.

Parameters

$key
The property to retrieve.

Returns

array
The array with the values from all identities.
public boolean
# setValue( string $key, mixed $val, integer $identity = null )

Sets a property with a specified value.

Sets a property with a specified value.

Parameters

$key
The property to set.
$val
<p>The value to which the property should be set.</p>
$identity
The identity to set the property in.

Returns

boolean

True on success, false on failure (property was locked).

public boolean
# isLocked( )

Returns true if all properties are locked and therefore nothing in the identities can be changed.

Returns true if all properties are locked and therefore nothing in the identities can be changed.

Returns

boolean
True if all properties are locked, false otherwise.
public boolean
# hasValue( string $key, string $valueA )

Returns true if the given address belongs to one of the identities.

Returns true if the given address belongs to one of the identities.

Parameters

$key
The identity key to search.
$valueA
$value The value to search for in $key.

Returns

boolean
True if the $value was found in $key.
public
# verify( integer $identity = null )

Verifies and sanitizes all identity properties.

Verifies and sanitizes all identity properties.

Parameters

$identity
The identity to verify.

Throws

Horde_Prefs_Exception
public string
# getName( integer $ident = null )

Returns the user's full name.

Returns the user's full name.

Parameters

$ident
The identity to retrieve the name from.

Returns

string

The user's full name, or the user name if it doesn't exist.

public string
# getDefaultFromAddress( boolean $fullname = false )

Generates the from address to use for the default identity.

Generates the from address to use for the default identity.

Parameters

$fullname
Include the fullname information.

Returns

string
The default from address.
API documentation generated by ApiGen