| 包 | system.web |
|---|---|
| 继承 | class CExtController » CController » CBaseController » CComponent |
| 源自 | 1.0 |
| 版本 | $Id: CExtController.php 3515 2011-12-28 12:29:24Z mDOMba $ |
| 源码 |
CExtController是作为扩展分布式控制器的基类。
CExtController的主要目的是重定义viewPath属性 以致于它能指向“views”子目录它在包含 控制器类文件的目录下面。
CExtController的主要目的是重定义viewPath属性 以致于它能指向“views”子目录它在包含 控制器类文件的目录下面。
公共属性
| 属性 | 类型 | 描述 | 定义在 |
|---|---|---|---|
| action | CAction | the action currently being executed, null if no active action. | CController |
| actionParams | array | Returns the request parameters that will be used for action parameter binding. | CController |
| cachingStack | CStack | stack of COutputCache objects | CController |
| clips | CMap | Returns the list of clips. | CController |
| defaultAction | string | the name of the default action. | CController |
| id | string | ID of the controller | CController |
| layout | mixed | the name of the layout to be applied to this controller's views. | CController |
| module | CWebModule | the module that this controller belongs to. | CController |
| pageTitle | string | the page title. | CController |
| route | string | the route (module ID, controller ID and action ID) of the current request. | CController |
| uniqueId | string | the controller ID that is prefixed with the module ID (if any). | CController |
| viewPath | string | 返回包含这个控制器的视图文件的目录。 | CExtController |
公共方法
| 方法 | 描述 | 定义在 |
|---|---|---|
| __call() | 如果类中没有调的方法名,则调用这个方法。 | CComponent |
| __construct() | CController | |
| __get() | 返回一个属性值、一个事件处理程序列表或一个行为名称。 | CComponent |
| __isset() | 检查一个属性是否为null。 | CComponent |
| __set() | 设置一个组件的属性值。 | CComponent |
| __unset() | 设置一个组件的属性为null。 | CComponent |
| accessRules() | Returns the access rules for this controller. | CController |
| actions() | Returns a list of external action classes. | CController |
| asa() | 返回这个名字的行为对象。 | CComponent |
| attachBehavior() | 附加一个行为到组件。 | CComponent |
| attachBehaviors() | 附加一个行为列表到组件。 | CComponent |
| attachEventHandler() | 为事件附加一个事件处理程序。 | CComponent |
| beginCache() | Begins fragment caching. | CBaseController |
| beginClip() | Begins recording a clip. | CBaseController |
| beginContent() | Begins the rendering of content that is to be decorated by the specified view. | CBaseController |
| beginWidget() | Creates a widget and executes it. | CBaseController |
| behaviors() | Returns a list of behaviors that this controller should behave as. | CController |
| canGetProperty() | 确定属性是否可读。 | CComponent |
| canSetProperty() | 确定属性是否可写。 | CComponent |
| clearPageStates() | Removes all page states. | CController |
| createAbsoluteUrl() | Creates an absolute URL for the specified action defined in this controller. | CController |
| createAction() | Creates the action instance based on the action name. | CController |
| createUrl() | Creates a relative URL for the specified action defined in this controller. | CController |
| createWidget() | Creates a widget and initializes it. | CBaseController |
| detachBehavior() | 从组件中分离一个行为。 | CComponent |
| detachBehaviors() | 从组件中分离所有行为。 | CComponent |
| detachEventHandler() | 分离一个存在的事件处理程序。 | CComponent |
| disableBehavior() | 禁用一个附加行为。 | CComponent |
| disableBehaviors() | 禁用组件附加的所有行为。 | CComponent |
| enableBehavior() | 启用一个附加行为。 | CComponent |
| enableBehaviors() | 启用组件附加的所有行为。 | CComponent |
| endCache() | Ends fragment caching. | CBaseController |
| endClip() | Ends recording a clip. | CBaseController |
| endContent() | Ends the rendering of content. | CBaseController |
| endWidget() | Ends the execution of the named widget. | CBaseController |
| evaluateExpression() | 计算一个PHP表达式,或根据组件上下文执行回调。 | CComponent |
| filterAccessControl() | The filter method for 'accessControl' filter. | CController |
| filterAjaxOnly() | The filter method for 'ajaxOnly' filter. | CController |
| filterPostOnly() | The filter method for 'postOnly' filter. | CController |
| filters() | Returns the filter configurations. | CController |
| forward() | Processes the request using another controller action. | CController |
| getAction() | 返回the action currently being executed, null if no active action. | CController |
| getActionParams() | Returns the request parameters that will be used for action parameter binding. | CController |
| getCachingStack() | 返回stack of COutputCache objects | CController |
| getClips() | Returns the list of clips. | CController |
| getEventHandlers() | 返回一个事件的附加处理程序列表。 | CComponent |
| getId() | 返回ID of the controller | CController |
| getLayoutFile() | Looks for the layout view script based on the layout name. | CController |
| getModule() | 返回the module that this controller belongs to. It returns null if the controller does not belong to any module | CController |
| getPageState() | Returns a persistent page state value. | CController |
| getPageTitle() | 返回the page title. Defaults to the controller name and the action name. | CController |
| getRoute() | 返回the route (module ID, controller ID and action ID) of the current request. | CController |
| getUniqueId() | 返回the controller ID that is prefixed with the module ID (if any). | CController |
| getViewFile() | Looks for the view file according to the given view name. | CController |
| getViewPath() | 返回包含这个控制器的视图文件的目录。 | CExtController |
| hasEvent() | 确定一个事件是否定义。 | CComponent |
| hasEventHandler() | 检查事件是否有附加的处理程序。 | CComponent |
| hasProperty() | 确定属性是否被定义。 | CComponent |
| init() | Initializes the controller. | CController |
| invalidActionParams() | This method is invoked when the request parameters do not satisfy the requirement of the specified action. | CController |
| isCachingStackEmpty() | Returns whether the caching stack is empty. | CController |
| missingAction() | Handles the request whose action is not recognized. | CController |
| processDynamicOutput() | Postprocesses the dynamic output. | CController |
| processOutput() | Postprocesses the output generated by render(). | CController |
| raiseEvent() | 发起一个事件。 | CComponent |
| recordCachingAction() | Records a method call when an output cache is in effect. | CController |
| redirect() | Redirects the browser to the specified URL or route (controller/action). | CController |
| refresh() | Refreshes the current page. | CController |
| render() | Renders a view with a layout. | CController |
| renderClip() | Renders a named clip with the supplied parameters. | CController |
| renderDynamic() | Renders dynamic content returned by the specified callback. | CController |
| renderDynamicInternal() | This method is internally used. | CController |
| renderFile() | Renders a view file. | CBaseController |
| renderInternal() | Renders a view file. | CBaseController |
| renderPartial() | Renders a view. | CController |
| renderText() | Renders a static text string. | CController |
| resolveViewFile() | Finds a view file based on its name. | CController |
| run() | Runs the named action. | CController |
| runAction() | Runs the action after passing through all filters. | CController |
| runActionWithFilters() | Runs an action with the specified filters. | CController |
| setAction() | 设置the action currently being executed. | CController |
| setPageState() | Saves a persistent page state value. | CController |
| setPageTitle() | 设置the page title. | CController |
| setViewPath() | 设置包含这个控制器的视图文件的目录。 | CExtController |
| widget() | Creates a widget and executes it. | CBaseController |
受保护方法
| 方法 | 描述 | 定义在 |
|---|---|---|
| afterAction() | This method is invoked right after an action is executed. | CController |
| afterRender() | This method is invoked after the specified is rendered by calling render(). | CController |
| beforeaction() | This method is invoked right before an action is to be executed (after all possible filters.) | CController |
| beforeRender() | This method is invoked at the beginning of render(). | CController |
| createActionFromMap() | Creates the action instance based on the action map. | CController |
| loadPageStates() | Loads page states from a hidden input. | CController |
| replaceDynamicOutput() | Replaces the dynamic content placeholders with actual content. | CController |
| savePageStates() | Saves page states as a base64 string. | CController |
属性详细
viewPath
属性
public string getViewPath()
public void setViewPath(string $value)
public void setViewPath(string $value)
返回包含这个控制器的视图文件的目录。 这个方法通过指定视图路径到 “views”子目录覆盖父类实现, “views”子目录在包含控制器类文件的目录下面。
方法详细
getViewPath()
方法
|
public string getViewPath()
| ||
| {return} | string | 包含这个控制器的视图文件的目录。 |
public function getViewPath()
{
if($this->_viewPath===null)
{
$class=new ReflectionClass(get_class($this));
$this->_viewPath=dirname($class->getFileName()).DIRECTORY_SEPARATOR.'views';
}
return $this->_viewPath;
}
返回包含这个控制器的视图文件的目录。 这个方法通过指定视图路径到 “views”子目录覆盖父类实现, “views”子目录在包含控制器类文件的目录下面。
setViewPath()
方法
|
public void setViewPath(string $value)
| ||
| $value | string | 包含这个控制器的视图文件的目录。 |
public function setViewPath($value)
{
$this->_viewPath=$value;
}