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

  • PasswordReset
  • PasswordResetForm
  • User
  • Overview
  • Package
  • Class
  • Tree

Class User

This is the model class for table "x2_users".

CComponent
Extended by CModel implements IteratorAggregate, ArrayAccess
Extended by CActiveRecord
Extended by User
Package: application\modules\users\models
Located at x2engine/protected/modules/users/models/User.php
Methods summary
public static User
# 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

User
the static model class

Overrides

CActiveRecord::model()
public string
# tableName( )

Returns

string
the associated database table name

Overrides

CActiveRecord::tableName()
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 boolean
# beforeValidate( )

Used to automatically set the user alias to the user name when a user is created.

Used to automatically set the user alias to the user name when a user is created.

Returns

boolean
whether validation should be executed. Defaults to true. If false is returned, the validation will stop and the model is considered invalid.

Overrides

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

Returns

array
validation rules for model attributes.

Overrides

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

Returns

array
relational rules.

Overrides

CActiveRecord::relations()
public array
# scopes( )

Returns the declaration of named scopes. A named scope represents a query criteria that can be chained together with other named scopes and applied to a query. This method should be overridden by child classes to declare named scopes for the particular AR classes. For example, the following code declares two named scopes: 'recently' and 'published'.

return array(
    'published'=>array(
          'condition'=>'status=1',
    ),
    'recently'=>array(
          'order'=>'create_time DESC',
          'limit'=>5,
    ),
);

If the above scopes are declared in a 'Post' model, we can perform the following queries:

$posts=Post::model()->published()->findAll();
$posts=Post::model()->published()->recently()->findAll();
$posts=Post::model()->published()->with('comments')->findAll();

Note that the last query is a relational query.

Returns the declaration of named scopes. A named scope represents a query criteria that can be chained together with other named scopes and applied to a query. This method should be overridden by child classes to declare named scopes for the particular AR classes. For example, the following code declares two named scopes: 'recently' and 'published'.

return array(
    'published'=>array(
          'condition'=>'status=1',
    ),
    'recently'=>array(
          'order'=>'create_time DESC',
          'limit'=>5,
    ),
);

If the above scopes are declared in a 'Post' model, we can perform the following queries:

$posts=Post::model()->published()->findAll();
$posts=Post::model()->published()->recently()->findAll();
$posts=Post::model()->published()->with('comments')->findAll();

Note that the last query is a relational query.

Returns

array
the scope definition. The array keys are scope names; the array values are the corresponding scope definitions. Each scope definition is represented as an array whose keys must be properties of CDbCriteria.

Overrides

CActiveRecord::scopes()
public boolean
# beforeDelete( )

Delete associated group to user records

Delete associated group to user records

Returns

boolean
whether the record should be deleted. Defaults to true.

Overrides

CActiveRecord::beforeDelete()
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 static
# hasRole( mixed $user, mixed $role )
public array
# getGroupIds( )

Return ids of groups to which this user belongs

Return ids of groups to which this user belongs

Returns

array
public static object
# getMe( )

Return model for current user

Return model for current user

Returns

object
public static
# getUsersDataProvider( )
public static array
# getUserOptions( )

Returns

array
(<username> => <full name>)
public static type
# getNames( )

Populates an array of choices for an assignment dropdown menu

Populates an array of choices for an assignment dropdown menu

Returns

type
public static
# getUserIds( )
public static
# getUserId( mixed $username )
public
# getName( )
public static
# getProfiles( )
public static array
# getTopContacts( )

Returns

array
public static
# getRecentItems( mixed $filter = null )
public static
# addRecentItem( string $type, integer $itemId, integer $userId = null )

Parameters

$type
string
$type recent item abbreviation (for backward compatibility) or model type
$itemId
integer
record id
$userId
integer
userId id of user that recent item should be added to
public static string
# getUserLinks( integer|array|string $users, boolean $makeLinks = true, mixed $useFullName = true )

Generate a link to a user or group.

Generate a link to a user or group.

Creates a link or list of links to a user or group to be displayed on a record.

Parameters

$users
integer|array|string
$users If array, links to a group; if integer, the group whose ID is that value; if keyword "Anyone", not a link but simply displays "anyone".
$makeLinks
boolean
$makeLinks Can be set to False to disable creating links but still return the name of the linked-to object
$useFullName

Returns

string
The rendered links
public static
# getEmails( )
public array
# attributeLabels( )

Returns the attribute labels.

Returns the attribute labels.

Returns

array
attribute labels (name=>label)

Overrides

CModel::attributeLabels()
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
# userAliasUnique( type $attribute, type $params = array() )

Validator for usernames and userAliases that enforces uniqueness across both fields.

Validator for usernames and userAliases that enforces uniqueness across both fields.

Parameters

$attribute
type
$attribute
$params
type
$params
public
# findByAlias( string $name )

Static instance method to find by username or userAlias

Static instance method to find by username or userAlias

Parameters

$name
string
$name
public
# getAlias( )

Echoes the userAlias, if set, and the username otherwise.

Echoes the userAlias, if set, and the username otherwise.

public
# getFullName( )

Returns the full name of the user.

Returns the full name of the user.

public
# getDisplayName( mixed $plural = true, mixed $ofModule = true )
public
# initCheckedCalendars( )
public
# validateUserDisable( )

Custom validation rule to ensure the primary admin account cannot be disabled

Custom validation rule to ensure the primary admin account cannot be disabled

Methods inherited from CActiveRecord
__call(), __construct(), __get(), __isset(), __set(), __sleep(), __unset(), addRelatedRecord(), afterFind(), afterFindInternal(), afterSave(), applyScopes(), attributeNames(), beforeCount(), beforeFind(), beforeFindInternal(), beforeSave(), 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(), 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(), setAttributes(), 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
integer STATUS_ACTIVE 1
#
integer STATUS_INACTIVE 0
#
Constants inherited from CActiveRecord
BELONGS_TO, HAS_MANY, HAS_ONE, MANY_MANY, STAT
Properties summary
public static array $recentItemTypes array( 'a' => 'Accounts', 'b' => 'BugReports', 'c' => 'Contacts', 'd' => 'Docs', 'g' => 'Groups', 'l' => 'X2Leads', 'm' => 'Media', 'o' => 'Opportunity', 'p' => 'Campaign', 'q' => 'Quote', 'r' => 'Product', 's' => 'Services', 't' => 'Actions', 'w' => 'Workflow', )
#
public boolean $dbPersistentGridSettings false
#

If true, grid views displaying models of this type will have their filter and
sort settings saved in the database instead of in the session

If true, grid views displaying models of this type will have their filter and sort settings saved in the database instead of in the session

Properties inherited from CActiveRecord
$db
Magic properties summary
public string $alias
#

The user's alias, if set, or username otherwise. The user's alias is the "human-friendly" username that the user can configure to be whatever they choose. The username, however, cannot be changed, as there are references to it everywhere.

The user's alias, if set, or username otherwise. The user's alias is the "human-friendly" username that the user can configure to be whatever they choose. The username, however, cannot be changed, as there are references to it everywhere.

public string $fullName
#

The full name of the user, using the format defined in the general application settings.

The full name of the user, using the format defined in the general application settings.

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