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 |
鍏叡灞炴
灞炴 | 绫诲瀷 | 鎻忚堪 | 瀹氫箟鍦 |
---|---|---|---|
actionPrefix | string | actions鐨処D鐨勫墠缂銆 褰撳井浠跺湪CController::actions涓0鏄庝簡 鍔ㄤ綔鎻愪緵鑰咃紝鍙互涓哄叾鍔ㄤ綔鐨処D鎸囧畾鍓嶇紑浠ュ尯鍒 浜庡埆鐨勫井浠舵垨鎺у埗鍣ㄣ傚綋寰欢鐢ㄤ簬鎺у埗鍣 鐨勮鍥句腑鏃讹紝蹇呴』閰嶇疆鍚屾牱鐨勫墠缂銆 | CWidget |
controller | CController | 杩斿洖姝ゅ井浠舵墍灞炵殑鎺у埗鍣ㄣ | CWidget |
cssFile | mixed | 涓婚鐨凜SS鏂囦欢鍚嶃傞粯璁ゆ槸鈥榡query-ui. | CJuiWidget |
htmlOptions | array | JUI缁勪欢涓璈TML鏍囩鐨勫睘鎬ц缃 | CJuiWidget |
id | string | 杩斿洖姝ゅ井浠剁殑ID銆傚鏋滈渶瑕佺殑璇濓紝灏嗙敓浜т竴涓柊鐨処D骞跺皢鍏惰繑鍥炪 | CWidget |
options | array | the 鍒濆鐨凧avaScript闇瑕佷紶閫掔粰JUI鎻掍欢鐨勯夐」銆 | CJuiWidget |
owner | CBaseController | 杩斿洖姝ゅ井浠剁殑鎵鏈夎呮垨鍒涘缓鑰呫 | CWidget |
scriptFile | mixed | 涓昏JUI鐨凧avaScript鐨勬枃浠跺悕銆傞粯璁ゆ槸鈥榡query-ui. | CJuiWidget |
scriptUrl | string | 鍖呭惈鎵鏈塉UI JavaScript鏂囦欢鐨勬牴鐩綍銆 濡傛灉娌℃湁璁剧疆杩欎釜灞炴э紙榛樿锛夛紝Yii will publish the JUI package included in the zii release and use that to infer the root script URL. | CJuiWidget |
skin | mixed | 寰欢浣跨敤鐨勭毊鑲ょ殑鍚嶇О銆傞粯璁や负鈥渄efault鈥濄 濡傛灉姝ゅ睘鎬ц缃负false锛屽井浠跺皢涓嶄細鏈夌毊鑲よ浣跨敤銆 | CWidget |
theme | string | JUI涓婚鐨勫悕瀛椼傞粯璁ゆ槸鈥榖ase鈥欍傜‘淇濆湪themeUrl涓嬫湁杩欐牱涓涓洰褰曪紝 鍏跺悕绉版槸杩欎釜灞炴х殑鍊肩浉鍚岋紙鍖哄垎澶у皬鍐欙級銆 | CJuiWidget |
themeUrl | string | 鍖呭惈鎵鏈塉UI鐨勪富棰樻枃浠跺す鐨勬牴鐩綍銆 濡傛灉娌℃湁璁剧疆杩欎釜灞炴э紙榛樿锛夛紝 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() | 杩斿洖姝idget浣跨敤鐨勫姩浣滅殑鍒楄〃銆 | 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() | 璁$畻涓涓狿HP琛ㄨ揪寮忥紝鎴栨牴鎹粍浠朵笂涓嬫枃鎵ц鍥炶皟銆 | CComponent |
getController() | 杩斿洖姝ゅ井浠舵墍灞炵殑鎺у埗鍣ㄣ | CWidget |
getEventHandlers() | 杩斿洖涓涓簨浠剁殑闄勫姞澶勭悊绋嬪簭鍒楄〃銆 | CComponent |
getId() | 杩斿洖姝ゅ井浠剁殑ID銆傚鏋滈渶瑕佺殑璇濓紝灏嗙敓浜т竴涓柊鐨処D骞跺皢鍏惰繑鍥炪 | 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() | 娉ㄥ唽涓涓狫avaScript鏂囦欢鍦scriptUrl涓嬨 | CJuiWidget |
resolvePackagePath() | 纭畾JUI鍖呭畨瑁呰矾寰勩 | CJuiWidget |
灞炴ц缁
涓婚鐨凜SS鏂囦欢鍚嶃傞粯璁ゆ槸鈥榡query-ui.css鈥欍 娉ㄦ剰锛屽鏋滄偍闇瑕佸寘鎷涓富棰楥SS鏂囦欢锛岃鏂囦欢蹇呴』瀛樺湪浜庢寚瀹氱殑URLthemeUrl/theme銆 锛堜緥濡傦紝鍦ㄥ紑鍙戣繃绋嬩腑锛屼綘鎯冲寘鎷釜浜烘彃浠剁殑CSS鏂囦欢锛夛紝 鎮ㄥ彲浠ヨ缃灞炴э紝浣滀负涓涓狢SS鏂囦欢鐨勫悕绉版暟缁勩 杩欎釜灞炴т篃鍙互璁剧疆涓篺alse锛岃繖鎰忓懗鐫閮ㄤ欢灏嗕笉鍖呮嫭浠讳綍涓婚鐨凜SS鏂囦欢锛 鎴栬呬綘鏄庣‘鎸囧畾鍖呭惈鍦ㄥ埆澶勩
JUI缁勪欢涓璈TML鏍囩鐨勫睘鎬ц缃
the 鍒濆鐨凧avaScript闇瑕佷紶閫掔粰JUI鎻掍欢鐨勯夐」銆
涓昏JUI鐨凧avaScript鐨勬枃浠跺悕銆傞粯璁ゆ槸鈥榡query-ui.min.js鈥欍 娉ㄦ剰锛屽鏋滄偍闇瑕佸寘鎷涓狫avaScript鑴氭湰鏂囦欢 锛堜緥濡傦紝鍦ㄥ紑鍙戣繃绋嬩腑, 浣犳兂鍖呮嫭涓汉鎻掍欢鑴氭湰鏂囦欢锛岃屼笉鏄痬inized JUI鐨凧avaScript鑴氭湰鏂囦欢锛夛紝 璇ユ枃浠跺繀椤诲瓨鍦ㄤ簬鎸囧畾鐨刄RLscriptUrl銆 鎮ㄥ彲浠ヨ缃灞炴т綔涓轰竴涓狫avaScript鑴氭湰鏂囦欢鐨勫悕绉版暟缁勩 杩欎釜灞炴т篃鍙互璁剧疆涓篺alse锛岃繖鎰忓懗鐫閮ㄤ欢灏嗕笉鍖呮嫭浠讳綍鑴氭湰鏂囦欢锛 鎴栬呬綘鏄庣‘鎸囧畾鍖呭惈鍦ㄥ埆澶勩
鍖呭惈鎵鏈塉UI 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銆 涓嶈闄勫姞浠讳綍鏂滅嚎瀛楃鐨刄RL銆
JUI涓婚鐨勫悕瀛椼傞粯璁ゆ槸鈥榖ase鈥欍傜‘淇濆湪themeUrl涓嬫湁杩欐牱涓涓洰褰曪紝 鍏跺悕绉版槸杩欎釜灞炴х殑鍊肩浉鍚岋紙鍖哄垎澶у皬鍐欙級銆
鍖呭惈鎵鏈塉UI鐨勪富棰樻枃浠跺す鐨勬牴鐩綍銆 濡傛灉娌℃湁璁剧疆杩欎釜灞炴э紙榛樿锛夛紝 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銆 涓嶈闄勫姞浠讳綍鏂滅嚎瀛楃鐨刄RL銆
鏂规硶璇︾粏
public void init()
|
public function init()
{
$this->resolvePackagePath();
$this->registerCoreScripts();
parent::init();
}
鍒濆鍖栬繖涓粍浠躲 濡傛灉鏈夊繀瑕侊紝杩欎釜鏂规硶灏嗗彂甯僇UI鐨勮祫婧愩 瀹冨皢璋冪敤jQuery鍜孞UI鐨凧avaScript鏂囦欢鍜屼富棰楥SS鏂囦欢銆 濡傛灉閲嶅啓姝ゆ柟娉曪紝纭繚浣犳渶鍏堣皟鐢ㄧ埗绫绘柟娉曘
protected void registerCoreScripts()
|
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);
}
}
娉ㄥ唽鏍稿績鐨勮剼鏈枃浠躲 姝ゆ柟娉曟敞鍐宩Query鍜孞UI鐨凧avaScript鏂囦欢鍜屼富棰楥SS鏂囦欢銆
protected void registerScriptFile(string $fileName, integer $position=2)
| ||
$fileName | string | JavaScript鏂囦欢鍚 |
$position | integer | JavaScript鏂囦欢鐨勪綅缃傛湁鏁堝煎寘鎷互涓嬶細
|
protected function registerScriptFile($fileName,$position=CClientScript::POS_END)
{
Yii::app()->getClientScript()->registerScriptFile($this->scriptUrl.'/'.$fileName,$position);
}
娉ㄥ唽涓涓狫avaScript鏂囦欢鍦scriptUrl涓嬨 璇锋敞鎰忥紝榛樿鎯呭喌涓嬶紝鑴氭湰鏂囦欢灏嗗憟鐜板湪椤靛熬锛屼互鎻愰珮椤甸潰鍔犺浇閫熷害銆
protected void resolvePackagePath()
|
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鍖呬腑骞剁敤瀹冩潵瑙e喅鎵闇鐨勮矾寰勩