Exemplo n.º 1
0
 /**
  * Refresh this MetaControl with Data from the local SearchQuery object.
  * @param boolean $blnReload reload SearchQuery from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objSearchQuery->Reload();
     }
     if ($this->lblId) {
         if ($this->blnEditMode) {
             $this->lblId->Text = $this->objSearchQuery->Id;
         }
     }
     if ($this->txtDescription) {
         $this->txtDescription->Text = $this->objSearchQuery->Description;
     }
     if ($this->lblDescription) {
         $this->lblDescription->Text = $this->objSearchQuery->Description;
     }
     if ($this->lstSmartGroup) {
         $this->lstSmartGroup->RemoveAllItems();
         $this->lstSmartGroup->AddItem(QApplication::Translate('- Select One -'), null);
         $objSmartGroupArray = SmartGroup::LoadAll();
         if ($objSmartGroupArray) {
             foreach ($objSmartGroupArray as $objSmartGroup) {
                 $objListItem = new QListItem($objSmartGroup->__toString(), $objSmartGroup->GroupId);
                 if ($this->objSearchQuery->SmartGroup && $this->objSearchQuery->SmartGroup->GroupId == $objSmartGroup->GroupId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstSmartGroup->AddItem($objListItem);
             }
         }
     }
     if ($this->lblSmartGroupId) {
         $this->lblSmartGroupId->Text = $this->objSearchQuery->SmartGroup ? $this->objSearchQuery->SmartGroup->__toString() : null;
     }
     if ($this->lstPerson) {
         $this->lstPerson->RemoveAllItems();
         $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->objSearchQuery->Person && $this->objSearchQuery->Person->Id == $objPerson->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstPerson->AddItem($objListItem);
             }
         }
     }
     if ($this->lblPersonId) {
         $this->lblPersonId->Text = $this->objSearchQuery->Person ? $this->objSearchQuery->Person->__toString() : null;
     }
 }
Exemplo n.º 2
0
 /**
  * Refresh this MetaControl with Data from the local Group object.
  * @param boolean $blnReload reload Group from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objGroup->Reload();
     }
     if ($this->lblId) {
         if ($this->blnEditMode) {
             $this->lblId->Text = $this->objGroup->Id;
         }
     }
     if ($this->lstGroupType) {
         $this->lstGroupType->SelectedValue = $this->objGroup->GroupTypeId;
     }
     if ($this->lblGroupTypeId) {
         $this->lblGroupTypeId->Text = $this->objGroup->GroupTypeId ? GroupType::$NameArray[$this->objGroup->GroupTypeId] : null;
     }
     if ($this->lstMinistry) {
         $this->lstMinistry->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstMinistry->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objMinistryArray = Ministry::LoadAll();
         if ($objMinistryArray) {
             foreach ($objMinistryArray as $objMinistry) {
                 $objListItem = new QListItem($objMinistry->__toString(), $objMinistry->Id);
                 if ($this->objGroup->Ministry && $this->objGroup->Ministry->Id == $objMinistry->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstMinistry->AddItem($objListItem);
             }
         }
     }
     if ($this->lblMinistryId) {
         $this->lblMinistryId->Text = $this->objGroup->Ministry ? $this->objGroup->Ministry->__toString() : null;
     }
     if ($this->txtName) {
         $this->txtName->Text = $this->objGroup->Name;
     }
     if ($this->lblName) {
         $this->lblName->Text = $this->objGroup->Name;
     }
     if ($this->txtDescription) {
         $this->txtDescription->Text = $this->objGroup->Description;
     }
     if ($this->lblDescription) {
         $this->lblDescription->Text = $this->objGroup->Description;
     }
     if ($this->lstParentGroup) {
         $this->lstParentGroup->RemoveAllItems();
         $this->lstParentGroup->AddItem(QApplication::Translate('- Select One -'), null);
         $objParentGroupArray = Group::LoadAll();
         if ($objParentGroupArray) {
             foreach ($objParentGroupArray as $objParentGroup) {
                 $objListItem = new QListItem($objParentGroup->__toString(), $objParentGroup->Id);
                 if ($this->objGroup->ParentGroup && $this->objGroup->ParentGroup->Id == $objParentGroup->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstParentGroup->AddItem($objListItem);
             }
         }
     }
     if ($this->lblParentGroupId) {
         $this->lblParentGroupId->Text = $this->objGroup->ParentGroup ? $this->objGroup->ParentGroup->__toString() : null;
     }
     if ($this->txtHierarchyLevel) {
         $this->txtHierarchyLevel->Text = $this->objGroup->HierarchyLevel;
     }
     if ($this->lblHierarchyLevel) {
         $this->lblHierarchyLevel->Text = $this->objGroup->HierarchyLevel;
     }
     if ($this->txtHierarchyOrderNumber) {
         $this->txtHierarchyOrderNumber->Text = $this->objGroup->HierarchyOrderNumber;
     }
     if ($this->lblHierarchyOrderNumber) {
         $this->lblHierarchyOrderNumber->Text = $this->objGroup->HierarchyOrderNumber;
     }
     if ($this->chkConfidentialFlag) {
         $this->chkConfidentialFlag->Checked = $this->objGroup->ConfidentialFlag;
     }
     if ($this->lblConfidentialFlag) {
         $this->lblConfidentialFlag->Text = $this->objGroup->ConfidentialFlag ? QApplication::Translate('Yes') : QApplication::Translate('No');
     }
     if ($this->lstEmailBroadcastType) {
         $this->lstEmailBroadcastType->SelectedValue = $this->objGroup->EmailBroadcastTypeId;
     }
     if ($this->lblEmailBroadcastTypeId) {
         $this->lblEmailBroadcastTypeId->Text = $this->objGroup->EmailBroadcastTypeId ? EmailBroadcastType::$NameArray[$this->objGroup->EmailBroadcastTypeId] : null;
     }
     if ($this->txtToken) {
         $this->txtToken->Text = $this->objGroup->Token;
     }
     if ($this->lblToken) {
         $this->lblToken->Text = $this->objGroup->Token;
     }
     if ($this->chkActiveFlag) {
         $this->chkActiveFlag->Checked = $this->objGroup->ActiveFlag;
     }
     if ($this->lblActiveFlag) {
         $this->lblActiveFlag->Text = $this->objGroup->ActiveFlag ? QApplication::Translate('Yes') : QApplication::Translate('No');
     }
     if ($this->lstStatusObject) {
         $this->lstStatusObject->RemoveAllItems();
         $this->lstStatusObject->AddItem(QApplication::Translate('- Select One -'), null);
         $objStatusObjectArray = AvailabilityStatus::LoadAll();
         if ($objStatusObjectArray) {
             foreach ($objStatusObjectArray as $objStatusObject) {
                 $objListItem = new QListItem($objStatusObject->__toString(), $objStatusObject->Id);
                 if ($this->objGroup->StatusObject && $this->objGroup->StatusObject->Id == $objStatusObject->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstStatusObject->AddItem($objListItem);
             }
         }
     }
     if ($this->lblStatus) {
         $this->lblStatus->Text = $this->objGroup->StatusObject ? $this->objGroup->StatusObject->__toString() : null;
     }
     if ($this->lstGroupCategory) {
         $this->lstGroupCategory->RemoveAllItems();
         $this->lstGroupCategory->AddItem(QApplication::Translate('- Select One -'), null);
         $objGroupCategoryArray = GroupCategory::LoadAll();
         if ($objGroupCategoryArray) {
             foreach ($objGroupCategoryArray as $objGroupCategory) {
                 $objListItem = new QListItem($objGroupCategory->__toString(), $objGroupCategory->GroupId);
                 if ($objGroupCategory->GroupId == $this->objGroup->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstGroupCategory->AddItem($objListItem);
             }
         }
         // Because GroupCategory's GroupCategory is not null, if a value is already selected, it cannot be changed.
         if ($this->lstGroupCategory->SelectedValue) {
             $this->lstGroupCategory->Enabled = false;
         } else {
             $this->lstGroupCategory->Enabled = true;
         }
     }
     if ($this->lblGroupCategory) {
         $this->lblGroupCategory->Text = $this->objGroup->GroupCategory ? $this->objGroup->GroupCategory->__toString() : null;
     }
     if ($this->lstGrowthGroup) {
         $this->lstGrowthGroup->RemoveAllItems();
         $this->lstGrowthGroup->AddItem(QApplication::Translate('- Select One -'), null);
         $objGrowthGroupArray = GrowthGroup::LoadAll();
         if ($objGrowthGroupArray) {
             foreach ($objGrowthGroupArray as $objGrowthGroup) {
                 $objListItem = new QListItem($objGrowthGroup->__toString(), $objGrowthGroup->GroupId);
                 if ($objGrowthGroup->GroupId == $this->objGroup->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstGrowthGroup->AddItem($objListItem);
             }
         }
         // Because GrowthGroup's GrowthGroup is not null, if a value is already selected, it cannot be changed.
         if ($this->lstGrowthGroup->SelectedValue) {
             $this->lstGrowthGroup->Enabled = false;
         } else {
             $this->lstGrowthGroup->Enabled = true;
         }
     }
     if ($this->lblGrowthGroup) {
         $this->lblGrowthGroup->Text = $this->objGroup->GrowthGroup ? $this->objGroup->GrowthGroup->__toString() : null;
     }
     if ($this->lstSmartGroup) {
         $this->lstSmartGroup->RemoveAllItems();
         $this->lstSmartGroup->AddItem(QApplication::Translate('- Select One -'), null);
         $objSmartGroupArray = SmartGroup::LoadAll();
         if ($objSmartGroupArray) {
             foreach ($objSmartGroupArray as $objSmartGroup) {
                 $objListItem = new QListItem($objSmartGroup->__toString(), $objSmartGroup->GroupId);
                 if ($objSmartGroup->GroupId == $this->objGroup->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstSmartGroup->AddItem($objListItem);
             }
         }
         // Because SmartGroup's SmartGroup is not null, if a value is already selected, it cannot be changed.
         if ($this->lstSmartGroup->SelectedValue) {
             $this->lstSmartGroup->Enabled = false;
         } else {
             $this->lstSmartGroup->Enabled = true;
         }
     }
     if ($this->lblSmartGroup) {
         $this->lblSmartGroup->Text = $this->objGroup->SmartGroup ? $this->objGroup->SmartGroup->__toString() : null;
     }
 }