[ Index ]
 

Code source de PRADO 3.0.6

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/framework/Web/UI/WebControls/ -> TStyleSheet.php (source)

   1  <?php
   2  /**
   3   * TStyleSheet class file.
   4   *
   5   * @author Wei Zhuo <weizhuo[at]gmail[dot]com>
   6   * @link http://www.pradosoft.com/
   7   * @copyright Copyright &copy; 2005 PradoSoft
   8   * @license http://www.pradosoft.com/license/
   9   * @version $Id: TStyleSheet.php 1397 2006-09-07 07:55:53Z wei $
  10   * @package System.Web.UI.WebControls
  11   */
  12  
  13  /**
  14   * TStyleSheet class.
  15   *
  16   * TStyleSheet represents the link to a stylesheet file and/or a piece of
  17   * stylesheet code. To specify the link to a CSS file, set {@link setStyleSheetUrl StyleSheetUrl}.
  18   * The child rendering result of TStyleSheet is treated as CSS code and
  19   * is rendered within an appropriate style HTML element.
  20   * Therefore, if the child content is not empty, you should place the TStyleSheet
  21   * control in the head section of your page to conform to the HTML standard.
  22   * If only CSS file URL is specified, you may place the control anywhere on your page
  23   * and the style element will be rendered in the right position.
  24   *
  25   * @author Wei Zhuo <weizhuo[at]gmail[dot]com>
  26   * @version : $  Tue Jul  4 04:38:16 EST 2006 $
  27   * @package System.Web.UI.WebControls
  28   * @since 3.0.2
  29   */
  30  class TStyleSheet extends TControl
  31  {
  32      /**
  33       * @param string URL to the stylesheet file
  34       */
  35  	public function setStyleSheetUrl($value)
  36      {
  37          $this->setViewState('StyleSheetUrl', $value);
  38      }
  39  
  40      /**
  41       * @return string URL to the stylesheet file
  42       */
  43  	public function getStyleSheetUrl()
  44      {
  45          return $this->getViewState('StyleSheetUrl', '');
  46      }
  47  
  48      /**
  49       * @return string media type of the CSS (such as 'print', 'screen', etc.). Defaults to empty, meaning the CSS applies to all media types.
  50       */
  51  	public function getMediaType()
  52      {
  53          return $this->getViewState('MediaType','');
  54      }
  55  
  56      /**
  57       * @param string media type of the CSS (such as 'print', 'screen', etc.). If empty, it means the CSS applies to all media types.
  58       */
  59  	public function setMediaType($value)
  60      {
  61          $this->setViewState('MediaType',$value,'');
  62      }
  63  
  64      /**
  65       * Registers the stylesheet file and content to be rendered.
  66       * This method overrides the parent implementation and is invoked right before rendering.
  67       * @param mixed event parameter
  68       */
  69  	public function onPreRender($param)
  70      {
  71          if(($url=$this->getStyleSheetUrl())!=='')
  72              $this->getPage()->getClientScript()->registerStyleSheetFile($url,$url,$this->getMediaType());
  73      }
  74  
  75      /**
  76       * Renders the control.
  77       * This method overrides the parent implementation and renders nothing.
  78       * @param ITextWriter writer
  79       */
  80  	public function render($writer)
  81      {
  82          if($this->getHasControls())
  83          {
  84              $writer->write("<style type=\"text/css\">\n/*<![CDATA[*/\n");
  85              $this->renderChildren($writer);
  86              $writer->write("\n/*]]>*/\n</style>\n");
  87          }
  88      }
  89  }
  90  
  91  ?>


Généré le : Sun Feb 25 21:07:04 2007 par Balluche grâce à PHPXref 0.7