Overview

Packages

  • akismet
  • None
  • PHP
  • Smarty
    • Cacher
    • Compiler
    • Config
    • Debug
    • plugins
    • PluginsBlock
    • PluginsFilter
    • PluginsFunction
    • PluginsInternal
    • PluginsModifier
    • PluginsModifierCompiler
    • PluginsShared
    • Security
    • Template
    • TemplateResources
  • Swift
    • ByteStream
    • CharacterStream
    • Encoder
    • Events
    • KeyCache
    • Mailer
    • Mime
    • Plugins
    • Signatures
    • Signed
    • Transport
  • wa-apps
    • blog
      • actions
        • backend
        • blog
        • comment
        • cron
        • design
        • frontend
        • page
        • plugin
        • post
      • api
        • v1
      • cli
      • layout
      • model
      • plugin
        • aksimet
        • category
        • emailsubscription
        • favorite
        • gravatar
        • import
        • markdown
        • myposts
        • tag
        • troll
      • settings
    • checklists
      • backend
      • json
    • contacts
      • backend
    • developer
    • dummy
    • guestbook
    • guestbook2
    • photos
      • album
      • api
        • v1
      • backend
      • design
      • dialog
      • frontend
      • page
      • photo
      • plugin
        • comment
        • imageeffects
        • import
        • publicgallery
        • watermark
      • search
      • settings
      • stack
      • tag
      • upload
    • site
      • backend
      • blocks
      • config
      • design
      • domains
      • files
      • frontend
      • helper
      • layout
      • pages
      • routing
      • setting
    • stickies
      • api
        • v1
      • sheet
      • stiky
  • wa-plugin
    • payment
    • shipping
    • sms
  • wa-plugins
    • shipping
      • usps
  • wa-system
    • API
    • Auth
      • Adapters
    • Autoload
    • Cache
      • Adapter
    • Captcha
    • Config
    • Contact
    • controller
    • currency
    • database
    • datetime
    • design
    • event
    • exception
    • files
    • image
    • layout
    • locale
    • log
    • mail
    • page
      • action
      • model
    • payment
    • plugin
    • request
    • response
    • routing
    • shipping
    • sms
    • storage
    • user
    • util
    • validator
    • view
    • webasyst
      • api
      • backend
      • cli
      • config
      • layout
      • login
      • model
      • password
      • payment
      • profile
      • settings
      • shipment
    • widget
    • workflow
  • waPlugins
    • Payment
  • webasyst
    • wa-system
      • helper

Classes

  • waContact
  • waContactAddressField
  • waContactAddressForMapFormatter
  • waContactAddressOneLineFormatter
  • waContactAddressSeveralLinesFormatter
  • waContactBirthdayField
  • waContactBirthdayJSFormatter
  • waContactBirthdayLocalFormatter
  • waContactBranchField
  • waContactCategoriesField
  • waContactCategoryStorage
  • waContactCheckboxField
  • waContactChecklistField
  • waContactCompositeField
  • waContactConditionalField
  • waContactCountryField
  • waContactCountryFormatter
  • waContactDataStorage
  • waContactDataTextStorage
  • waContactDateField
  • waContactDateLocalFormatter
  • waContactEmailField
  • waContactEmailListFormatter
  • waContactEmailStorage
  • waContactEmailTopFormatter
  • waContactField
  • waContactFieldFormatter
  • waContactFields
  • waContactForm
  • waContactHiddenField
  • waContactIMJSFormatter
  • waContactIMTopFormatter
  • waContactInfoStorage
  • waContactLocaleField
  • waContactLocaleFormatter
  • waContactNameField
  • waContactNumberField
  • waContactPasswordField
  • waContactPhoneField
  • waContactPhoneFormatter
  • waContactPhoneJsFormatter
  • waContactPhoneTopFormatter
  • waContactRadioSelectField
  • waContactRegionField
  • waContactsCollection
  • waContactSelectField
  • waContactSelectFormatter
  • waContactSocialNetworkJSFormatter
  • waContactSocialNetworkTopFormatter
  • waContactStorage
  • waContactStringField
  • waContactTextField
  • waContactTimezoneField
  • waContactUrlField
  • waContactUrlHtmlFormatter
  • waContactUrlJsFormatter
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo

Class waContact

This file is part of Webasyst framework.

Licensed under the terms of the GNU Lesser General Public License (LGPL). http://www.webasyst.com/framework/license/

waContact implements ArrayAccess

Direct known subclasses

waUser

Indirect known subclasses

waAuthUser
Package: wa-system\Contact
Copyright: 2011 Webasyst LLC
License: LGPL
Author: Webasyst LLC
See: http://www.webasyst.ru/developers/docs/basics/classes/waContact/
Link: http://www.webasyst.com/
Located at wa-system/contact/waContact.class.php
Methods summary
public
# __construct( mixed $id = null, mixed $options = array() )
public static
# getOption( mixed $name, mixed $default = null )
public
# init( )
public integer
# getId( )

Returns contact's numeric id.

Returns contact's numeric id.

Returns

integer

See

http://www.webasyst.ru/developers/docs/basics/classes/waContact/#method-getId
public string
# getName( )

Returns the value of contact's name property.

Returns the value of contact's name property.

Returns

string

See

http://www.webasyst.ru/developers/docs/basics/classes/waContact/#method-getName
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

http://www.webasyst.ru/developers/docs/basics/classes/waContact/#method-getPhoto
public string
# getPhoto2x( integer $size )

Returns contact's photo URL @2x.

Returns contact's photo URL @2x.

Parameters

$size
integer
$size

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

http://www.webasyst.ru/developers/docs/basics/classes/waContact/#method-getPhotoUrl
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

waException

See

http://www.webasyst.ru/developers/docs/basics/classes/waContact/#method-setPhoto
public boolean
# delete( )

Deletes current contact.

Deletes current contact.

Returns

boolean
Whether contact was deleted successfully

See

http://www.webasyst.ru/developers/docs/basics/classes/waContact/#method-delete
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

http://www.webasyst.ru/developers/docs/basics/classes/waContact/#method-get
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

http://www.webasyst.ru/developers/docs/basics/classes/waContact/#method-getFirst
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

http://www.webasyst.ru/developers/docs/basics/classes/waContact/#method-load
waContact::get()
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

http://www.webasyst.ru/developers/docs/basics/classes/waContact/#method-validate
public boolean
# exists( )

Returns

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

http://www.webasyst.ru/developers/docs/basics/classes/waContact/#method-save
public
# clearDisabledFields( )
public string
# getLocale( )

Returns contact's locale id.

Returns contact's locale id.

Returns

string

See

http://www.webasyst.ru/developers/docs/basics/classes/waContact/#method-getLocale
public string
# getTimezone( )

Returns contact's time zone value.

Returns contact's time zone value.

Returns

string

See

http://www.webasyst.ru/developers/docs/basics/classes/waContact/#method-getTimezone
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

http://www.webasyst.ru/developers/docs/basics/classes/waContact/#method-getCache
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
# setCache( array $data )

Parameters

$data
array
$data
public
# removeCache( mixed $keys = null )
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

http://www.webasyst.ru/developers/docs/basics/classes/waContact/#method-getSettings
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

http://www.webasyst.ru/developers/docs/basics/classes/waContact/#method-setSettings
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

http://www.webasyst.ru/developers/docs/basics/classes/waContact/#method-delSettings
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

http://www.webasyst.ru/developers/docs/basics/classes/waContact/#method-getRights
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

http://www.webasyst.ru/developers/docs/basics/classes/waContact/#method-isAdmin
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

http://www.webasyst.ru/developers/docs/basics/classes/waContact/#method-setRight
public string
# getStatus( )

Returns user's status: "online", "offline"

Returns user's status: "online", "offline"

Returns

string

See

http://www.webasyst.ru/developers/docs/basics/classes/waContact/#method-getStatus
public
# offsetExists( mixed $offset )

Implementation of

ArrayAccess::offsetExists()
public
# offsetGet( mixed $offset )

Implementation of

ArrayAccess::offsetGet()
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

http://www.webasyst.ru/developers/docs/basics/classes/waContact/#method-add
public
# setPassword( mixed $password, mixed $is_hash = false )
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

http://www.webasyst.ru/developers/docs/basics/classes/waContact/#method-getPasswordHash
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

waException

See

http://www.webasyst.ru/developers/docs/basics/classes/waContact/#method-addToCategory
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

http://www.webasyst.ru/developers/docs/basics/classes/waContact/#method-set
public
# offsetSet( mixed $offset, mixed $value )

Implementation of

ArrayAccess::offsetSet()
public
# offsetUnset( mixed $offset )

Implementation of

ArrayAccess::offsetUnset()
public string
# getTime( )

Returns

string

See

http://www.webasyst.ru/developers/docs/basics/classes/waContact/#method-getTime
Properties summary
protected mixed $id
#
public static array $cache array()
#
protected mixed $data
#
protected static array $options array( 'default' => array() )
#
protected mixed $settings null
#
My fork of Webasyst Framework API documentation generated by ApiGen 2.8.0