/** * Refresh this MetaControl with Data from the local FormAnswer object. * @param boolean $blnReload reload FormAnswer from the database * @return void */ public function Refresh($blnReload = false) { if ($blnReload) { $this->objFormAnswer->Reload(); } if ($this->lblId) { if ($this->blnEditMode) { $this->lblId->Text = $this->objFormAnswer->Id; } } if ($this->lstSignupEntry) { $this->lstSignupEntry->RemoveAllItems(); if (!$this->blnEditMode) { $this->lstSignupEntry->AddItem(QApplication::Translate('- Select One -'), null); } $objSignupEntryArray = SignupEntry::LoadAll(); if ($objSignupEntryArray) { foreach ($objSignupEntryArray as $objSignupEntry) { $objListItem = new QListItem($objSignupEntry->__toString(), $objSignupEntry->Id); if ($this->objFormAnswer->SignupEntry && $this->objFormAnswer->SignupEntry->Id == $objSignupEntry->Id) { $objListItem->Selected = true; } $this->lstSignupEntry->AddItem($objListItem); } } } if ($this->lblSignupEntryId) { $this->lblSignupEntryId->Text = $this->objFormAnswer->SignupEntry ? $this->objFormAnswer->SignupEntry->__toString() : null; } if ($this->lstFormQuestion) { $this->lstFormQuestion->RemoveAllItems(); if (!$this->blnEditMode) { $this->lstFormQuestion->AddItem(QApplication::Translate('- Select One -'), null); } $objFormQuestionArray = FormQuestion::LoadAll(); if ($objFormQuestionArray) { foreach ($objFormQuestionArray as $objFormQuestion) { $objListItem = new QListItem($objFormQuestion->__toString(), $objFormQuestion->Id); if ($this->objFormAnswer->FormQuestion && $this->objFormAnswer->FormQuestion->Id == $objFormQuestion->Id) { $objListItem->Selected = true; } $this->lstFormQuestion->AddItem($objListItem); } } } if ($this->lblFormQuestionId) { $this->lblFormQuestionId->Text = $this->objFormAnswer->FormQuestion ? $this->objFormAnswer->FormQuestion->__toString() : null; } if ($this->txtTextValue) { $this->txtTextValue->Text = $this->objFormAnswer->TextValue; } if ($this->lblTextValue) { $this->lblTextValue->Text = $this->objFormAnswer->TextValue; } if ($this->lstAddress) { $this->lstAddress->RemoveAllItems(); $this->lstAddress->AddItem(QApplication::Translate('- Select One -'), null); $objAddressArray = Address::LoadAll(); if ($objAddressArray) { foreach ($objAddressArray as $objAddress) { $objListItem = new QListItem($objAddress->__toString(), $objAddress->Id); if ($this->objFormAnswer->Address && $this->objFormAnswer->Address->Id == $objAddress->Id) { $objListItem->Selected = true; } $this->lstAddress->AddItem($objListItem); } } } if ($this->lblAddressId) { $this->lblAddressId->Text = $this->objFormAnswer->Address ? $this->objFormAnswer->Address->__toString() : null; } if ($this->lstPhone) { $this->lstPhone->RemoveAllItems(); $this->lstPhone->AddItem(QApplication::Translate('- Select One -'), null); $objPhoneArray = Phone::LoadAll(); if ($objPhoneArray) { foreach ($objPhoneArray as $objPhone) { $objListItem = new QListItem($objPhone->__toString(), $objPhone->Id); if ($this->objFormAnswer->Phone && $this->objFormAnswer->Phone->Id == $objPhone->Id) { $objListItem->Selected = true; } $this->lstPhone->AddItem($objListItem); } } } if ($this->lblPhoneId) { $this->lblPhoneId->Text = $this->objFormAnswer->Phone ? $this->objFormAnswer->Phone->__toString() : null; } if ($this->lstEmail) { $this->lstEmail->RemoveAllItems(); $this->lstEmail->AddItem(QApplication::Translate('- Select One -'), null); $objEmailArray = Email::LoadAll(); if ($objEmailArray) { foreach ($objEmailArray as $objEmail) { $objListItem = new QListItem($objEmail->__toString(), $objEmail->Id); if ($this->objFormAnswer->Email && $this->objFormAnswer->Email->Id == $objEmail->Id) { $objListItem->Selected = true; } $this->lstEmail->AddItem($objListItem); } } } if ($this->lblEmailId) { $this->lblEmailId->Text = $this->objFormAnswer->Email ? $this->objFormAnswer->Email->__toString() : null; } if ($this->txtIntegerValue) { $this->txtIntegerValue->Text = $this->objFormAnswer->IntegerValue; } if ($this->lblIntegerValue) { $this->lblIntegerValue->Text = $this->objFormAnswer->IntegerValue; } if ($this->chkBooleanValue) { $this->chkBooleanValue->Checked = $this->objFormAnswer->BooleanValue; } if ($this->lblBooleanValue) { $this->lblBooleanValue->Text = $this->objFormAnswer->BooleanValue ? QApplication::Translate('Yes') : QApplication::Translate('No'); } if ($this->calDateValue) { $this->calDateValue->DateTime = $this->objFormAnswer->DateValue; } if ($this->lblDateValue) { $this->lblDateValue->Text = sprintf($this->objFormAnswer->DateValue) ? $this->objFormAnswer->__toString($this->strDateValueDateTimeFormat) : null; } }