diff options
author | xue <> | 2006-07-04 23:25:41 +0000 |
---|---|---|
committer | xue <> | 2006-07-04 23:25:41 +0000 |
commit | 9cc6b7fffd31f4b9ee9aceef9224c84dcf28aeb8 (patch) | |
tree | d3d6d907278b06feef3fc77c14d2231cfbff1125 /framework/Web/UI/WebControls/TStyleSheet.php | |
parent | 2cf86eb80ae66da86eb2e37f0f99b2035241d3ae (diff) |
Merge from 3.0 branch till 1239.
Diffstat (limited to 'framework/Web/UI/WebControls/TStyleSheet.php')
-rw-r--r-- | framework/Web/UI/WebControls/TStyleSheet.php | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/framework/Web/UI/WebControls/TStyleSheet.php b/framework/Web/UI/WebControls/TStyleSheet.php new file mode 100644 index 00000000..02ac40cd --- /dev/null +++ b/framework/Web/UI/WebControls/TStyleSheet.php @@ -0,0 +1,78 @@ +<?php +/** + * TStyleSheet class file. + * + * @author Wei Zhuo <weizhuo[at]gmail[dot]com> + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2005 PradoSoft + * @license http://www.pradosoft.com/license/ + * @version $Revision: $ $Date: $ + * @package System.Web.UI.WebControls + */ + +/** + * TStyleSheet class. + * + * TStyleSheet represents the link to a stylesheet file and/or a piece of + * stylesheet code. To specify the link to a CSS file, set {@link setStyleSheetUrl StyleSheetUrl}. + * The child rendering result of TStyleSheet is treated as CSS code and + * is rendered within an appropriate style HTML element. + * Therefore, if the child content is not empty, you should place the TStyleSheet + * control in the head section of your page to conform to the HTML standard. + * If only CSS file URL is specified, you may place the control anywhere on your page + * and the style element will be rendered in the right position. + * + * @author Wei Zhuo <weizhuo[at]gmail[dot]com> + * @version : $ Tue Jul 4 04:38:16 EST 2006 $ + * @package System.Web.UI.WebControl + * @since 3.0.2 + */ +class TStyleSheet extends TControl +{ + /** + * @param string URL to the stylesheet file + */ + public function setStyleSheetUrl($value) + { + $this->setViewState('StyleSheetUrl', $value); + } + + /** + * @return string URL to the stylesheet file + */ + public function getStyleSheetUrl() + { + return $this->getViewState('StyleSheetUrl', ''); + } + + /** + * Registers the stylesheet file and content to be rendered. + * This method overrides the parent implementation and is invoked right before rendering. + * @param mixed event parameter + */ + public function onPreRender($param) + { + if($this->getEnabled(true)) + { + if(($url=$this->getStyleSheetUrl())!=='') + $this->getPage()->getClientScript()->registerStyleSheetFile($url,$url); + } + } + + /** + * Renders the control. + * This method overrides the parent implementation and renders nothing. + * @param ITextWriter writer + */ + public function render($writer) + { + if($this->getHasControls()) + { + $writer->write("<style type=\"text/css\">\n/*<![CDATA[*/\n"); + $this->renderChildren($writer); + $writer->write("\n/*]]>*/\n</style>\n"); + } + } +} + +?>
\ No newline at end of file |