Overview

Packages

  • application
    • commands
    • components
      • actions
      • filters
      • leftWidget
      • permissions
      • sortableWidget
      • util
      • webupdater
      • x2flow
        • actions
        • triggers
      • X2GridView
      • X2Settings
    • controllers
    • models
      • embedded
    • modules
      • accounts
        • controllers
        • models
      • actions
        • controllers
        • models
      • calendar
        • controllers
        • models
      • charts
        • models
      • contacts
        • controllers
        • models
      • docs
        • components
        • controllers
        • models
      • groups
        • controllers
        • models
      • marketing
        • components
        • controllers
        • models
      • media
        • controllers
        • models
      • mobile
        • components
      • opportunities
        • controllers
        • models
      • products
        • controllers
        • models
      • quotes
        • controllers
        • models
      • services
        • controllers
        • models
      • template
        • models
      • users
        • controllers
        • models
      • workflow
        • controllers
        • models
      • x2Leads
        • controllers
        • models
  • None
  • system
    • base
    • caching
    • console
    • db
      • ar
      • schema
    • validators
    • web
      • actions
      • auth
      • helpers
      • widgets
        • captcha
        • pagers
  • zii
    • widgets
      • grid

Classes

  • ActionMetaData
  • ActionText
  • Admin
  • AmorphousModel
  • ApiHook
  • APIModel
  • ChartSetting
  • ContactForm
  • ContactList
  • Credentials
  • Criteria
  • Dropdowns
  • Events
  • EventsData
  • Fields
  • FormLayout
  • Imports
  • InlineEmail
  • LeadRouting
  • Locations
  • LoginForm
  • Maps
  • Modules
  • Notes
  • Notification
  • PhoneNumber
  • Profile
  • Record
  • Relationships
  • Roles
  • RoleToPermission
  • RoleToUser
  • RoleToWorkflow
  • Rules
  • Session
  • SessionLog
  • Social
  • Tags
  • TempFile
  • Tips
  • Tours
  • TrackEmail
  • TriggerLog
  • URL
  • ViewLog
  • Widgets
  • X2List
  • X2ListCriterion
  • X2ListItem
  • X2Model
  • Overview
  • Package
  • Class
  • Tree

Class Fields

This is the model class for table "x2_fields".

CComponent
Extended by CModel implements IteratorAggregate, ArrayAccess
Extended by CActiveRecord
Extended by Fields
Package: application\models
Author: Jake Houser <jake@x2engine.com>, Demitri Morgan <demitri@x2engine.com>
Located at x2engine/protected/models/Fields.php
Methods summary
public
# __construct( string $scenario = 'insert' )

Constructor override.

Constructor override.

Parameters

$scenario
string
$scenario scenario name. See CModel::scenario for more details about this parameter. Note: in order to setup initial model parameters use CActiveRecord::init() or CModel::afterConstruct(). Do NOT override the constructor unless it is absolutely necessary!

Overrides

CActiveRecord::__construct()
public array
# behaviors( )

Returns a list of behaviors that this model should behave as. The return value should be an array of behavior configurations indexed by behavior names. Each behavior configuration can be either a string specifying the behavior class or an array of the following structure:

'behaviorName'=>array(
    'class'=>'path.to.BehaviorClass',
    'property1'=>'value1',
    'property2'=>'value2',
)

Returns a list of behaviors that this model should behave as. The return value should be an array of behavior configurations indexed by behavior names. Each behavior configuration can be either a string specifying the behavior class or an array of the following structure:

'behaviorName'=>array(
    'class'=>'path.to.BehaviorClass',
    'property1'=>'value1',
    'property2'=>'value2',
)

Note, the behavior classes must implement IBehavior or extend from CBehavior. Behaviors declared in this method will be attached to the model when it is instantiated.

For more details about behaviors, see CComponent.

Returns

array
the behavior configurations (behavior name=>behavior configuration)

Overrides

CModel::behaviors()
public
# getDropdownValue( mixed $fieldValue )
public
# getDropdownOptions( )
public
# setAttributes( array $values, boolean $safeOnly = true )

Sets the attribute values in a massive way.

Sets the attribute values in a massive way.

Parameters

$values
array
$values attribute values (name=>value) to be set.
$safeOnly
boolean
$safeOnly whether the assignments should only be done to the safe attributes. A safe attribute is one that is associated with a validation rule in the current scenario.

See

CModel::getSafeAttributeNames()
CActiveRecord::attributeNames()

Overrides

CModel::setAttributes()
public array
# rules( )

Rules for saving a field.

Rules for saving a field.

See the following MySQL documentation pages for more info on length restrictions and naming requirements: http://dev.mysql.com/doc/refman/5.0/en/identifiers.html

Returns

array
validation rules for model attributes.

Overrides

CModel::rules()
public integer
# countNonNull( )

Counts the number of records such that the field is not null.

Counts the number of records such that the field is not null.

Returns

integer
public static
# getLinkTypes( )
public static array
# getDisplayedModelNamesList( )

Legacy function kept for backwards compatibility.

Legacy function kept for backwards compatibility.

Moved from Admin and renamed from getModelList because it doesn't make sense to put it there; it doesn't fit in a model intended for managing system settings, but it does in this model, which is intended for managing data models themselves.

Returns

array
public static array
# getFieldTypes( mixed $scenario = null )

Function to return data about the field types used by X2.

Function to return data about the field types used by X2.

This function should be called whenever information about an x2_field type is needed, as it can store all of that information in one consolidated location and has a variety of uses. If no scenario is provided, it will turn the array exactly as defined in $fieldTypes at the top of the function. If a scenario is provided, it will attempt to fill only the information for that scenario. So calling the function with "validator" will just return an array of "type" => "validator" while calling it with an array of scenarios (e.g. $scenario = array("title","validator")) will return an array containing just that data, like: "type" => array("title", "validator").

Parameters

$scenario
mixed
$scenario A string or array of the data scenario required

Returns

array
An array of information about the field types.
public static mixed
# getLinkId( string $type, string $name )

Finds a contact matching a full name; returns Contacts::name if a match was found, null otherwise.

Finds a contact matching a full name; returns Contacts::name if a match was found, null otherwise.

Parameters

$type
string
$type
$name
string
$name

Returns

mixed
public static CHtmlPurifier
# getPurifier( )

Constructs (if not constructed already) and returns a CHtmlPurifier instance

Constructs (if not constructed already) and returns a CHtmlPurifier instance

Returns

CHtmlPurifier
public static Fields
# model( string $className = __CLASS__ )

Returns the static model of the specified AR class.

Returns the static model of the specified AR class.

Parameters

$className
string
$className active record class name.

Returns

Fields
the static model class

Overrides

CActiveRecord::model()
public static
# nameAndId( string $nameId )

The inverse operation of Fields::nameId(), this splits a uniquely

  • identifying "nameId" field into name and ID.

The inverse operation of Fields::nameId(), this splits a uniquely

  • identifying "nameId" field into name and ID.

This function should always return an array with two elements, the first being the name and the second being the ID.

Parameters

$nameId
string
$nameId The nameId reference.
public static
# id( mixed $nameId )
public static
# nameId( mixed $name, mixed $id )

Generates a combination name and id field to uniquely identify the record.

Generates a combination name and id field to uniquely identify the record.

public static string
# parseUsers( mixed $arr )

Implodes an array of usernames for multiple assignment fields. This method, if still used anyhwere, could be refactored to use JSON

Implodes an array of usernames for multiple assignment fields. This method, if still used anyhwere, could be refactored to use JSON

Parameters

$arr
mixed
$arr Array or string of usernames

Returns

string
A properly formatted assignment string
public static string
# parseUsersTwo( array $arr )

Similar to Fields::parseUsers() but is used in the case where it's an associative array of username => full name and the array keys need to be used to generate our assignment string

Similar to Fields::parseUsers() but is used in the case where it's an associative array of username => full name and the array keys need to be used to generate our assignment string

Parameters

$arr
array
$arr An array of format username => full name

Returns

string
A properly formatted assignment string
public static
# searchRelevance( )
public static
# strToNumeric( string $input, string $type = 'float', string $curSym = null )

Converts a string into a numeric value.

Converts a string into a numeric value.

Parameters

$input
string
$input The string to convert
$type
string
$type A hint as to the type of input; one of 'int', 'float', 'currency' or 'percentage'
$curSym
string
$currencySymbol Optional currency symbol to trim off the string before conversion
public boolean
# beforeSave( )

Table modification is performed before field update since field should not be saved if column data type cannot be updated TODO: place column modification in a transaction with field update

Table modification is performed before field update since field should not be saved if column data type cannot be updated TODO: place column modification in a transaction with field update

Returns

boolean
whether the saving should be executed. Defaults to true.

Overrides

CActiveRecord::beforeSave()
public type
# afterSave( )

Perform the creation of a new database column.

Perform the creation of a new database column.

The extra work in this method is skipped over in the "newModule" scenario because the database schema altering commands to set up columns are performed separately in that case.

Returns

type

Overrides

CActiveRecord::afterSave()
public
# afterDelete( )

This method is invoked after deleting a record. The default implementation raises the CActiveRecord::onAfterDelete() event. You may override this method to do postprocessing after the record is deleted. Make sure you call the parent implementation so that the event is raised properly.

This method is invoked after deleting a record. The default implementation raises the CActiveRecord::onAfterDelete() event. You may override this method to do postprocessing after the record is deleted. Make sure you call the parent implementation so that the event is raised properly.

Overrides

CActiveRecord::afterDelete()
public array
# attributeLabels( )

Returns

array
customized attribute labels (name=>label)

Overrides

CModel::attributeLabels()
public boolean
# beforeValidate( )

Adjust the field name accordingly

Adjust the field name accordingly

Under certain circumstances, the field name will be given a prefix "c_" to avoid name collisions with new default fields added in updates.

Returns

boolean

Overrides

CModel::beforeValidate()
public
# createColumn( )

Creates a column for the new field model.

Creates a column for the new field model.

public
# modifyColumn( )

Modifies the data type of an existing column

Modifies the data type of an existing column

public
# createIndex( mixed $unique = false )

Creates an index on the column associated with the current field record.

Creates an index on the column associated with the current field record.

public
# dropColumn( )

Deletes the table column associated with the field record.

Deletes the table column associated with the field record.

public
# dropIndex( )

Drops the index on the column associated with the current field record.

Drops the index on the column associated with the current field record.

public type
# getMyTableName( )

Obtains the value for Fields::tableName()

Obtains the value for Fields::tableName()

Returns

type
public
# nonReserved( mixed $attribute, mixed $params = array() )

Validator for ensuring an identifier does not include MySQL reserved words or X2Engine reserved words

Validator for ensuring an identifier does not include MySQL reserved words or X2Engine reserved words

public mixed
# parseValue( mixed $value, boolean $filter = false )

Parses a value for table insertion using X2Fields rules

Parses a value for table insertion using X2Fields rules

Parameters

$value
mixed
$value
$filter
boolean
$filter If true, replace HTML special characters (prevents markup injection)

Returns

mixed
the parsed value
public array
# relations( )

Returns

array
relational rules.

Overrides

CActiveRecord::relations()
public CActiveDataProvider
# search( )

Retrieves a list of models based on the current search/filter conditions.

Retrieves a list of models based on the current search/filter conditions.

Returns

CActiveDataProvider
the data provider that can return the models based on the search/filter conditions.
public string
# tableName( )

Returns

string
the associated database table name

Overrides

CActiveRecord::tableName()
public
# requiredUnique( mixed $attribute, mixed $params = array() )

Validator that prevents adding a unique constraint to a field without also making it required.

Validator that prevents adding a unique constraint to a field without also making it required.

public
# uniqueFieldName( type $attribute, type $params = array() )

Check that the combination of model and field name will not conflict with any existing one.

Check that the combination of model and field name will not conflict with any existing one.

Parameters

$attribute
type
$attribute
$params
type
$params
public
# validDefault( string $attribute, array $params = array() )

Check that the default value is appropriate given the type of the field.

Check that the default value is appropriate given the type of the field.

Parameters

$attribute
string
$attribute
$params
array
$params
public
# validCustom( string $attribute, array $params = array() )

Alter/purify the input for the custom data field.

Alter/purify the input for the custom data field.

Parameters

$attribute
string
$attribute
$params
array
$params
public
# getDropdown( )
public static
# getFieldsOfModelsWithFieldLevelPermissions( )
Methods inherited from CActiveRecord
__call(), __get(), __isset(), __set(), __sleep(), __unset(), addRelatedRecord(), afterFind(), afterFindInternal(), applyScopes(), attributeNames(), beforeCount(), beforeDelete(), beforeFind(), beforeFindInternal(), cache(), count(), countByAttributes(), countBySql(), defaultScope(), delete(), deleteAll(), deleteAllByAttributes(), deleteByPk(), equals(), exists(), find(), findAll(), findAllByAttributes(), findAllByPk(), findAllBySql(), findByAttributes(), findByPk(), findBySql(), getActiveFinder(), getActiveRelation(), getAttribute(), getAttributeLabel(), getAttributes(), getCommandBuilder(), getDbConnection(), getDbCriteria(), getIsNewRecord(), getMetaData(), getOldPrimaryKey(), getPrimaryKey(), getRelated(), getTableAlias(), getTableSchema(), hasAttribute(), hasRelated(), init(), insert(), instantiate(), offsetExists(), onAfterDelete(), onAfterFind(), onAfterSave(), onBeforeCount(), onBeforeDelete(), onBeforeFind(), onBeforeSave(), populateRecord(), populateRecords(), primaryKey(), query(), refresh(), refreshMetaData(), resetScope(), save(), saveAttributes(), saveCounters(), scopes(), setAttribute(), setDbCriteria(), setIsNewRecord(), setOldPrimaryKey(), setPrimaryKey(), setTableAlias(), together(), update(), updateAll(), updateByPk(), updateCounters(), with()
Methods inherited from CModel
addError(), addErrors(), afterConstruct(), afterValidate(), clearErrors(), createValidators(), generateAttributeLabel(), getError(), getErrors(), getIterator(), getSafeAttributeNames(), getScenario(), getValidatorList(), getValidators(), hasErrors(), isAttributeRequired(), isAttributeSafe(), offsetGet(), offsetSet(), offsetUnset(), onAfterConstruct(), onAfterValidate(), onBeforeValidate(), onUnsafeAttribute(), setScenario(), unsetAttributes(), validate()
Methods inherited from CComponent
asa(), attachBehavior(), attachBehaviors(), attachEventHandler(), canGetProperty(), canSetProperty(), detachBehavior(), detachBehaviors(), detachEventHandler(), disableBehavior(), disableBehaviors(), enableBehavior(), enableBehaviors(), evaluateExpression(), getEventHandlers(), hasEvent(), hasEventHandler(), hasProperty(), raiseEvent()
Constants summary
string NAMEID_DELIM '_'
#

Defines the separator between name & ID in uniquely identifying "nameId" fields

Defines the separator between name & ID in uniquely identifying "nameId" fields

string MULTI_ASSIGNMENT_DELIM ', '
#
integer RATING_MIN 1
#
integer RATING_MAX 5
#
integer WRITE_PERMISSION 2
#
integer READ_PERMISSION 1
#
integer NO_PERMISSION 0
#
Constants inherited from CActiveRecord
BELONGS_TO, HAS_MANY, HAS_ONE, MANY_MANY, STAT
Properties summary
public boolean $includeEmpty true
#
public static type $phpTypes array( 'assignment' => 'string', 'boolean' => 'boolean', 'credentials' => 'integer', 'currency' => 'double', 'date' => 'integer', 'dateTime' => 'integer', 'dropdown' => 'string', 'email' => 'string', 'int' => 'integer', 'link' => 'string', 'optionalAssignment' => 'string', 'percentage' => 'double', 'rating' => 'integer', 'varchar' => 'string', )
#

PHP types corresponding to field types in X2Engine.

PHP types corresponding to field types in X2Engine.

This is to supplement Yii's active record functionality, which does not typecast column values according to their canonical type.

Properties inherited from CActiveRecord
$db
Magic properties summary
public integer $id
#
public string $modelName
#
public string $fieldName
#
public string $attributeLabel
#
public integer $show
#
public integer $custom
#
public string $myTableName
#

The name of the table to which the field corresponds

The name of the table to which the field corresponds

Magic properties inherited from CActiveRecord
$attributes, $commandBuilder, $dbConnection, $dbCriteria, $isNewRecord, $metaData, $oldPrimaryKey, $primaryKey, $tableAlias, $tableSchema
Magic properties inherited from CModel
$errors, $iterator, $safeAttributeNames, $scenario, $validatorList, $validators
X2CRM Documentation API documentation generated by ApiGen 2.8.0