CJuiWidget

CDbHttpSession

Yii Framework v1.1.10 类参考

CJuiWidget

zii.widgets.jui
继承 abstract class CJuiWidget » CWidget » CBaseController » CComponent
子类 CJuiAccordion, CJuiDialog, CJuiDraggable, CJuiDroppable, CJuiInputWidget, CJuiProgressBar, CJuiResizable, CJuiSelectable, CJuiSlider, CJuiSortable, CJuiTabs
源自 1.1
版本 $Id: CJuiWidget.php 2799 2011-01-01 19:31:13Z qiang.xue $
源码 framework/zii/widgets/jui/CJuiWidget.php
这是所有JUI widget的基类。

公共属性

隐藏继承属性

属性类型描述定义在
actionPrefix string actions的ID的前缀。 当微件在CController::actions中声明了 动作提供者,可以为其动作的ID指定前缀以区别 于别的微件或控制器。当微件用于控制器 的视图中时,必须配置同样的前缀。 CWidget
controller CController 返回此微件所属的控制器。 CWidget
cssFile mixed 主题的CSS文件名。默认是‘jquery-ui. CJuiWidget
htmlOptions array JUI组件中HTML标签的属性设置。 CJuiWidget
id string 返回此微件的ID。如果需要的话,将生产一个新的ID并将其返回。 CWidget
options array the 初始的JavaScript需要传递给JUI插件的选项。 CJuiWidget
owner CBaseController 返回此微件的所有者或创建者。 CWidget
scriptFile mixed 主要JUI的JavaScript的文件名。默认是‘jquery-ui. CJuiWidget
scriptUrl string 包含所有JUI JavaScript文件的根目录。 如果没有设置这个属性(默认),Yii will publish the JUI package included in the zii release and use that to infer the root script URL. CJuiWidget
skin mixed 微件使用的皮肤的名称。默认为“default”。 如果此属性设置为false,微件将不会有皮肤被使用。 CWidget
theme string JUI主题的名字。默认是‘base’。确保在themeUrl下有这样一个目录, 其名称是这个属性的值相同(区分大小写)。 CJuiWidget
themeUrl string 包含所有JUI的主题文件夹的根目录。 如果没有设置这个属性(默认), Yii will publish the JUI package included in the zii release and use that to infer the root theme URL. CJuiWidget
viewPath string 返回包含此微件所需的视图文件的路径。 CWidget

公共方法

隐藏继承方法

方法描述定义在
__call() 如果类中没有调的方法名,则调用这个方法。 CComponent
__construct() 构造器。 CWidget
__get() 返回一个属性值、一个事件处理程序列表或一个行为名称。 CComponent
__isset() 检查一个属性是否为null。 CComponent
__set() 设置一个组件的属性值。 CComponent
__unset() 设置一个组件的属性为null。 CComponent
actions() 返回此widget使用的动作的列表。 CWidget
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
canGetProperty() 确定属性是否可读。 CComponent
canSetProperty() 确定属性是否可写。 CComponent
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
getController() 返回此微件所属的控制器。 CWidget
getEventHandlers() 返回一个事件的附加处理程序列表。 CComponent
getId() 返回此微件的ID。如果需要的话,将生产一个新的ID并将其返回。 CWidget
getOwner() 返回此微件的所有者或创建者。 CWidget
getViewFile() 根据视图名查找视图文件。 CWidget
getViewPath() 返回包含此微件所需的视图文件的路径。 CWidget
hasEvent() 确定一个事件是否定义。 CComponent
hasEventHandler() 检查事件是否有附加的处理程序。 CComponent
hasProperty() 确定属性是否被定义。 CComponent
init() 初始化这个组件。 CJuiWidget
raiseEvent() 发起一个事件。 CComponent
render() 渲染一个视图。 CWidget
renderFile() Renders a view file. CBaseController
renderInternal() Renders a view file. CBaseController
run() 运行此微件。 CWidget
setId() 设置此微件的ID。 CWidget
widget() Creates a widget and executes it. CBaseController

受保护方法

隐藏继承方法

方法描述定义在
registerCoreScripts() 注册核心的脚本文件。 CJuiWidget
registerScriptFile() 注册一个JavaScript文件在scriptUrl下。 CJuiWidget
resolvePackagePath() 确定JUI包安装路径。 CJuiWidget

属性详细

cssFile 属性
public mixed $cssFile;

主题的CSS文件名。默认是‘jquery-ui.css’。 注意,如果您需要包括多个主题CSS文件,该文件必须存在于指定的URLthemeUrl/theme。 (例如,在开发过程中,你想包括个人插件的CSS文件), 您可以设置此属性,作为一个CSS文件的名称数组。 这个属性也可以设置为false,这意味着部件将不包括任何主题的CSS文件, 或者你明确指定包含在别处。

htmlOptions 属性
public array $htmlOptions;

JUI组件中HTML标签的属性设置。

options 属性
public array $options;

the 初始的JavaScript需要传递给JUI插件的选项。

scriptFile 属性
public mixed $scriptFile;

主要JUI的JavaScript的文件名。默认是‘jquery-ui.min.js’。 注意,如果您需要包括多个JavaScript脚本文件 (例如,在开发过程中, 你想包括个人插件脚本文件,而不是minized JUI的JavaScript脚本文件), 该文件必须存在于指定的URLscriptUrl。 您可以设置此属性作为一个JavaScript脚本文件的名称数组。 这个属性也可以设置为false,这意味着部件将不包括任何脚本文件, 或者你明确指定包含在别处。

scriptUrl 属性
public string $scriptUrl;

包含所有JUI JavaScript文件的根目录。 如果没有设置这个属性(默认),Yii will publish the JUI package included in the zii release and use that to infer the root script URL. You should set this property if you intend to use a JUI package whose version is different from the one included in zii. 请注意,在此URL下,必须有一个文件,其名称指定为scriptFile。 不要附加任何斜线字符的URL。

theme 属性
public string $theme;

JUI主题的名字。默认是‘base’。确保在themeUrl下有这样一个目录, 其名称是这个属性的值相同(区分大小写)。

themeUrl 属性
public string $themeUrl;

包含所有JUI的主题文件夹的根目录。 如果没有设置这个属性(默认), Yii will publish the JUI package included in the zii release and use that to infer the root theme URL. You should set this property if you intend to use a theme that is not found in the JUI package included in zii. 请注意,在此URL下,必须有一个目录,其名称指定为theme。 不要附加任何斜线字符的URL。

方法详细

init() 方法
public void init()
源码: framework/zii/widgets/jui/CJuiWidget.php#80 (显示)
public function init()
{
    
$this->resolvePackagePath();
    
$this->registerCoreScripts();
    
parent::init();
}

初始化这个组件。 如果有必要,这个方法将发布JUI的资源。 它将调用jQuery和JUI的JavaScript文件和主题CSS文件。 如果重写此方法,确保你最先调用父类方法。

registerCoreScripts() 方法
protected void registerCoreScripts()
源码: framework/zii/widgets/jui/CJuiWidget.php#109 (显示)
protected function registerCoreScripts()
{
    
$cs=Yii::app()->getClientScript();
    if(
is_string($this->cssFile))
        
$cs->registerCssFile($this->themeUrl.'/'.$this->theme.'/'.$this->cssFile);
    else if(
is_array($this->cssFile))
    {
        foreach(
$this->cssFile as $cssFile)
            
$cs->registerCssFile($this->themeUrl.'/'.$this->theme.'/'.$cssFile);
    }

    
$cs->registerCoreScript('jquery');
    if(
is_string($this->scriptFile))
        
$this->registerScriptFile($this->scriptFile);
    else if(
is_array($this->scriptFile))
    {
        foreach(
$this->scriptFile as $scriptFile)
            
$this->registerScriptFile($scriptFile);
    }
}

注册核心的脚本文件。 此方法注册jQuery和JUI的JavaScript文件和主题CSS文件。

registerScriptFile() 方法
protected void registerScriptFile(string $fileName, integer $position=2)
$fileName string JavaScript文件名
$position integer JavaScript文件的位置。有效值包括以下:
  • CClientScript::POS_HEAD:脚本插入head部分title标签之前。
  • CClientScript::POS_BEGIN:脚本插入body的开始部分。
  • CClientScript::POS_END:脚本插入body的结束部分。
源码: framework/zii/widgets/jui/CJuiWidget.php#141 (显示)
protected function registerScriptFile($fileName,$position=CClientScript::POS_END)
{
    
Yii::app()->getClientScript()->registerScriptFile($this->scriptUrl.'/'.$fileName,$position);
}

注册一个JavaScript文件在scriptUrl下。 请注意,默认情况下,脚本文件将呈现在页尾,以提高页面加载速度。

resolvePackagePath() 方法
protected void resolvePackagePath()
源码: framework/zii/widgets/jui/CJuiWidget.php#93 (显示)
protected function resolvePackagePath()
{
    if(
$this->scriptUrl===null || $this->themeUrl===null)
    {
        
$cs=Yii::app()->getClientScript();
        if(
$this->scriptUrl===null)
            
$this->scriptUrl=$cs->getCoreScriptUrl().'/jui/js';
        if(
$this->themeUrl===null)
            
$this->themeUrl=$cs->getCoreScriptUrl().'/jui/css';
    }
}

确定JUI包安装路径。 这个方法将确定的JavaScript的根目录和主题的根目录。 如果他们没有明确规定, 将发布包括在JUI包中并用它来解决所需的路径。

Copyright © 2008-2011 by Yii Software LLC
All Rights Reserved.