/** * Refresh this MetaControl with Data from the local Marriage object. * @param boolean $blnReload reload Marriage from the database * @return void */ public function Refresh($blnReload = false) { if ($blnReload) { $this->objMarriage->Reload(); } if ($this->lblId) { if ($this->blnEditMode) { $this->lblId->Text = $this->objMarriage->Id; } } if ($this->lstLinkedMarriage) { $this->lstLinkedMarriage->RemoveAllItems(); $this->lstLinkedMarriage->AddItem(QApplication::Translate('- Select One -'), null); $objLinkedMarriageArray = Marriage::LoadAll(); if ($objLinkedMarriageArray) { foreach ($objLinkedMarriageArray as $objLinkedMarriage) { $objListItem = new QListItem($objLinkedMarriage->__toString(), $objLinkedMarriage->Id); if ($this->objMarriage->LinkedMarriage && $this->objMarriage->LinkedMarriage->Id == $objLinkedMarriage->Id) { $objListItem->Selected = true; } $this->lstLinkedMarriage->AddItem($objListItem); } } } if ($this->lblLinkedMarriageId) { $this->lblLinkedMarriageId->Text = $this->objMarriage->LinkedMarriage ? $this->objMarriage->LinkedMarriage->__toString() : null; } if ($this->lstPerson) { $this->lstPerson->RemoveAllItems(); if (!$this->blnEditMode) { $this->lstPerson->AddItem(QApplication::Translate('- Select One -'), null); } $objPersonArray = Person::LoadAll(); if ($objPersonArray) { foreach ($objPersonArray as $objPerson) { $objListItem = new QListItem($objPerson->__toString(), $objPerson->Id); if ($this->objMarriage->Person && $this->objMarriage->Person->Id == $objPerson->Id) { $objListItem->Selected = true; } $this->lstPerson->AddItem($objListItem); } } } if ($this->lblPersonId) { $this->lblPersonId->Text = $this->objMarriage->Person ? $this->objMarriage->Person->__toString() : null; } if ($this->lstMarriedToPerson) { $this->lstMarriedToPerson->RemoveAllItems(); $this->lstMarriedToPerson->AddItem(QApplication::Translate('- Select One -'), null); $objMarriedToPersonArray = Person::LoadAll(); if ($objMarriedToPersonArray) { foreach ($objMarriedToPersonArray as $objMarriedToPerson) { $objListItem = new QListItem($objMarriedToPerson->__toString(), $objMarriedToPerson->Id); if ($this->objMarriage->MarriedToPerson && $this->objMarriage->MarriedToPerson->Id == $objMarriedToPerson->Id) { $objListItem->Selected = true; } $this->lstMarriedToPerson->AddItem($objListItem); } } } if ($this->lblMarriedToPersonId) { $this->lblMarriedToPersonId->Text = $this->objMarriage->MarriedToPerson ? $this->objMarriage->MarriedToPerson->__toString() : null; } if ($this->lstMarriageStatusType) { $this->lstMarriageStatusType->SelectedValue = $this->objMarriage->MarriageStatusTypeId; } if ($this->lblMarriageStatusTypeId) { $this->lblMarriageStatusTypeId->Text = $this->objMarriage->MarriageStatusTypeId ? MarriageStatusType::$NameArray[$this->objMarriage->MarriageStatusTypeId] : null; } if ($this->calDateStart) { $this->calDateStart->DateTime = $this->objMarriage->DateStart; } if ($this->lblDateStart) { $this->lblDateStart->Text = sprintf($this->objMarriage->DateStart) ? $this->objMarriage->__toString($this->strDateStartDateTimeFormat) : null; } if ($this->calDateEnd) { $this->calDateEnd->DateTime = $this->objMarriage->DateEnd; } if ($this->lblDateEnd) { $this->lblDateEnd->Text = sprintf($this->objMarriage->DateEnd) ? $this->objMarriage->__toString($this->strDateEndDateTimeFormat) : null; } if ($this->lstMarriageAsLinked) { $this->lstMarriageAsLinked->RemoveAllItems(); $this->lstMarriageAsLinked->AddItem(QApplication::Translate('- Select One -'), null); $objMarriageArray = Marriage::LoadAll(); if ($objMarriageArray) { foreach ($objMarriageArray as $objMarriage) { $objListItem = new QListItem($objMarriage->__toString(), $objMarriage->Id); if ($objMarriage->LinkedMarriageId == $this->objMarriage->Id) { $objListItem->Selected = true; } $this->lstMarriageAsLinked->AddItem($objListItem); } } } if ($this->lblMarriageAsLinked) { $this->lblMarriageAsLinked->Text = $this->objMarriage->MarriageAsLinked ? $this->objMarriage->MarriageAsLinked->__toString() : null; } }