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 waContactFields

Static class to manage contact fields

Package: wa-system\Contact
Copyright: 2011 Webasyst LLC
License: LGPL
Author: Webasyst LLC
Located at wa-system/contact/waContactFields.class.php
Methods summary
public static waContactStorage
# getStorage( string $key = 'info' )

Get storage singleton by key

Get storage singleton by key

Parameters

$key
string
$key info|email|data|classname to initialize (defaults to info)

Returns

waContactStorage
public static waContactField|waContactCompositeField
# get( string $field_id, string $type = 'enabled' )

Return object of the field or null if not found

Return object of the field or null if not found

Parameters

$field_id
string
$field_id
$type
string
$type (defaults to enabled) see ::getAll() parameters for details

Returns

waContactField|waContactCompositeField
protected static array
# merge_maintaining_order( mixed $a, mixed $b )

Merge two arrays (possibly containing same keys) so that the resulting array contains key => value from each of them in order of appearance in original array. If it is not possible, then no guarantee about resulting key order is made.

Merge two arrays (possibly containing same keys) so that the resulting array contains key => value from each of them in order of appearance in original array. If it is not possible, then no guarantee about resulting key order is made.

Parameters

$a
mixed
$a
$b
mixed
$b

Returns

array
public static array
# getAll( string $contactType = 'person', boolean $all = false )

Return array of field objects by type: person: all person fields (default); contact: all company fields; person_disabled: existing custom and system fields disabled for person contacts; company_disabled: existing custom and system fields disabled for company contacts. enabled: all fields currently active either for company or for person; if a field is active for both then only a person instance returned all: all fields; first enabled for person, then enabled for company, then rest.

Return array of field objects by type: person: all person fields (default); contact: all company fields; person_disabled: existing custom and system fields disabled for person contacts; company_disabled: existing custom and system fields disabled for company contacts. enabled: all fields currently active either for company or for person; if a field is active for both then only a person instance returned all: all fields; first enabled for person, then enabled for company, then rest.

Parameters

$contactType
string
$contactType person|contact|person_disabled|company_disabled|enabled
$all
boolean
$all (defaults to false) whether to include hidden fields in the list

Returns

array
fieldId => waContactField

Throws

waException
public static array
# getInfo( string $contactType = 'person', boolean $all = false )

Parameters

$contactType
string
$contactType defaults to person; see ::getAll() parameters for details
$all
boolean
$all

Returns

array
public static
# createField( waContactField $field )

Add a new field to custom_fields.php if its id is unique (throws waException otherwise)

Add a new field to custom_fields.php if its id is unique (throws waException otherwise)

Deprecated

use ::updateField() instead

Parameters

$field
waContactField
$field

Throws

waException
public static
# deleteField( mixed $id )

Deletes the field completely.

Deletes the field completely.

Parameters

$id
mixed
$id waContactField|int field ID or field instance.

Throws

waException
public static
# updateField( waContactField $field )

Update existing field without affecting *_fields_order.php or add it to custom fields if not exists yet.

Update existing field without affecting *_fields_order.php or add it to custom fields if not exists yet.

Parameters

$field
waContactField
$field

Throws

waException
public static
# enableField( mixed $field, mixed $type, mixed $position = null )

Add an existing field to person or company order list at a given position. If field already exists for this contact type then update its data and position.

Add an existing field to person or company order list at a given position. If field already exists for this contact type then update its data and position.

Parameters

$field
mixed
$field string|waContactField Field ID
$type
mixed
$type string person|company
$position
mixed
$position int how many items to skip at the begining of list before inserting $field (default: new field is inserted at the end of the list, existing field position does not change);

Throws

waException
public static
# disableField( mixed $id, mixed $type, boolean $delete = false )

Remove given field from person or company order list.

Remove given field from person or company order list.

Parameters

$id
mixed
$type string person|company
$type
mixed
$id waContactField|int field ID or field instance.
$delete
boolean
$delete delete values from db or not

Throws

waException
public static mixed
# isSystemField( string $id )

Parameters

$id
string
$id

Returns

mixed
null, if field does not exist; false if it is custom; true if it is system.
protected static array
# getCustomParameters( waContactField $field )

Get field parameters to be saved in *_fields_order.php

Get field parameters to be saved in *_fields_order.php

Parameters

$field
waContactField
$field

Returns

array
parameter => value
protected static
# resetCustomParameters( waContactField $field )

Reset field parameters that are normally saved in *_fields_order.php to prepare $field object to be saved in *fields.php

Reset field parameters that are normally saved in *_fields_order.php to prepare $field object to be saved in *fields.php

Parameters

$field
waContactField
$field
protected static mixed
# ensureStaticVars( )

Load self::$personFields, self::$companyFields, self::$fieldStatus if not loaded yet

Load self::$personFields, self::$companyFields, self::$fieldStatus if not loaded yet

Returns

mixed

Throws

waException
Properties summary
protected static array $personFields
#

Fields for 'person' contact type id => waContactField

Fields for 'person' contact type id => waContactField

protected static array $companyFields
#

Fields for 'company' contact type id => waContactField

Fields for 'company' contact type id => waContactField

protected static array $personDisabled
#

Fields not used for person contact type (system and custom). $companyDisabled and $personDisabled share the same object instances. Don't spoil them, clone if needed. id => waContactField

Fields not used for person contact type (system and custom). $companyDisabled and $personDisabled share the same object instances. Don't spoil them, clone if needed. id => waContactField

protected static array $companyDisabled
#

Fields not used for company contact type (system and custom). $companyDisabled and $personDisabled share the same object instances. Don't spoil them, clone if needed. id => waContactField

Fields not used for company contact type (system and custom). $companyDisabled and $personDisabled share the same object instances. Don't spoil them, clone if needed. id => waContactField

protected static array $fieldStatus
#

id => boolean: true for system fields, false for custom ones

id => boolean: true for system fields, false for custom ones

public static array $customParameters array( 'allow_self_edit' => false, 'required' => false, 'unique' => false, )
#

Field parameters to store in *_fields_order.php id => default value to store in *fields.php

Field parameters to store in *_fields_order.php id => default value to store in *fields.php

protected static array $storages
#

List of storages, cache for self::getStorage() id => waContactStorage

List of storages, cache for self::getStorage() id => waContactStorage

My fork of Webasyst Framework API documentation generated by ApiGen 2.8.0