[ Index ] |
|
Code source de PRADO 3.0.6 |
1 <?php 2 /** 3 * TImage class file. 4 * 5 * @author Qiang Xue <qiang.xue@gmail.com> 6 * @link http://www.pradosoft.com/ 7 * @copyright Copyright © 2005 PradoSoft 8 * @license http://www.pradosoft.com/license/ 9 * @version $Id: TImage.php 1397 2006-09-07 07:55:53Z wei $ 10 * @package System.Web.UI.WebControls 11 */ 12 13 /** 14 * TImage class 15 * 16 * TImage displays an image on a page. The image is specified via the 17 * {@link setImageUrl ImageUrl} property which takes a relative or absolute 18 * URL to the image file. The alignment of the image displayed is set by 19 * the {@link setImageAlign ImageAlign} property. To set alternative texts 20 * or long description of the image, use {@link setAlternateText AlternateText} 21 * or {@link setDescriptionUrl DescriptionUrl} property, respectively. 22 * 23 * @author Qiang Xue <qiang.xue@gmail.com> 24 * @version $Id: TImage.php 1397 2006-09-07 07:55:53Z wei $ 25 * @package System.Web.UI.WebControls 26 * @since 3.0 27 */ 28 class TImage extends TWebControl 29 { 30 /** 31 * @return string tag name of image control 32 */ 33 protected function getTagName() 34 { 35 return 'img'; 36 } 37 38 /** 39 * Adds attributes related to an HTML image element to renderer. 40 * @param THtmlWriter the writer used for the rendering purpose 41 */ 42 protected function addAttributesToRender($writer) 43 { 44 $writer->addAttribute('src',$this->getImageUrl()); 45 $writer->addAttribute('alt',$this->getAlternateText()); 46 if(($desc=$this->getDescriptionUrl())!=='') 47 $writer->addAttribute('longdesc',$desc); 48 if(($align=$this->getImageAlign())!=='') 49 $writer->addAttribute('align',$align); 50 if($this->getBorderWidth()==='') 51 $writer->addStyleAttribute('border-width','0px'); 52 parent::addAttributesToRender($writer); 53 } 54 55 /** 56 * Renders the body content of the image. 57 * Nothing to be rendered within image tags. 58 * @param THtmlWriter the writer for rendering 59 */ 60 public function renderContents($writer) 61 { 62 } 63 64 /** 65 * @return string the alternative text displayed in the TImage component when the image is unavailable. 66 */ 67 public function getAlternateText() 68 { 69 return $this->getViewState('AlternateText',''); 70 } 71 72 /** 73 * Sets the alternative text to be displayed in the TImage when the image is unavailable. 74 * @param string the alternative text 75 */ 76 public function setAlternateText($value) 77 { 78 $this->setViewState('AlternateText',$value,''); 79 } 80 81 /** 82 * @return string the alignment of the image with respective to other elements on the page, defaults to empty. 83 */ 84 public function getImageAlign() 85 { 86 return $this->getViewState('ImageAlign',''); 87 } 88 89 /** 90 * Sets the alignment of the image with respective to other elements on the page. 91 * Possible values include: absbottom, absmiddle, baseline, bottom, left, 92 * middle, right, texttop, and top. If an empty string is passed in, 93 * imagealign attribute will not be rendered. 94 * @param string the alignment of the image 95 */ 96 public function setImageAlign($value) 97 { 98 $this->setViewState('ImageAlign',$value,''); 99 } 100 101 /** 102 * @return string the URL of the image file 103 */ 104 public function getImageUrl() 105 { 106 return $this->getViewState('ImageUrl',''); 107 } 108 109 /** 110 * @param string the URL of the image file 111 */ 112 public function setImageUrl($value) 113 { 114 $this->setViewState('ImageUrl',$value,''); 115 } 116 117 /** 118 * @return string the URL to long description 119 */ 120 public function getDescriptionUrl() 121 { 122 return $this->getViewState('DescriptionUrl',''); 123 } 124 125 /** 126 * @param string the URL to the long description of the image. 127 */ 128 public function setDescriptionUrl($value) 129 { 130 $this->setViewState('DescriptionUrl',$value,''); 131 } 132 } 133 134 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 21:07:04 2007 | par Balluche grâce à PHPXref 0.7 |