summaryrefslogtreecommitdiff
path: root/framework/TComponent.php
diff options
context:
space:
mode:
authorxue <>2006-02-16 22:48:18 +0000
committerxue <>2006-02-16 22:48:18 +0000
commite9bfba959b6d655ed2eba71e4f2a618237d68698 (patch)
tree7e9160367d627a13d177c104802dc343f2f32e33 /framework/TComponent.php
parenta2cf28f9759c9a1b385914ad64b4f74470f8703b (diff)
Modified asset manipulation APIs.
Diffstat (limited to 'framework/TComponent.php')
-rw-r--r--framework/TComponent.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/framework/TComponent.php b/framework/TComponent.php
index 6641fd1a..8d6be46e 100644
--- a/framework/TComponent.php
+++ b/framework/TComponent.php
@@ -474,6 +474,31 @@ class TComponent
{
return Prado::getApplication()->getUser();
}
+
+ /**
+ * Publishes a private asset and gets its URL.
+ * This method will publish a private asset (file or directory)
+ * and gets the URL to the asset. Note, if the asset refers to
+ * a directory, all contents under that directory will be published.
+ * @param string path of the asset that is relative to the directory containing the control class file.
+ * @return string URL to the asset path.
+ */
+ public function publishAsset($assetPath)
+ {
+ $class=new ReflectionClass(get_class($this));
+ $fullPath=dirname($class->getFileName()).'/'.$assetPath;
+ return $this->publishFilePath($fullPath);
+ }
+
+ /**
+ * Publishes a file or directory and returns its URL.
+ * @param string absolute path of the file or directory to be published
+ * @return string URL to the published file or directory
+ */
+ public function publishFilePath($fullPath)
+ {
+ return $this->getApplication()->getAssetManager()->publishFilePath($fullPath);
+ }
}
/**