EYui / EYuiWidget.php

 * EYuiWidget class file.
 *	Base class for all EYui Widgets.
 * @author Christian Salazar <>
 * @link
 * @license
abstract class EYuiWidget extends CWidget {

	public $themeUrl;
	public $theme='base';
	public $jqueryUiCssFile='jquery-ui.css';

	private $_baseUrl;
	private $_debug;
	private $_defaultAction='index.php?r=site/eyui';
	public function init(){	
		this will translate messages using this source:
	public static function t($text){
		return Yii::t("EYuiWidget.eyui",$text);
	* Informs about _debug state. 
	* it produces registerCoreScripts to read assets directly from sources.
	public function getIsDebug(){
		return ($this->_debug==true);
	* set debug mode.
	public function setDebug($flag=true){
		$this->_debug = $flag;
	* returns the default action used for communication pruposes
	public function getDefaultAction(){
		return $this->_defaultAction;

		detects if a given instance implements the required interface name
	protected function implementsInterface($modelInstance,$requiredInterface){
		if($_impl = class_implements($modelInstance))
				throw new Exception(
				self::t("Sorry, the provided instance does not implements the required interface: ")
	* Register the core scripts common for every extended widget from this class.
	* Registered: jQuery and assets directory.
	public function registerCoreScripts(){
		$localAssetsDir = dirname(__FILE__) . "/" . 'assets';
		$this->_baseUrl = Yii::app()->getAssetManager()->publish($localAssetsDir);
        $cs = Yii::app()->getClientScript();
			//$this->_baseUrl = $localAssetsDir;
			$this->_baseUrl = 'protected/extensions/eyui/assets';
		foreach(scandir($localAssetsDir) as $f){
			$_f = strtolower($f);
		// jquery-ui
		if($this->themeUrl == null)
			$this->themeUrl = $this->_baseUrl;
		Helper method to provide a stored resource
	public function getResource($fileName){
		return $this->_baseUrl."/".$fileName;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.