00001 <?php 00002 include_once ('ColumnBar.php'); 00003 class LabelBar extends ColumnBar { 00004 public function render(){ 00005 $value = $this->m_Text ? $this->getText() : $this->m_Value; 00006 if($this->m_Color) 00007 { 00008 $formObj = $this->getFormObj(); 00009 $color = Expression::evaluateExpression($this->m_Color, $formObj); 00010 if(!$color){ 00011 $color = '33b5fb'; 00012 } 00013 $bgcolor_str = "background-color: #".$color.";"; 00014 }else{ 00015 $bgcolor_str = "background-color: #33b5fb;"; 00016 } 00017 00018 if($this->m_DisplayFormat) 00019 { 00020 $value = sprintf($this->m_DisplayFormat,$value); 00021 } 00022 if($this->m_Percent=='Y') 00023 { 00024 $value = sprintf("%.2f",$value*100).'%'; 00025 } 00026 $style = $this->getStyle(); 00027 $id = $this->m_Name; 00028 $func = $this->getFunction(); 00029 $height = $this->m_Height; 00030 $width = $this->m_Width - 80; 00031 $max_value = Expression::evaluateExpression($this->m_MaxValue, $this->getFormObj()); 00032 00033 $width_rate = ($value/$max_value); 00034 00035 if($width_rate>1){ 00036 $width_rate=1; 00037 } 00038 $width_bar = (int)($width * $width_rate); 00039 00040 if(!preg_match("/MSIE 6/si",$_SERVER['HTTP_USER_AGENT'])){ 00041 $bar_overlay="<span class=\"bar_data_bg\" style=\"".$bgcolor_str."height:".$height."px;width:".$width_bar."px;\"></span>"; 00042 $bar = "<span class=\"bar_data\" style=\"".$bgcolor_str."height:".$height."px;width:".$width_bar."px;\"></span>"; 00043 }else{ 00044 $bar = "<span class=\"bar_data\" style=\"".$bgcolor_str."height:".$height."px;width:".$width_bar."px;opacity: 0.4;filter: alpha(opacity=40);\"></span>"; 00045 } 00046 00047 $sHTML = " 00048 <span id=\"$id\" $func $style > 00049 00050 <span class=\"bar_bg\" style=\"height:".$height."px;width:".$width."px;\"> 00051 $bar_overlay 00052 $bar 00053 </span> 00054 00055 <span class=\"value\" style=\"text-align:left;text-indent:10px;\">$value".$this->m_DisplayUnit."</span> 00056 </span> 00057 "; 00058 return $sHTML; 00059 } 00060 } 00061 ?>