00001 <?PHP
00017 include_once("ColumnText.php");
00018
00028 class ColumnImage extends ColumnText
00029 {
00036 public $m_Alt;
00037
00044 public $m_Title;
00045 public $m_ImgUrl;
00046
00053 protected function readMetaData(&$xmlArr)
00054 {
00055 parent::readMetaData($xmlArr);
00056 $this->m_Alt = isset($xmlArr["ATTRIBUTES"]["ALT"]) ? $xmlArr["ATTRIBUTES"]["ALT"] : null;
00057 $this->m_Title = isset($xmlArr["ATTRIBUTES"]["TITLE"]) ? $xmlArr["ATTRIBUTES"]["TITLE"] : null;
00058 $this->m_ImgUrl = isset($xmlArr["ATTRIBUTES"]["IMGURL"]) ? $xmlArr["ATTRIBUTES"]["IMGURL"] : '';
00059 }
00060
00066 protected function getAlt()
00067 {
00068 if ($this->m_Alt == null)
00069 return null;
00070 $formobj = $this->getFormObj();
00071 return Expression::evaluateExpression($this->m_Alt, $formobj);
00072 }
00073
00079 protected function getTitle()
00080 {
00081 if ($this->m_Title == null)
00082 return null;
00083 $formobj = $this->getFormObj();
00084 return Expression::evaluateExpression($this->m_Title, $formobj);
00085 }
00086
00092 public function render()
00093 {
00094 if(!$this->getText())
00095 {
00096 $val = ($this->m_ImgUrl) ? $this->m_ImgUrl.$this->m_Value : $this->m_Value;
00097 }else{
00098 if(preg_match("/\{RESOURCE_URL\}/si",$this->m_Text)){
00099 $val = $this->getText();
00100 }else{
00101 $val = Resource::getImageUrl()."/".$this->getText();
00102 }
00103 }
00104 if ($val == null || $val =="")
00105 return "";
00106
00107 $style = $this->getStyle();
00108 $func = $this->getFunction();
00109 $alt = $this->getAlt();
00110 $title = $this->getTitle();
00111
00112 if ($val)
00113 {
00114 if($height = $this->m_Height)
00115 {
00116 $height = 'height="' . $height . '"';
00117 }
00118
00119 if($width = $this->m_Width)
00120 {
00121 $width = 'width="' . $width . '"';
00122 }
00123
00124 $alt = 'alt="' . $alt . '"';
00125 $title = 'title="' . $title . '"';
00126
00127 if ($this->m_Link)
00128 {
00129 $link = $this->getLink();
00130 $target = $this->getTarget();
00131 $sHTML = "<a href=\"$link\" $target $func $style>" . "<img src=\"{$val}\" border=\"0\" $height $width $alt $title />" . "</a>";
00132 }
00133 else
00134 {
00135 $sHTML = "<img $style $func border=\"0\" src=\"{$val}\" $height $width $alt $title />" ;
00136 }
00137 }
00138 return $sHTML;
00139 }
00140
00141 }
00142
00143 ?>