00001 <?PHP
00017 include_once("LabelText.php");
00018
00029 class LabelTextarea extends LabelText
00030 {
00036 public function render()
00037 {
00038 $value = $this->m_Text ? $this->getText() : $this->m_Value;
00039
00040 if ($value == null || $value =="")
00041 return "";
00042
00043 $style = $this->getStyle();
00044 $id = $this->m_Name;
00045 $func = $this->getFunction();
00046
00047 if ($this->m_Translatable == 'Y')
00048 $value = $this->translateString($value);
00049
00050 if((int)$this->m_MaxLength>0){
00051 if(function_exists('mb_strlen') && function_exists('mb_substr')){
00052 if(mb_strlen($value,'UTF8') > (int)$this->m_MaxLength){
00053 $value = mb_substr($value,0,(int)$this->m_MaxLength,'UTF8').'...';
00054 }
00055 }else{
00056 if(strlen($value) > (int)$this->m_MaxLength){
00057 $value = substr($value,0,(int)$this->m_MaxLength).'...';
00058 }
00059 }
00060 }
00061
00062
00063
00064
00065
00066
00067
00068 $value = htmlentities($value, ENT_QUOTES, "UTF-8");
00069 $value = str_replace("\n\n","\n<img src=\"".Resource::getImageUrl()."/spacer.gif\" style=\"display:block;height:10px;\">",$value);
00070 $value = nl2br($value);
00071
00072 if ($value!=null)
00073 {
00074 if($this->m_DisplayFormat)
00075 {
00076 $value = sprintf($this->m_DisplayFormat,$value);
00077 }
00078 if($this->m_Percent=='Y')
00079 {
00080 $value = sprintf("%.2f",$value*100).'%';
00081 }
00082
00083 if ($this->m_Link)
00084 {
00085 $link = $this->getLink();
00086 $target = $this->getTarget();
00087
00088 $sHTML = "<a id=\"$id\" href=\"$link\" $target $func $style>" . $value . "</a>";
00089 }
00090 else
00091 {
00092 $sHTML = "<span $style $func>" . $value . "</span>";
00093 }
00094 }
00095
00096 return $sHTML; }
00097
00098
00099
00100 }
00101
00102 ?>