Methods summary
public
|
|
public static
|
|
public
|
|
public
integer
|
#
getId( )
Returns contact's numeric id.
Returns contact's numeric id.
Returns
integer
See
|
public
string
|
#
getName( )
Returns the value of contact's name property.
Returns the value of contact's name property.
Returns
string
See
|
public
string
|
#
getPhoto( integer|string|null $width = null, integer|string|null $height = null )
Returns contact's photo URL.
Returns contact's photo URL.
Parameters
- $width
integer|string|null $width Image width. Arbitrary integer value, or string value 'original', which
requires that method must return the URL of the original image originally
uploaded from a user's computer. Defaults to 96.
- $height
integer|string|null $height Image height (integer). If not specified, the integer value specified
for the $width parameter is used.
Returns
string
See
|
public
string
|
#
getPhoto2x( integer $size )
Returns contact's photo URL @2x.
Returns contact's photo URL @2x.
Parameters
Returns
string
|
public static
string
|
#
getPhotoUrl( mixed $id, mixed $ts, integer|string|null $width = null, integer|string|null $height = null, string $type = 'person', boolean $retina = null )
Returns the photo URL of the specified contact.
Returns the photo URL of the specified contact.
Parameters
- $id
mixed $id Contact id
- $ts
mixed $ts Contact photo id stored in contact's 'photo' property. If not specified, the
URL of the default userpic is returned.
- $width
integer|string|null $width Image width. Arbitrary integer value, or string value 'original', which
requires that method must return the URL of the original image originally
uploaded from a user's computer. Defaults to 96.
- $height
integer|string|null $height Image height (integer). If not specified, the integer value specified
for the $width parameter is used.
- $type
string $type
- $retina
boolean $retina
Returns
string
See
|
public static
|
#
getPhotoDir( mixed $contact_id, mixed $with_prefix = true )
|
public
string
|
#
setPhoto( string $file )
Adds an image to contact.
Adds an image to contact.
Parameters
- $file
string $file Path to image file
Returns
string
Throws
See
|
public
boolean
|
#
delete( )
Deletes current contact.
Returns
boolean Whether contact was deleted successfully
See
|
public
mixed
|
#
get( string $field_id, string|null $format = null )
Returns the value of a contact's property.
Returns the value of a contact's property.
Parameters
- $field_id
string $field_id Contact property id: - field name from wa_contact table - 'email' -
any custom field name from wa_contact_data table Additional allowed formats of
property id: - 'field_id:subfield_id' for composite fields; e.g.,
'address:street' - 'field_id.ext' for subfields of multi-fields with extension;
e.g., 'phone.work'
- $format
string|null $format Data format: - 'default': simple text value of a contact property; for
multi-fields, the first of available values is returned - 'value': simple text
value of a contact property; for multi-fields, an array of all available values
is returned - 'html': the full value of a contact property formatted by means of
HTML code for displaying in a web page - 'js': simple text value of a contact
property; for multi-fields, an array of all available values is returned, which
contains the following elements for each value: a) 'value': the value of a
contact property formatted by means of HTML code for displaying in a web page b)
'data': simple text value of a multi-field property as a string or array In
addition to these basic elements, each sub-array of the returned array may
contain other elements specific to various contact properties. - If no format is
specified: simple text value of a contact property is returned; for
multi-fields, an array of all available values is returned, which contains a
value element with a property's simple text value as well as other elements
specific to various contact properties.
Returns
mixed
See
|
public
mixed
|
#
getFirst( string $field_id )
Returns the first value of a contact's multi-field.
Returns the first value of a contact's multi-field.
Parameters
- $field_id
string $field_id Contact property id
Returns
mixed
See
|
public
string
|
#
getCode( )
Returns code for the user
Returns code for the user
Returns
string
|
public
|
#
load( unknown_type $format = false, unknown_type $all = false )
Returns full information about contact, which is stored in cache.
Returns full information about contact, which is stored in cache.
Parameters
- $format
unknown_type $format Data format
- $all
unknown_type $all Flag requiring to return the values of fields marked as hidden in file
wa-system/contact/data/fields.php.
See
|
public
integer|array
|
#
validate( array $data = array() )
Validates specified values of contact properties.
Validates specified values of contact properties.
Parameters
- $data
array $data Associative array of contact property values.
Returns
integer|array Zero, if no errors were found in provided data, or array of error messages
otherwise
See
|
public
boolean
|
|
public
integer|array
|
#
save( array $data = array(), boolean $validate = false )
Saves contact's data to database.
Saves contact's data to database.
Parameters
- $data
array $data Associative array of contact property values.
- $validate
boolean $validate Flag requiring to validate property values. Defaults to false.
Returns
integer|array Zero, if saved successfully, or array of error messages otherwise
See
|
public
|
|
public
string
|
#
getLocale( )
Returns contact's locale id.
Returns contact's locale id.
Returns
string
See
|
public
string
|
#
getTimezone( )
Returns contact's time zone value.
Returns contact's time zone value.
Returns
string
See
|
public
mixed
|
#
getCache( string $field_id = null, mixed $old_value = false )
Returns the value of a contact's property stored in cache, without accessing
the database.
Returns the value of a contact's property stored in cache, without accessing
the database.
Parameters
- $field_id
string $field_id Contact property id. If not specified, information about all
properties of a contact is returned.
- $old_value
mixed $old_value Flag requiring to return only contact property values retrieved from
the database and to ignore dynamically added ones. If not specified, false is
used by default: return both values stored in the database and those added
dynamically.
Returns
mixed
See
|
public
boolean
|
#
issetCache( string $field_id, boolean $old_value = false )
Parameters
- $field_id
string $field_id
- $old_value
boolean $old_value
Returns
boolean
|
public static
|
#
setCacheFor( integer $id, array $data = null )
Static variant of setCache() Accepts one parameter: array(contact_id =>
array(field => data)) or two parameters: contact_id and array(field =>
data)
Static variant of setCache() Accepts one parameter: array(contact_id =>
array(field => data)) or two parameters: contact_id and array(field =>
data)
Parameters
- $id
integer $id
- $data
array $data
|
public
|
|
public
|
|
public
mixed
|
#
getSettings( string|null $app_id, string|null $name = null, string|null $default = null )
Returns the properties of a cointact relating to specified app.
Returns the properties of a cointact relating to specified app.
Parameters
- $app_id
string|null $app_id App id
- $name
string|null $name Id of the contact property associated with the specified app which must be
returned. If not specified, an associative array of all properties of a contact
is returned, which are associated with the specified app.
- $default
string|null $default The default value, which must be returned, if the specified contact
property for the specified app is not available. If contact property id is not
specified for $default parameter, then the value of $default parameter is
ignored.
Returns
mixed
See
|
public
boolean
|
#
setSettings( string $app_id, string $name, mixed $value = null )
Saves properties of specified contact to database.
Saves properties of specified contact to database.
Parameters
- $app_id
string $app_id Id of the app for which a value of a contact property must be set
- $name
string $name Contact property id
- $value
mixed $value Contact property value
Returns
boolean Whether saved successfully
See
|
public
|
#
delSettings( string $app_id, string $name )
Deletes contact's property relating to specified app.
Deletes contact's property relating to specified app.
Parameters
- $app_id
string $app_id App id
- $name
string $name Contact property id
See
|
public
integer|boolean|array
|
#
getRights( string $app_id, string $name = null, boolean $assoc = true )
Returns information about a contact's access rights configuration.
Returns information about a contact's access rights configuration.
Parameters
- $app_id
string $app_id Id of the app for which contact's access rights configuration must be
returned.
- $name
string $name String id of the access rights element available for the specified app. If
not specified, all values of access rights for the current contact are returned.
If % character is appended to the access rights element id, then the access
rights values for that element are returned as an array. The array structure is
defined by the value of the $assoc parameter.
- $assoc
boolean $assoc Flag defining the structure of the returned array: - true (default):
multi-fields of access rights configuration elements are included in the
returned array with access rights elements' ids as array keys and 1 as their
values. - false: array keys are incremented starting from 0, array item values
containing the ids of access rights configuration elements of access rights
multi-fields enabled for a user.
Returns
integer|boolean|array
See
|
public
boolean
|
#
isAdmin( string $app_id = 'webasyst' )
Returns information about whether a user has full (adminstrative) access
rights to all installed apps or only one specified app.
Returns information about whether a user has full (adminstrative) access
rights to all installed apps or only one specified app.
Parameters
- $app_id
string $app_id App id. If not specified, access rights for all installed apps are
verified.
Returns
boolean
See
|
public
boolean
|
#
setRight( string $app_id, string $name, integer $value )
Sets access rights for a user. If a user has administrative access rights for
the specified app, then an attempt to change his access rights configuration
using this method is ignored.
Sets access rights for a user. If a user has administrative access rights for
the specified app, then an attempt to change his access rights configuration
using this method is ignored.
Parameters
- $app_id
string $app_id Id of the app for which contact's access rights must be set
- $name
string $name Access rights element id supported by specified app
- $value
integer $value Access rights value
Returns
boolean Whether access rights have been set successfully
See
|
public
string
|
#
getStatus( )
Returns user's status: "online", "offline"
Returns user's status: "online", "offline"
Returns
string
See
|
public
|
|
public
|
|
public
|
#
add( string $field, mixed $value )
Adds an extra value to specified contact property.
Adds an extra value to specified contact property.
Parameters
- $field
string $field Contact property id
- $value
mixed $value Property value
See
|
public
|
|
public static
string
|
#
getPasswordHash( string $password )
Returns hash for specified password string.
Returns hash for specified password string.
By default, hash is generated using PHP function md5(). If configuration file
wa-config/SystemConfig.class.php contains information about user-defined
function wa_password_hash(), then that function is used for generating password
hash instead of md5().
Parameters
- $password
string $password Password string
Returns
string
See
|
public
|
#
addToCategory( integer|string $category_id )
Adds contact to a category.
Adds contact to a category.
Parameters
- $category_id
integer|string $category_id Category's simple numeric or system string key (app_id)
Throws
See
|
public
|
#
set( string $field_id, mixed $value, boolean $add = false )
Sets a value for specified contact property.
Sets a value for specified contact property.
Parameters
- $field_id
string $field_id Contact property id
- $value
mixed $value Property value
- $add
boolean $add Flag requiring to add specified value to existing values of a multi-field.
If false, all existing values of the specified multi-field are deleted and
replaced with specified value.
See
|
public
|
|
public
|
|
public
string
|
|