summaryrefslogtreecommitdiff
path: root/framework/Web/UI
diff options
context:
space:
mode:
authorxue <>2005-11-12 18:17:58 +0000
committerxue <>2005-11-12 18:17:58 +0000
commit8a4e5a9b04c479fa027acfba52f4d68cf3bd6679 (patch)
tree461c326e7a2a82a998e329e29b1b28c65d1be7db /framework/Web/UI
parent63386d118321bbff8af2d8c480b89fe226400d53 (diff)
Added asset manager.
Diffstat (limited to 'framework/Web/UI')
-rw-r--r--framework/Web/UI/TControl.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/framework/Web/UI/TControl.php b/framework/Web/UI/TControl.php
index a3d3c93a..65993664 100644
--- a/framework/Web/UI/TControl.php
+++ b/framework/Web/UI/TControl.php
@@ -69,6 +69,10 @@ class TControl extends TComponent
* prefix to an ID automatically generated
*/
const AUTOMATIC_ID_PREFIX='ctl';
+ /**
+ * default control asset path
+ */
+ const ASSET_PATH='assets';
/**
* the stage of lifecycles that the control is currently at
@@ -270,6 +274,28 @@ class TControl extends TComponent
return Prado::getApplication()->getUser();
}
+ public function publishFile($file)
+ {
+ return Prado::getApplication()->getService()->getAssetManager()->publishFile($file);
+ }
+
+ public function publishDirectory($directory)
+ {
+ return Prado::getApplication()->getService()->getAssetManager()->publishDirectory($directory);
+ }
+
+ public function getAsset($assetName)
+ {
+ $class=new ReflectionClass(get_class($this));
+ $assetFile=dirname($class->getFileName()).'/'.self::ASSET_PATH.'/'.$assetName;
+ if(is_file($assetFile))
+ return $this->publishFile($assetFile);
+ else if(is_dir($assetFile))
+ return $this->publishDirectory($assetFile);
+ else
+ return '';
+ }
+
/**
* Returns the id of the control.
* Control ID can be either manually set or automatically generated.