コード例 #1
0
 /**
  * Refresh this MetaControl with Data from the local OtherContactInfo object.
  * @param boolean $blnReload reload OtherContactInfo from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objOtherContactInfo->Reload();
     }
     if ($this->lblId) {
         if ($this->blnEditMode) {
             $this->lblId->Text = $this->objOtherContactInfo->Id;
         }
     }
     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->objOtherContactInfo->Person && $this->objOtherContactInfo->Person->Id == $objPerson->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstPerson->AddItem($objListItem);
             }
         }
     }
     if ($this->lblPersonId) {
         $this->lblPersonId->Text = $this->objOtherContactInfo->Person ? $this->objOtherContactInfo->Person->__toString() : null;
     }
     if ($this->lstOtherContactMethod) {
         $this->lstOtherContactMethod->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstOtherContactMethod->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objOtherContactMethodArray = OtherContactMethod::LoadAll();
         if ($objOtherContactMethodArray) {
             foreach ($objOtherContactMethodArray as $objOtherContactMethod) {
                 $objListItem = new QListItem($objOtherContactMethod->__toString(), $objOtherContactMethod->Id);
                 if ($this->objOtherContactInfo->OtherContactMethod && $this->objOtherContactInfo->OtherContactMethod->Id == $objOtherContactMethod->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstOtherContactMethod->AddItem($objListItem);
             }
         }
     }
     if ($this->lblOtherContactMethodId) {
         $this->lblOtherContactMethodId->Text = $this->objOtherContactInfo->OtherContactMethod ? $this->objOtherContactInfo->OtherContactMethod->__toString() : null;
     }
     if ($this->txtValue) {
         $this->txtValue->Text = $this->objOtherContactInfo->Value;
     }
     if ($this->lblValue) {
         $this->lblValue->Text = $this->objOtherContactInfo->Value;
     }
 }