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

  • ActionFormModelBase
  • CalendarEventFormModel
  • CallFormModel
  • CreatePageFormModel
  • EditMobileFormsFormModel
  • EventCommentPublisherFormModel
  • EventFormModel
  • EventPublisherFormModel
  • FileSystemObjectDataProvider
  • MassActionFormModel
  • MobilePagination
  • NoteFormModel
  • NotificationsController
  • TimeFormModel
  • UploadLogoFormModel
  • X2FormModel
  • X2HttpRequest
  • Overview
  • Package
  • Class
  • Tree

Class ActionFormModelBase

CFormModel represents a data model that collects HTML form inputs.

Unlike CActiveRecord, the data collected by CFormModel are stored in memory only, instead of database.

To collect user inputs, you may extend CFormModel and define the attributes whose values are to be collected from user inputs. You may override ActionFormModelBase::rules() to declare validation rules that should be applied to the attributes.

CComponent
Extended by CModel implements IteratorAggregate, ArrayAccess
Extended by CFormModel
Extended by X2FormModel
Extended by ActionFormModelBase

Direct known subclasses

ActionFormModel, CallFormModel, EventFormModel, NoteFormModel, TimeFormModel

Indirect known subclasses

CalendarEventFormModel
Abstract
Package: system\web
Author: Qiang Xue <qiang.xue@gmail.com>
Since: 1.0
Located at x2engine/protected/modules/actions/models/ActionFormModelBase.php
Methods summary
public array
# rules( )

Returns the validation rules for attributes.

Returns the validation rules for attributes.

This method should be overridden to declare validation rules. Each rule is an array with the following structure:

array('attribute list', 'validator name', 'on'=>'scenario name', ...validation parameters...)
where
  • attribute list: specifies the attributes (separated by commas) to be validated;
  • validator name: specifies the validator to be used. It can be the name of a model class method, the name of a built-in validator, or a validator class (or its path alias). A validation method must have the following signature:
    // $params refers to validation parameters given in the rule
    function validatorName($attribute,$params)
    
    A built-in validator refers to one of the validators declared in CValidator::builtInValidators. And a validator class is a class extending CValidator.
  • on: this specifies the scenarios when the validation rule should be performed. Separate different scenarios with commas. If this option is not set, the rule will be applied in any scenario that is not listed in "except". Please see scenario for more details about this option.
  • except: this specifies the scenarios when the validation rule should not be performed. Separate different scenarios with commas. Please see scenario for more details about this option.
  • additional parameters are used to initialize the corresponding validator properties. Please refer to individual validator class API for possible properties.

The following are some examples:

array(
    array('username', 'required'),
    array('username', 'length', 'min'=>3, 'max'=>12),
    array('password', 'compare', 'compareAttribute'=>'password2', 'on'=>'register'),
    array('password', 'authenticate', 'on'=>'login'),
);

Note, in order to inherit rules defined in the parent class, a child class needs to merge the parent rules with child rules using functions like array_merge().

Returns

array
validation rules to be applied when ActionFormModelBase::validate() is called.

See

scenario

Overrides

CModel::rules()
public
# validateAssignedTo( mixed $attribute )

Set dynamic default date values

Set dynamic default date values

public
# validateDate( mixed $attribute )

Set dynamic default date values

Set dynamic default date values

public
# validateCompleteDate( mixed $attribute )

Check for negative time ranges

Check for negative time ranges

public
# validateAssociationId( mixed $attribute )

if association name is sent without id, try to lookup the record by name and type

if association name is sent without id, try to lookup the record by name and type

public
# validateAssociationName( mixed $attribute )

Synchronize association name with association type and id

Synchronize association name with association type and id

public array
# attributeLabels( )

Returns the attribute labels. Attribute labels are mainly used in error messages of validation. By default an attribute label is generated using CModel::generateAttributeLabel(). This method allows you to explicitly specify attribute labels.

Returns the attribute labels. Attribute labels are mainly used in error messages of validation. By default an attribute label is generated using CModel::generateAttributeLabel(). This method allows you to explicitly specify attribute labels.

Note, in order to inherit labels defined in the parent class, a child class needs to merge the parent labels with child labels using functions like array_merge().

Returns

array
attribute labels (name=>label)

See

CModel::generateAttributeLabel()

Overrides

CModel::attributeLabels()
public
# getAction( mixed $new = false )
public boolean
# validate( array $attributes = null, boolean $clearErrors = true )

Performs the validation.

Performs the validation.

This method executes the validation rules as declared in ActionFormModelBase::rules(). Only the rules applicable to the current scenario will be executed. A rule is considered applicable to a scenario if its 'on' option is not set or contains the scenario.

Errors found during the validation can be retrieved via CModel::getErrors().

Parameters

$attributes
array
$attributes list of attributes that should be validated. Defaults to null, meaning any attribute listed in the applicable validation rules should be validated. If this parameter is given as a list of attributes, only the listed attributes will be validated.
$clearErrors
boolean
$clearErrors whether to call CModel::clearErrors() before performing validation

Returns

boolean
whether the validation is successful without any error.

See

CModel::beforeValidate()
CModel::afterValidate()

Overrides

X2FormModel::validate()
public
# mergeErrors( Actions $model )
Methods inherited from X2FormModel
getAllErrorMessages()
Methods inherited from CFormModel
__construct(), attributeNames(), init()
Methods inherited from CModel
addError(), addErrors(), afterConstruct(), afterValidate(), beforeValidate(), behaviors(), clearErrors(), createValidators(), generateAttributeLabel(), getAttributeLabel(), getAttributes(), getError(), getErrors(), getIterator(), getSafeAttributeNames(), getScenario(), getValidatorList(), getValidators(), hasErrors(), isAttributeRequired(), isAttributeSafe(), offsetExists(), offsetGet(), offsetSet(), offsetUnset(), onAfterConstruct(), onAfterValidate(), onBeforeValidate(), onUnsafeAttribute(), setAttributes(), setScenario(), unsetAttributes()
Methods inherited from CComponent
__call(), __get(), __isset(), __set(), __unset(), asa(), attachBehavior(), attachBehaviors(), attachEventHandler(), canGetProperty(), canSetProperty(), detachBehavior(), detachBehaviors(), detachEventHandler(), disableBehavior(), disableBehaviors(), enableBehavior(), enableBehaviors(), evaluateExpression(), getEventHandlers(), hasEvent(), hasEventHandler(), hasProperty(), raiseEvent()
Properties summary
public mixed $associationType
#
public mixed $associationId
#
public mixed $associationName
#
public mixed $assignedTo
#
public mixed $dueDate
#
public mixed $completeDate
#
public mixed $timerIds
#
public boolean $skipActionTimers true
#
Properties inherited from X2FormModel
$exceptionClass, $throwExceptions
Magic properties inherited from CModel
$attributes, $errors, $iterator, $safeAttributeNames, $scenario, $validatorList, $validators
X2CRM Documentation API documentation generated by ApiGen 2.8.0