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 Events

This is the model class for table "x2_events".

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

Imports
the static model class

Overrides

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

Returns

string
the associated database table name

Overrides

CActiveRecord::tableName()
public array
# attributeNames( )

Returns the list of all attribute names of the model. This would return all column names of the table associated with this AR class.

Returns the list of all attribute names of the model. This would return all column names of the table associated with this AR class.

Returns

array
list of attribute names.

Overrides

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

This method should be overridden to declare related objects.

This method should be overridden to declare related objects.

There are four types of relations that may exist between two active record objects:
  • BELONGS_TO: e.g. a member belongs to a team;
  • HAS_ONE: e.g. a member has at most one profile;
  • HAS_MANY: e.g. a team has many members;
  • MANY_MANY: e.g. a member has many skills and a skill belongs to a member.

Besides the above relation types, a special relation called STAT is also supported that can be used to perform statistical query (or aggregational query). It retrieves the aggregational information about the related objects, such as the number of comments for each post, the average rating for each product, etc.

Each kind of related objects is defined in this method as an array with the following elements:

'varName'=>array('relationType', 'className', 'foreignKey', ...additional options)

where 'varName' refers to the name of the variable/property that the related object(s) can be accessed through; 'relationType' refers to the type of the relation, which can be one of the following four constants: self::BELONGS_TO, self::HAS_ONE, self::HAS_MANY and self::MANY_MANY; 'className' refers to the name of the active record class that the related object(s) is of; and 'foreignKey' states the foreign key that relates the two kinds of active record. Note, for composite foreign keys, they can be either listed together, separated by commas or specified as an array in format of array('key1','key2'). In case you need to specify custom PK->FK association you can define it as array('fk'=>'pk'). For composite keys it will be array('fk_c1'=>'pk_с1','fk_c2'=>'pk_c2'). For foreign keys used in MANY_MANY relation, the joining table must be declared as well (e.g. 'join_table(fk1, fk2)').

Additional options may be specified as name-value pairs in the rest array elements:
  • 'select': string|array, a list of columns to be selected. Defaults to '*', meaning all columns. Column names should be disambiguated if they appear in an expression (e.g. COUNT(relationName.name) AS name_count).
  • 'condition': string, the WHERE clause. Defaults to empty. Note, column references need to be disambiguated with prefix 'relationName.' (e.g. relationName.age>20)
  • 'order': string, the ORDER BY clause. Defaults to empty. Note, column references need to be disambiguated with prefix 'relationName.' (e.g. relationName.age DESC)
  • 'with': string|array, a list of child related objects that should be loaded together with this object. Note, this is only honored by lazy loading, not eager loading.
  • 'joinType': type of join. Defaults to 'LEFT OUTER JOIN'.
  • 'alias': the alias for the table associated with this relationship. It defaults to null, meaning the table alias is the same as the relation name.
  • 'params': the parameters to be bound to the generated SQL statement. This should be given as an array of name-value pairs.
  • 'on': the ON clause. The condition specified here will be appended to the joining condition using the AND operator.
  • 'index': the name of the column whose values should be used as keys of the array that stores related objects. This option is only available to HAS_MANY and MANY_MANY relations.
  • 'scopes': scopes to apply. In case of a single scope can be used like 'scopes'=>'scopeName', in case of multiple scopes can be used like 'scopes'=>array('scopeName1','scopeName2'). This option has been available since version 1.1.9.
The following options are available for certain relations when lazy loading:
  • 'group': string, the GROUP BY clause. Defaults to empty. Note, column references need to be disambiguated with prefix 'relationName.' (e.g. relationName.age). This option only applies to HAS_MANY and MANY_MANY relations.
  • 'having': string, the HAVING clause. Defaults to empty. Note, column references need to be disambiguated with prefix 'relationName.' (e.g. relationName.age). This option only applies to HAS_MANY and MANY_MANY relations.
  • 'limit': limit of the rows to be selected. This option does not apply to BELONGS_TO relation.
  • 'offset': offset of the rows to be selected. This option does not apply to BELONGS_TO relation.
  • 'through': name of the model's relation that will be used as a bridge when getting related data. Can be set only for HAS_ONE and HAS_MANY. This option has been available since version 1.1.7.

Below is an example declaring related objects for 'Post' active record class:

return array(
    'author'=>array(self::BELONGS_TO, 'User', 'author_id'),
    'comments'=>array(self::HAS_MANY, 'Comment', 'post_id', 'with'=>'author', 'order'=>'create_time DESC'),
    'tags'=>array(self::MANY_MANY, 'Tag', 'post_tag(post_id, tag_id)', 'order'=>'name'),
);

Returns

array
list of related object declarations. Defaults to empty array.

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 array
# rules( )

Returns

array
validation rules for model attributes.

Overrides

X2ActiveRecord::rules()
public boolean
# save( boolean $runValidation = true, array $attributes = null )

Saves the current record.

Saves the current record.

The record is inserted as a row into the database table if its isNewRecord property is true (usually the case when the record is created using the 'new' operator). Otherwise, it will be used to update the corresponding row in the table (usually the case if the record is obtained using one of those 'find' methods.)

Validation will be performed before saving the record. If the validation fails, the record will not be saved. You can call CModel::getErrors() to retrieve the validation errors.

If the record is saved via insertion, its isNewRecord property will be set false, and its scenario property will be set to be 'update'. And if its primary key is auto-incremental and is not set before insertion, the primary key will be populated with the automatically generated key value.

Parameters

$runValidation
boolean
$runValidation whether to perform validation before saving the record. If the validation fails, the record will not be saved to database.
$attributes
array
$attributes list of attributes that need to be saved. Defaults to null, meaning all attributes that are loaded from DB will be saved.

Returns

boolean
whether the saving succeeds

Overrides

CActiveRecord::save()
public
# renderFrameLink( mixed $htmlOptions )
public
# getRecipient( )
public static string
# parseModelName( string $model )

Parse an associationType field and resolve the model name

Parse an associationType field and resolve the model name

Parameters

$model
string
$model Model type to resolve

Returns

string
Model's name
public
# getText( array $params = array(), array $htmlOptions = array() )
public static
# parseType( mixed $type )
public static
# deleteOldEvents( )

Delete expired events (expiration defined by "Event Deletion Time" admin setting

Delete expired events (expiration defined by "Event Deletion Time" admin setting

public boolean
# isVisibleTo( User $user )

Parameters

$user
User
$user

Returns

boolean
true if event is visible to user, false otherwiser
public CDbCriteria
# getAccessCriteria( Profile $profile = null )

Parameters

$profile
Profile
$profile Profile to filter events by. Used for profile feeds other than the current user's

Returns

CDbCriteria
Events access criteria based on history privacy admin setting
public
# checkPermissions( mixed $action = null, mixed $refresh = false )
public static array
# getFilteredEventsDataProvider( Profile $profile, boolean $privateProfile, array $filters, boolean $filtersOn )

Returns events filtered with feed filters. Saves filters in session.

Returns events filtered with feed filters. Saves filters in session.

Parameters

$profile
Profile
$profile
$privateProfile
boolean
$privateProfile whether to display public or private profile
$filters
array
$filters
$filtersOn
boolean
$filtersOn

Returns

array
'dataProvider' => <object> 'lastUpdated' => <integer> 'lastId' => <integer>
public static
# getEvents( integer $lastEventId, string $lastTimestamp, object $limit = null, object $profile = null, mixed $privateProfile = true )

TODO: merge this method with getFilteredEventsDataProvider, and remove reliance on SESSION,
regenerating condition on each request instead of storing it

TODO: merge this method with getFilteredEventsDataProvider, and remove reliance on SESSION, regenerating condition on each request instead of storing it

Parameters

$lastEventId
integer
$lastEventId
$lastTimestamp
string
$lastTimestamp
$limit
object
$profile The current user's profile model
$profile
object
$profileId The profile model for which events are being requested.
$privateProfile
public static
# generateFeedEmail( mixed $filters, mixed $userId, mixed $range, mixed $limit, mixed $eventId, mixed $deleteKey )
public
# isTypeFeed( )
protected boolean
# beforeSave( )

This method is invoked before saving a record (after validation, if any). The default implementation raises the CActiveRecord::onBeforeSave() event. You may override this method to do any preparation work for record saving. Use isNewRecord to determine whether the saving is for inserting or updating record. Make sure you call the parent implementation so that the event is raised properly.

This method is invoked before saving a record (after validation, if any). The default implementation raises the CActiveRecord::onBeforeSave() event. You may override this method to do any preparation work for record saving. Use isNewRecord to determine whether the saving is for inserting or updating record. Make sure you call the parent implementation so that the event is raised properly.

Returns

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

Overrides

CActiveRecord::beforeSave()
protected boolean
# beforeDelete( )

This method is invoked before deleting a record. The default implementation raises the CActiveRecord::onBeforeDelete() event. You may override this method to do any preparation work for record deletion. Make sure you call the parent implementation so that the event is raised properly.

This method is invoked before deleting a record. The default implementation raises the CActiveRecord::onBeforeDelete() event. You may override this method to do any preparation work for record deletion. Make sure you call the parent implementation so that the event is raised properly.

Returns

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

Overrides

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

Returns

array
customized attribute labels (name=>label)

Overrides

CModel::attributeLabels()
Methods inherited from X2ActiveRecord
getAllErrorMessages(), getBehaviorRules(), getFormatter(), getInputRenderer(), getName(), renderAttribute(), setFormatter(), setInputRenderer()
Methods inherited from CActiveRecord
__call(), __construct(), __get(), __isset(), __set(), __sleep(), __unset(), addRelatedRecord(), afterDelete(), afterFind(), afterFindInternal(), afterSave(), applyScopes(), beforeCount(), 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(), saveAttributes(), saveCounters(), setAttribute(), setDbCriteria(), setIsNewRecord(), setOldPrimaryKey(), setPrimaryKey(), setTableAlias(), together(), update(), updateAll(), updateByPk(), updateCounters(), with()
Methods inherited from CModel
addError(), addErrors(), afterConstruct(), afterValidate(), beforeValidate(), behaviors(), 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 inherited from CActiveRecord
BELONGS_TO, HAS_MANY, HAS_ONE, MANY_MANY, STAT
Properties summary
public mixed $photo
#
public static array $eventLabels array( 'feed' => 'Social Posts', 'comment' => 'Comment', 'record_create' => 'Records Created', 'record_deleted' => 'Records Deleted', 'action_reminder' => 'Action Reminders', 'action_complete' => 'Actions Completed', 'calendar_event' => 'Calendar Events', 'case_escalated' => 'Cases Escalated', 'email_opened' => 'Emails Opened', 'email_sent' => 'Emails Sent', 'notif' => 'Notifications', 'weblead_create' => 'Webleads Created', 'web_activity' => 'Web Activity', 'workflow_complete' => 'Process Complete', 'workflow_revert' => 'Process Reverted', 'workflow_start' => 'Process Started', 'doc_update' => 'Doc Updates', 'email_from' => 'Email Received', 'media' => 'Media', 'voip_call' => 'VOIP Call', 'topic_reply' => 'Topic Replies', )
#
Properties inherited from X2ActiveRecord
$fieldFormatterClass, $fieldInputRendererClass
Properties inherited from CActiveRecord
$db
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