00001 <?PHP
00002 include_once("Element.php");
00003
00004 class FormElement extends InputElement
00005 {
00006 protected $m_FormReference;
00007 protected function readMetaData(&$xmlArr)
00008 {
00009 parent::readMetaData($xmlArr);
00010 $this->m_FormReference = isset($xmlArr["ATTRIBUTES"]["FORMREFERENCE"]) ? $xmlArr["ATTRIBUTES"]["FORMREFERENCE"] : null;
00011 $this->m_RenameElementSet = isset($xmlArr["ATTRIBUTES"]["RENAMEELEMENTSET"]) ? $xmlArr["ATTRIBUTES"]["RENAMEELEMENTSET"] : 'Y';
00012 }
00013
00014 public function FormRecordCount()
00015 {
00016 if(strtoupper($this->m_RenameElementSet)!='Y'){
00017 return;
00018 }
00019 $formElementObj = BizSystem::GetObject($this->m_FormReference);
00020 if(strtolower($formElementObj->m_FormType)!='list'){
00021 return;
00022 }
00023 if(!$formElementObj->getDataObj())
00024 {
00025 return;
00026 }
00027 $count = (int)$formElementObj->getDataObj()->count();
00028 if($count<0){
00029 return;
00030 }
00031
00032 $my_elementset = $this->m_ElementSet;
00033
00034
00035 $panel = $this->getFormObj()->m_DataPanel;
00036 $panel->rewind();
00037 while($panel->valid())
00038 {
00039 $elem = $panel->current();
00040 if($elem->m_ElementSet ){
00041 if($elem->m_ElementSet == $my_elementset && !preg_match("/tab_label_count/si",$elem->m_ElementSet)){
00042 $elem->m_ElementSet.=" <span class=\"tab_label_count\">$count</span>";
00043 }
00044 }
00045 $panel->next();
00046 }
00047 }
00048
00054 public function render()
00055 {
00056 if(!$this->m_FormReference)
00057 {
00058 return null;
00059 }
00060 $formObj = $this->getFormObj();
00061 $formElementObj = BizSystem::GetObject($this->m_FormReference);
00062 $formElementObj->m_ParentFormName = $formObj->m_Name;
00063 $formElementObj->m_ParentFormElementMeta = $this->m_XMLMeta;
00064 if (method_exists($formObj,"SetSubForms"))
00065 {
00066 $formObj->setSubForms($this->m_FormReference);
00067 if($formObj->m_DataObjName){
00068 $formDataObj = BizSystem::getObject($formObj->m_DataObjName);
00069 $dataObj = $formDataObj->getRefObject($formElementObj->m_DataObjName);
00070 }
00071 if ($dataObj)
00072 $formObj->setDataObj($dataObj);
00073 }
00074 $sHTML = $formElementObj->render();
00075 $formObj->setDataObj($formDataObj);
00076 $this->FormRecordCount();
00077 if(strlen($sHTML))
00078 {
00079 $this->m_Hidden = "N";
00080 }
00081 else
00082 {
00083 $this->m_Hidden = "Y";
00084 }
00085 return $sHTML;
00086 }
00087
00088 public function setValue($value)
00089 {
00090 $formElementObj = BizSystem::GetObject($this->m_FormReference);
00091 if(method_exists($formElementObj, "setValue"))
00092 {
00093 return $formElementObj->setValue($value);
00094 }
00095 }
00096
00097 public function getValue()
00098 {
00099 $formElementObj = BizSystem::GetObject($this->m_FormReference);
00100 if(method_exists($formElementObj, "getValue"))
00101 {
00102 return $formElementObj->getValue();
00103 }
00104 }
00105 }
00106
00107 ?>