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

  • AdminController
  • Api2Controller
  • ApiController
  • BugReportsController
  • CommonSiteControllerBehavior
  • ProfileController
  • RelationshipsController
  • SearchController
  • SiteController
  • StudioController
  • TemplatesController
  • TopicsController
  • x2base
  • X2Controller
  • Overview
  • Package
  • Class
  • Tree

Class x2base

Base controller for all application controllers with CRUD operations

CComponent
Extended by CBaseController
Extended by CController
Extended by X2Controller
Extended by x2base

Direct known subclasses

AccountsController, ActionsController, OpportunitiesController, ProductsController, ProfileController, QuotesController, RelationshipsController, SearchController, ServicesController, SiteController, StudioController, TemplatesController, ApiController, TopicsController, UsersController, WorkflowController, X2LeadsController, BugReportsController, CalendarController, ContactsController, DocsController, GroupsController, MarketingController, MediaController
Abstract
Package: application\controllers
Located at x2engine/protected/controllers/x2base.php
Methods summary
public array
# filters( )

Returns

array
action filters

Overrides

CController::filters()
public array
# behaviors( )

Returns a list of behaviors that this controller 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 controller 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 controller when it is instantiated.

For more details about behaviors, see CComponent.

Returns

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

Overrides

CController::behaviors()
protected boolean
# beforeAction( CAction $action = null )

This method is invoked right before an action is to be executed (after all possible filters.) You may override this method to do last-minute preparation for the action.

This method is invoked right before an action is to be executed (after all possible filters.) You may override this method to do last-minute preparation for the action.

Parameters

$action
CAction
$action the action to be executed.

Returns

boolean
whether the action should be executed.

Overrides

X2Controller::beforeAction()
public
# appLockout( )
public
# denied( )
public
# ajaxResponse( string $status, string $message = null )

Parameters

$status
string
$status 'success'|'failure'|'error'|'warning'
$message
string
$message
public
# getModuleObj( )
public array
# actions( )

Returns a list of external action classes. Array keys are action IDs, and array values are the corresponding action class in dot syntax (e.g. 'edit'=>'application.controllers.article.EditArticle') or arrays representing the configuration of the actions, such as the following,

return array(
    'action1'=>'path.to.Action1Class',
    'action2'=>array(
        'class'=>'path.to.Action2Class',
        'property1'=>'value1',
        'property2'=>'value2',
    ),
);

Derived classes may override this method to declare external actions.

Returns a list of external action classes. Array keys are action IDs, and array values are the corresponding action class in dot syntax (e.g. 'edit'=>'application.controllers.article.EditArticle') or arrays representing the configuration of the actions, such as the following,

return array(
    'action1'=>'path.to.Action1Class',
    'action2'=>array(
        'class'=>'path.to.Action2Class',
        'property1'=>'value1',
        'property2'=>'value2',
    ),
);

Derived classes may override this method to declare external actions.

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

You may import actions from an action provider (such as a widget, see CWidget::actions), like the following:

return array(
    ...other actions...
    // import actions declared in ProviderClass::actions()
    // the action IDs will be prefixed with 'pro.'
    'pro.'=>'path.to.ProviderClass',
    // similar as above except that the imported actions are
    // configured with the specified initial property values
    'pro2.'=>array(
        'class'=>'path.to.ProviderClass',
        'action1'=>array(
            'property1'=>'value1',
        ),
        'action2'=>array(
            'property2'=>'value2',
        ),
    ),
)

In the above, we differentiate action providers from other action declarations by the array keys. For action providers, the array keys must contain a dot. As a result, an action ID 'pro2.action1' will be resolved as the 'action1' action declared in the 'ProviderClass'.

Returns

array
list of external action classes

See

CController::createAction()

Overrides

X2Controller::actions()
public
# getDetailView( object $model )

Returns rendered detail view for given model

Returns rendered detail view for given model

Parameters

$model
object
$model
public string
# renderPartialAjax( string $view, array $data = null, boolean $return = false, mixed $includeScriptFiles = false )

Renders a view with any attached scripts, WITHOUT the core scripts.

Renders a view with any attached scripts, WITHOUT the core scripts.

This method fixes the problem with CController::renderPartial() where an AJAX request with $processOutput=true includes the core scripts, breaking everything on the page in rendering a partial view, or an AJAX response.

Parameters

$view
string
$view name of the view to be rendered. See CController::getViewFile() for details about how the view script is resolved.
$data
array
$data data to be extracted into PHP variables and made available to the view script
$return
boolean
$return whether the rendering result should be returned instead of being displayed to end users
$includeScriptFiles

Returns

string
the rendering result. Null if the rendering result is not required.

Throws

CException
if the view does not exist
public boolean
# checkPermissions( mixed & $model, string $action = null )

Determines if we have permission to edit something based on the assignedTo field.

Determines if we have permission to edit something based on the assignedTo field.

Parameters

$model
mixed
$model The model in question (subclass of CActiveRecord or X2Model
$action
string
$action

Returns

boolean
public
# view( mixed & $model, String $type = null, mixed $params = array() )

Displays a particular model.

Displays a particular model.

This method is called in child controllers which pass it a model to display and what type of model it is (i.e. Contact, Opportunity, Account). It also creates an action history and provides appropriate variables to the view.

Parameters

$model
mixed
$model The model to be displayed (subclass of CActiveRecord or X2Model
$type
String
$type The type of the module being displayed
$params
public CActiveDataProvider
# getHistory( mixed & $model, mixed $type = null )

Obtain the history of actions associated with a model.

Obtain the history of actions associated with a model.

Returns the data provider that references the history.

Parameters

$model
mixed
$model The model in question (subclass of CActiveRecord or X2Model
$type
mixed
$type The association type (type of the model)

Returns

CActiveDataProvider
public integer
# getCurrentWorkflow( integer $id, string $type )

Obtains the current worflow for a model of given type and id. Prioritizes incomplete workflows over completed ones.

Obtains the current worflow for a model of given type and id. Prioritizes incomplete workflows over completed ones.

Parameters

$id
integer
$id the ID of the record
$type
string
$type the associationType of the record

Returns

integer
the ID of the current workflow (0 if none are found)
public static
# convertUrls( string $text, boolean $convertLineBreaks = true )

Replaces any URL in text with an html link (supports mailto links)

Replaces any URL in text with an html link (supports mailto links)

Parameters

$text
string
$text Text to be converted
$convertLineBreaks
boolean
$convertLineBreaks
public
# actionDeleteNote( mixed $id )
public
# create( mixed $model, mixed $oldAttributes, mixed $api )

Creates a new model. If creation is successful, the browser will be redirected to the 'view' page.

Creates a new model. If creation is successful, the browser will be redirected to the 'view' page.

public
# update( integer $model, mixed $oldAttributes, mixed $api )

Updates a particular model. If update is successful, the browser will be redirected to the 'view' page.

Updates a particular model. If update is successful, the browser will be redirected to the 'view' page.

Parameters

$model
integer
$id the ID of the model to be updated
$oldAttributes
$api
public
# index( mixed $model, mixed $name )

Lists all models.

Lists all models.

public
# admin( mixed $model, mixed $name )

Manages all models.

Manages all models.

Parameters

$model
mixed
$model The model to use admin on, created in a controller subclass. The model must be constucted with the parameter 'search'
$name
mixed
$name The name of the model being viewed (Opportunities, Actions, etc.)
public
# actionSearch( )

Search for a term. Defined in X2Base so that all Controllers can use, but it makes a call to the SearchController.

Search for a term. Defined in X2Base so that all Controllers can use, but it makes a call to the SearchController.

public
# cleanUpTags( mixed $model )

Delete all tags associated with a model

Delete all tags associated with a model

public
# decodeQuotes( mixed $str )
public
# encodeQuotes( mixed $str )
public
# getPhpMailer( mixed $sendAs = -1 )
public
# throwException( mixed $message )
public array
# sendUserEmail( array $addresses, string $subject, string $message, array $attachments = null, array|integer $from = null )

Send an email from X2Engine, returns an array with status code/message

Send an email from X2Engine, returns an array with status code/message

Parameters

$addresses
array
addresses
$subject
string
$subject the subject for the email
$message
string
$message the body of the email
$attachments
array
$attachments array of attachments to send
$from
array|integer
$from from and reply to address for the email array(name, address) or, if integer, the ID of a email credentials record to use for delivery.

Returns

array
public
# parseEmailTo( mixed $string )
public
# mailingListToString( mixed $list, mixed $encodeQuotes = false )
public
# filterSetPortlets( CFilterChain $filterChain )

Obtain the widget list for the current web user.

Obtain the widget list for the current web user.

Parameters

$filterChain
CFilterChain
$filterChain
protected
# performAjaxValidation( CModel $model )

Performs the AJAX validation.

Performs the AJAX validation.

Parameters

$model
CModel
the model to be validated
public
# actionGetX2ModelInput( mixed $modelName, mixed $fieldName )

Calls renderInput for model and input type with given names and returns the result.

Calls renderInput for model and input type with given names and returns the result.

protected
# prepareMenu( array & $menuItems, array|true $selectOptions )

Helper method to hide specific menu options or unset links before the menu is rendered

Helper method to hide specific menu options or unset links before the menu is rendered

Parameters

$menuItems
array
$menuItems Original menu items
$selectOptions
array|true
$selectOptions Menu items to include. If set to true, all default menu items will get displayed
protected
# renderLayout( mixed $layoutFile, mixed $output )
public string
# render( string $view, array $data = null, boolean $return = false )

Override parent method so that layout business logic can be moved to controller This method is Copyright (c) 2008-2014 by Yii Software LLC http://www.yiiframework.com/license/

Override parent method so that layout business logic can be moved to controller This method is Copyright (c) 2008-2014 by Yii Software LLC http://www.yiiframework.com/license/

Parameters

$view
string
$view name of the view to be rendered. See CController::getViewFile() for details about how the view script is resolved.
$data
array
$data data to be extracted into PHP variables and made available to the view script
$return
boolean
$return whether the rendering result should be returned instead of being displayed to end users.

Returns

string
the rendering result. Null if the rendering result is not required.

Overrides

CController::render()
public
# setPageTitle( string $value )

Overrides parent method so that x2base's _pageTitle property is used instead of CController's.

Overrides parent method so that x2base's _pageTitle property is used instead of CController's.

This method is Copyright (c) 2008-2014 by Yii Software LLC http://www.yiiframework.com/license/

Parameters

$value
string
$value the page title.

Overrides

CController::setPageTitle()
public string
# getPageTitle( )

Overrides parent method so that configurable app name is used instead of name from the config file.

Overrides parent method so that configurable app name is used instead of name from the config file.

This method is Copyright (c) 2008-2014 by Yii Software LLC http://www.yiiframework.com/license/

Returns

string
the page title. Defaults to the controller name and the action name.

Overrides

CController::getPageTitle()
public mixed
# widget( string $className, array $properties = array(), boolean $captureOutput = false, mixed $run = true )

Overridden to add $run param

Overridden to add $run param

This method is Copyright (c) 2008-2014 by Yii Software LLC http://www.yiiframework.com/license/

Parameters

$className
string
$className the widget class name or class in dot syntax (e.g. application.widgets.MyWidget)
$properties
array
$properties list of initial property values for the widget (Property Name => Property Value)
$captureOutput
boolean
$captureOutput whether to capture the output of the widget. If true, the method will capture and return the output generated by the widget. If false, the output will be directly sent for display and the widget object will be returned. This parameter is available since version 1.1.2.
$run

Returns

mixed
the widget instance when $captureOutput is false, or the widget output when $captureOutput is true.

Overrides

CBaseController::widget()
public
# actionQuickView( mixed $id )
protected
# getModelFromTypeAndId( mixed $modelName, mixed $modelId, mixed $x2ModelOnly = true )
protected
# getModelsFromTypeAndId( array $recordInfo )
Methods inherited from X2Controller
badRequest(), badRequestException(), getBehaviorActions(), isAjaxRequest(), redirectToLogin(), resolveViewFile(), runBehaviorBeforeActionHandlers(), setFileFields(), validateMobileRequest()
Methods inherited from CController
__construct(), accessRules(), afterAction(), afterRender(), beforeRender(), clearPageStates(), createAbsoluteUrl(), createAction(), createActionFromMap(), createUrl(), filterAccessControl(), filterAjaxOnly(), filterPostOnly(), forward(), getAction(), getActionParams(), getCachingStack(), getClips(), getId(), getLayoutFile(), getModule(), getPageState(), getRoute(), getUniqueId(), getViewFile(), getViewPath(), init(), invalidActionParams(), isCachingStackEmpty(), loadPageStates(), missingAction(), processDynamicOutput(), processOutput(), recordCachingAction(), redirect(), refresh(), renderClip(), renderDynamic(), renderDynamicInternal(), renderPartial(), renderText(), replaceDynamicOutput(), run(), runAction(), runActionWithFilters(), savePageStates(), setAction(), setPageState()
Methods inherited from CBaseController
beginCache(), beginClip(), beginContent(), beginWidget(), createWidget(), endCache(), endClip(), endContent(), endWidget(), renderFile(), renderInternal()
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()
Constants inherited from CController
STATE_INPUT_NAME
Properties summary
public string $layout '//layouts/column3'
#

the default layout for the controller view. Defaults to '//layouts/column1', meaning using a single column layout. See 'protected/views/layouts/column1.php'.

the default layout for the controller view. Defaults to '//layouts/column1', meaning using a single column layout. See 'protected/views/layouts/column1.php'.

public boolean $noBackdrop false
#

$noBackdrop If true, then the content will not have a backdrop

$noBackdrop If true, then the content will not have a backdrop

public array $menu array()
#

context menu items. This property will be assigned to CMenu::items.

context menu items. This property will be assigned to CMenu::items.

public array $breadcrumbs array()
#

the breadcrumbs of the current page. The value of this property will be assigned to CBreadcrumbs::links. Please refer to CBreadcrumbs::links for more details on how to specify this property.

the breadcrumbs of the current page. The value of this property will be assigned to CBreadcrumbs::links. Please refer to CBreadcrumbs::links for more details on how to specify this property.

public array $portlets array()
#
public array $leftPortlets array()
#
public mixed $modelClass
#
public array $actionMenu array()
#
public array $leftWidgets array()
#
Properties inherited from CController
$defaultAction
Magic properties inherited from CController
$action, $actionParams, $cachingStack, $clips, $id, $module, $pageTitle, $route, $uniqueId, $viewPath
X2CRM Documentation API documentation generated by ApiGen 2.8.0