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
  • Net
  • None
  • PHP
  • system
    • base
    • caching
      • dependencies
    • collections
    • console
    • db
      • ar
      • schema
        • cubrid
        • mssql
        • mysql
        • oci
        • pgsql
        • sqlite
    • i18n
      • gettext
    • logging
    • test
    • utils
    • validators
    • web
      • actions
      • auth
      • filters
      • form
      • helpers
      • renderers
      • services
      • widgets
        • captcha
        • pagers
  • Text
    • Highlighter
  • zii
    • behaviors
    • widgets
      • grid
      • jui

Classes

  • ActionFormModelBase
  • CActiveDataProvider
  • CalendarEventFormModel
  • CallFormModel
  • CArrayDataProvider
  • CAssetManager
  • CBaseController
  • CBaseUrlRule
  • CCacheHttpSession
  • CClientScript
  • CController
  • CCookieCollection
  • CDataProvider
  • CDataProviderIterator
  • CDbHttpSession
  • CExtController
  • CFormModel
  • CHttpCookie
  • CHttpRequest
  • CHttpSession
  • CHttpSessionIterator
  • COutputEvent
  • CPagination
  • CreatePageFormModel
  • CSort
  • CSqlDataProvider
  • CTheme
  • CThemeManager
  • CUploadedFile
  • CUrlManager
  • CUrlRule
  • CWebApplication
  • CWebModule
  • CWidgetFactory
  • EditMobileFormsFormModel
  • EventCommentPublisherFormModel
  • EventFormModel
  • EventPublisherFormModel
  • FileSystemObjectDataProvider
  • MassActionFormModel
  • MobilePagination
  • NoteFormModel
  • NotificationsController
  • TimeFormModel
  • UploadLogoFormModel
  • X2FormModel
  • X2HttpRequest

Interfaces

  • IDataProvider
  • IWidgetFactory
  • Overview
  • Package
  • Class
  • Tree

Class CWebApplication

CWebApplication extends CApplication by providing functionalities specific to Web requests.

CWebApplication manages the controllers in MVC pattern, and provides the following additional core application components:
  • urlManager: provides URL parsing and constructing functionality;
  • request: encapsulates the Web request information;
  • session: provides the session-related functionalities;
  • assetManager: manages the publishing of private asset files.
  • user: represents the user session information.
  • themeManager: manages themes.
  • authManager: manages role-based access control (RBAC).
  • clientScript: manages client scripts (javascripts and CSS).
  • widgetFactory: creates widgets and supports widget skinning.

User requests are resolved as controller-action pairs and additional parameters. CWebApplication creates the requested controller instance and let it to handle the actual user request. If the user does not specify controller ID, it will assume CWebApplication::$defaultController is requested (which defaults to 'site').

Controller class files must reside under the directory getControllerPath controllerPath (defaults to 'protected/controllers'). The file name and the class name must be the same as the controller ID with the first letter in upper case and appended with 'Controller'. For example, the controller 'article' is defined by the class 'ArticleController' which is in the file 'protected/controllers/ArticleController.php'.

CComponent
Extended by CModule
Extended by CApplication
Extended by CWebApplication

Direct known subclasses

X2WebApplication
Package: system\web
Copyright: 2008-2013 Yii Software LLC
License: http://www.yiiframework.com/license/
Author: Qiang Xue <qiang.xue@gmail.com>
Since: 1.0
Located at x2engine/framework/web/CWebApplication.php
Methods summary
public
# processRequest( )

Processes the current request. It first resolves the request into controller and action, and then creates the controller to perform the action.

Processes the current request. It first resolves the request into controller and action, and then creates the controller to perform the action.

protected
# registerCoreComponents( )

Registers the core application components. This method overrides the parent implementation by registering additional core components.

Registers the core application components. This method overrides the parent implementation by registering additional core components.

See

CModule::setComponents()

Overrides

CApplication::registerCoreComponents()
public IAuthManager
# getAuthManager( )

Returns

IAuthManager
the authorization manager component
public CAssetManager
# getAssetManager( )

Returns

CAssetManager
the asset manager component
public CHttpSession
# getSession( )

Returns

CHttpSession
the session component
public CWebUser
# getUser( )

Returns

CWebUser
the user session information
public IViewRenderer
# getViewRenderer( )

Returns the view renderer. If this component is registered and enabled, the default view rendering logic defined in CBaseController will be replaced by this renderer.

Returns the view renderer. If this component is registered and enabled, the default view rendering logic defined in CBaseController will be replaced by this renderer.

Returns

IViewRenderer
the view renderer.
public CClientScript
# getClientScript( )

Returns the client script manager.

Returns the client script manager.

Returns

CClientScript
the client script manager
public IWidgetFactory
# getWidgetFactory( )

Returns the widget factory.

Returns the widget factory.

Returns

IWidgetFactory
the widget factory

Since

1.1
public CThemeManager
# getThemeManager( )

Returns

CThemeManager
the theme manager.
public CTheme
# getTheme( )

Returns

CTheme
the theme used currently. Null if no theme is being used.
public
# setTheme( string $value )

Parameters

$value
string
$value the theme name
public
# runController( string $route )

Creates the controller and performs the specified action.

Creates the controller and performs the specified action.

Parameters

$route
string
$route the route of the current request. See CWebApplication::createController() for more details.

Throws

CHttpException
if the controller could not be created.
public array
# createController( string $route, CWebModule $owner = null )

Creates a controller instance based on a route. The route should contain the controller ID and the action ID. It may also contain additional GET variables. All these must be concatenated together with slashes.

Creates a controller instance based on a route. The route should contain the controller ID and the action ID. It may also contain additional GET variables. All these must be concatenated together with slashes.

This method will attempt to create a controller in the following order:
  1. If the first segment is found in CWebApplication::$controllerMap, the corresponding controller configuration will be used to create the controller;
  2. If the first segment is found to be a module ID, the corresponding module will be used to create the controller;
  3. Otherwise, it will search under the controllerPath to create the corresponding controller. For example, if the route is "admin/user/create", then the controller will be created using the class file "protected/controllers/admin/UserController.php".

Parameters

$route
string
$route the route of the request.
$owner
CWebModule
$owner the module that the new controller will belong to. Defaults to null, meaning the application instance is the owner.

Returns

array
the controller instance and the action ID. Null if the controller class does not exist or the route is invalid.
protected string
# parseActionParams( string $pathInfo )

Parses a path info into an action ID and GET variables.

Parses a path info into an action ID and GET variables.

Parameters

$pathInfo
string
$pathInfo path info

Returns

string
action ID
public CController
# getController( )

Returns

CController
the currently active controller

Overrides

CApplication::getController()
public
# setController( CController $value )

Parameters

$value
CController
$value the currently active controller
public string
# getControllerPath( )

Returns

string
the directory that contains the controller classes. Defaults to 'protected/controllers'.
public
# setControllerPath( string $value )

Parameters

$value
string
$value the directory that contains the controller classes.

Throws

CException
if the directory is invalid
public string
# getViewPath( )

Returns

string
the root directory of view files. Defaults to 'protected/views'.
public
# setViewPath( string $path )

Parameters

$path
string
$path the root directory of view files.

Throws

CException
if the directory does not exist.
public string
# getSystemViewPath( )

Returns

string
the root directory of system view files. Defaults to 'protected/views/system'.
public
# setSystemViewPath( string $path )

Parameters

$path
string
$path the root directory of system view files.

Throws

CException
if the directory does not exist.
public string
# getLayoutPath( )

Returns

string
the root directory of layout files. Defaults to 'protected/views/layouts'.
public
# setLayoutPath( string $path )

Parameters

$path
string
$path the root directory of layout files.

Throws

CException
if the directory does not exist.
public boolean
# beforeControllerAction( CController $controller, CAction $action )

The pre-filter for controller actions. This method is invoked before the currently requested controller action and all its filters are executed. You may override this method with logic that needs to be done before all controller actions.

The pre-filter for controller actions. This method is invoked before the currently requested controller action and all its filters are executed. You may override this method with logic that needs to be done before all controller actions.

Parameters

$controller
CController
$controller the controller
$action
CAction
$action the action

Returns

boolean
whether the action should be executed.
public
# afterControllerAction( CController $controller, CAction $action )

The post-filter for controller actions. This method is invoked after the currently requested controller action and all its filters are executed. You may override this method with logic that needs to be done after all controller actions.

The post-filter for controller actions. This method is invoked after the currently requested controller action and all its filters are executed. You may override this method with logic that needs to be done after all controller actions.

Parameters

$controller
CController
$controller the controller
$action
CAction
$action the action
public CWebModule
# findModule( string $id )

Do not call this method. This method is used internally to search for a module by its ID.

Do not call this method. This method is used internally to search for a module by its ID.

Parameters

$id
string
$id module ID

Returns

CWebModule
the module that has the specified ID. Null if no module is found.
protected
# init( )

Initializes the application. This method overrides the parent implementation by preloading the 'request' component.

Initializes the application. This method overrides the parent implementation by preloading the 'request' component.

Overrides

CModule::init()
Methods inherited from CApplication
__construct(), clearGlobalState(), createAbsoluteUrl(), createUrl(), displayError(), displayException(), end(), findLocalizedFile(), getBasePath(), getBaseUrl(), getCache(), getCoreMessages(), getDateFormatter(), getDb(), getErrorHandler(), getExtensionPath(), getGlobalState(), getHomeUrl(), getId(), getLanguage(), getLocale(), getLocaleDataPath(), getMessages(), getNumberFormatter(), getRequest(), getRuntimePath(), getSecurityManager(), getStatePersister(), getTimeZone(), getUrlManager(), handleError(), handleException(), initSystemHandlers(), loadGlobalState(), onBeginRequest(), onEndRequest(), onError(), onException(), run(), saveGlobalState(), setBasePath(), setExtensionPath(), setGlobalState(), setHomeUrl(), setId(), setLanguage(), setLocaleDataPath(), setRuntimePath(), setTimeZone()
Methods inherited from CModule
__get(), __isset(), configure(), getComponent(), getComponents(), getModule(), getModulePath(), getModules(), getParams(), getParentModule(), hasComponent(), hasModule(), preinit(), preloadComponents(), setAliases(), setComponent(), setComponents(), setImport(), setModulePath(), setModules(), setParams()
Methods inherited from CComponent
__call(), __set(), __unset(), asa(), attachBehavior(), attachBehaviors(), attachEventHandler(), canGetProperty(), canSetProperty(), detachBehavior(), detachBehaviors(), detachEventHandler(), disableBehavior(), disableBehaviors(), enableBehavior(), enableBehaviors(), evaluateExpression(), getEventHandlers(), hasEvent(), hasEventHandler(), hasProperty(), raiseEvent()
Properties summary
public string $defaultController 'site'
#

Return

string
the route of the default controller, action or module. Defaults to 'site'.
public mixed $layout 'main'
#

the application-wide layout. Defaults to 'main' (relative to getLayoutPath layoutPath). If this is false, then no layout will be used.

the application-wide layout. Defaults to 'main' (relative to getLayoutPath layoutPath). If this is false, then no layout will be used.

public array $controllerMap array()
#

mapping from controller ID to controller configurations. Each name-value pair specifies the configuration for a single controller. A controller configuration can be either a string or an array. If the former, the string should be the class name or YiiBase::getPathOfAlias class path alias of the controller. If the latter, the array must contain a 'class' element which specifies the controller's class name or YiiBase::getPathOfAlias class path alias. The rest name-value pairs in the array are used to initialize the corresponding controller properties. For example,

array(
  'post'=>array(
     'class'=>'path.to.PostController',
     'pageTitle'=>'something new',
  ),
  'user'=>'path.to.UserController',
)

Note, when processing an incoming request, the controller map will first be checked to see if the request can be handled by one of the controllers in the map. If not, a controller will be searched for under the getControllerPath default controller path.

mapping from controller ID to controller configurations. Each name-value pair specifies the configuration for a single controller. A controller configuration can be either a string or an array. If the former, the string should be the class name or YiiBase::getPathOfAlias class path alias of the controller. If the latter, the array must contain a 'class' element which specifies the controller's class name or YiiBase::getPathOfAlias class path alias. The rest name-value pairs in the array are used to initialize the corresponding controller properties. For example,

array(
  'post'=>array(
     'class'=>'path.to.PostController',
     'pageTitle'=>'something new',
  ),
  'user'=>'path.to.UserController',
)

Note, when processing an incoming request, the controller map will first be checked to see if the request can be handled by one of the controllers in the map. If not, a controller will be searched for under the getControllerPath default controller path.

public array $catchAllRequest
#

the configuration specifying a controller which should handle all user requests. This is mainly used when the application is in maintenance mode and we should use a controller to handle all incoming requests. The configuration specifies the controller route (the first element) and GET parameters (the rest name-value pairs). For example,

array(
    'offline/notice',
    'param1'=>'value1',
    'param2'=>'value2',
)

Defaults to null, meaning catch-all is not effective.

the configuration specifying a controller which should handle all user requests. This is mainly used when the application is in maintenance mode and we should use a controller to handle all incoming requests. The configuration specifies the controller route (the first element) and GET parameters (the rest name-value pairs). For example,

array(
    'offline/notice',
    'param1'=>'value1',
    'param2'=>'value2',
)

Defaults to null, meaning catch-all is not effective.

public string $controllerNamespace
#

Namespace that should be used when loading controllers. Default is to use global namespace.

Namespace that should be used when loading controllers. Default is to use global namespace.

Since

1.1.11
Properties inherited from CApplication
$charset, $localeClass, $name, $sourceLanguage
Properties inherited from CModule
$behaviors, $preload
Magic properties summary
public IAuthManager $authManager
#

The authorization manager component.

The authorization manager component.

public CAssetManager $assetManager
#

The asset manager component.

The asset manager component.

public CHttpSession $session
#

The session component.

The session component.

public CWebUser $user
#

The user session information.

The user session information.

public IViewRenderer $viewRenderer
#

The view renderer.

The view renderer.

public CClientScript $clientScript
#

The client script manager.

The client script manager.

public IWidgetFactory $widgetFactory
#

The widget factory.

The widget factory.

public CThemeManager $themeManager
#

The theme manager.

The theme manager.

public CTheme $theme
#

The theme used currently. Null if no theme is being used.

The theme used currently. Null if no theme is being used.

public CController $controller
#

The currently active controller.

The currently active controller.

public string $controllerPath
#

The directory that contains the controller classes. Defaults to 'protected/controllers'.

The directory that contains the controller classes. Defaults to 'protected/controllers'.

public string $viewPath
#

The root directory of view files. Defaults to 'protected/views'.

The root directory of view files. Defaults to 'protected/views'.

public string $systemViewPath
#

The root directory of system view files. Defaults to 'protected/views/system'.

The root directory of system view files. Defaults to 'protected/views/system'.

public string $layoutPath
#

The root directory of layout files. Defaults to 'protected/views/layouts'.

The root directory of layout files. Defaults to 'protected/views/layouts'.

Magic properties inherited from CApplication
$basePath, $baseUrl, $cache, $coreMessages, $dateFormatter, $db, $errorHandler, $extensionPath, $homeUrl, $id, $language, $locale, $localeDataPath, $messages, $numberFormatter, $request, $runtimePath, $securityManager, $statePersister, $timeZone, $urlManager
Magic properties inherited from CModule
$aliases, $components, $import, $modulePath, $modules, $params, $parentModule
API documentation generated by ApiGen 2.8.0