00001 <?PHP 00017 include_once("OptionElement.php"); 00018 00028 class LabelList extends OptionElement 00029 { 00030 public $m_BlankOption; 00031 00038 protected function readMetaData(&$xmlArr) 00039 { 00040 parent::readMetaData($xmlArr); 00041 $this->m_Link = isset($xmlArr["ATTRIBUTES"]["LINK"]) ? $xmlArr["ATTRIBUTES"]["LINK"] : null; 00042 $this->m_BlankOption = isset($xmlArr["ATTRIBUTES"]["BLANKOPTION"]) ? $xmlArr["ATTRIBUTES"]["BLANKOPTION"] : null; 00043 } 00049 protected function getLink() 00050 { 00051 if ($this->m_Link == null) 00052 return null; 00053 $formobj = $this->getFormObj(); 00054 return Expression::evaluateExpression($this->m_Link, $formobj); 00055 } 00056 00062 public function render() 00063 { 00064 $fromList = array(); 00065 $this->getFromList($fromList); 00066 $valueArr = explode(',', $this->m_Value); 00067 $style = $this->getStyle(); 00068 $func = $this->getFunction(); 00069 $id = $this->m_Name; 00070 $selectedStr = ''; 00071 00072 $selectedStr = $this->m_Value; 00073 00074 foreach ($fromList as $option) 00075 { 00076 $test = array_search($option['val'], $valueArr); 00077 if (!($test === false)) 00078 { 00079 $selectedStr = $option['txt'] ; 00080 break; 00081 } 00082 } 00083 00084 if($selectedStr=="0" || $selectedStr==null){ 00085 $selectedStr = $this->m_BlankOption; 00086 } 00087 00088 if ($this->getLink()) 00089 { 00090 $link = $this->getLink(); 00091 $sHTML = "<a id=\"$id\" href=\"$link\" $func $style>" . $selectedStr . "</a>"; 00092 } 00093 else 00094 $sHTML = "<span $func $style>" . $selectedStr . "</span>"; 00095 00096 if($this->m_BackgroundColor) 00097 { 00098 $bgcolor = $this->getBackgroundColor(); 00099 if($bgcolor){ 00100 $sHTML = "<div style=\"background-color:#".$bgcolor.";text-indent:10px;\" >$sHTML</div>"; 00101 } 00102 } 00103 return $sHTML; 00104 } 00105 } 00106 ?>