public function btnSubmit_Click($strFormId, $strControlId, $strParameter) { $this->objGroupRegistration->DateReceived = new QDateTime(QDateTime::Now); $this->objGroupRegistration->FirstName = $this->txtFirstName->Text; $this->objGroupRegistration->LastName = $this->txtLastName->Text; $this->objGroupRegistration->Address = $this->txtAddress->Text; $this->objGroupRegistration->City = $this->txtCity->Text; $this->objGroupRegistration->Zipcode = $this->txtZipCode->Text; $this->objGroupRegistration->Email = $this->txtEmail->Text; $this->objGroupRegistration->Phone = $this->txtPhoneNumber->Text; $this->objGroupRegistration->Comments = $this->txtComments->Text; foreach (SourceList::LoadAll() as $objSourceList) { if ($objSourceList->Name == $this->lstSource->SelectedName) { $this->objGroupRegistration->SourceListId = $objSourceList->Id; break; } } $this->objGroupRegistration->Gender = $this->lstGender->SelectedName; $this->objGroupRegistration->GroupRoleId = $this->lstParticipationType->SelectedValue; $strDays = ''; foreach ($this->chkDaysAvailable as $chkDays) { if ($chkDays->Checked) { $strDays .= $chkDays->Text . ', '; } } $strDays = substr($strDays, 0, strlen($strDays) - 1); $this->objGroupRegistration->GroupDay = $strDays; $this->objGroupRegistration->PreferredLocation1 = $this->lstLocationFirst->SelectedName; $this->objGroupRegistration->PreferredLocation2 = $this->lstLocationSecond->SelectedName; $this->objGroupRegistration->Save(); foreach ($this->chkGroupType as $chkGroup) { if ($chkGroup->Checked) { $this->objGroupRegistration->AssociateGrowthGroupStructureAsGroupstructure(GrowthGroupStructure::Load($chkGroup->Name)); } } // Send Facilitator Application if user selected to be a Facilitator if ($this->lstParticipationType->SelectedName == 'Facilitator') { $this->SendMessage(); } //Send notification $this->SendNotification(); QApplication::Redirect('/success.php'); }
/** * Refresh this MetaControl with Data from the local GroupRegistrations object. * @param boolean $blnReload reload GroupRegistrations from the database * @return void */ public function Refresh($blnReload = false) { if ($blnReload) { $this->objGroupRegistrations->Reload(); } if ($this->lblId) { if ($this->blnEditMode) { $this->lblId->Text = $this->objGroupRegistrations->Id; } } if ($this->lstSourceList) { $this->lstSourceList->RemoveAllItems(); if (!$this->blnEditMode) { $this->lstSourceList->AddItem(QApplication::Translate('- Select One -'), null); } $objSourceListArray = SourceList::LoadAll(); if ($objSourceListArray) { foreach ($objSourceListArray as $objSourceList) { $objListItem = new QListItem($objSourceList->__toString(), $objSourceList->Id); if ($this->objGroupRegistrations->SourceList && $this->objGroupRegistrations->SourceList->Id == $objSourceList->Id) { $objListItem->Selected = true; } $this->lstSourceList->AddItem($objListItem); } } } if ($this->lblSourceListId) { $this->lblSourceListId->Text = $this->objGroupRegistrations->SourceList ? $this->objGroupRegistrations->SourceList->__toString() : null; } if ($this->calDateReceived) { $this->calDateReceived->DateTime = $this->objGroupRegistrations->DateReceived; } if ($this->lblDateReceived) { $this->lblDateReceived->Text = sprintf($this->objGroupRegistrations->DateReceived) ? $this->objGroupRegistrations->__toString($this->strDateReceivedDateTimeFormat) : null; } if ($this->txtFirstName) { $this->txtFirstName->Text = $this->objGroupRegistrations->FirstName; } if ($this->lblFirstName) { $this->lblFirstName->Text = $this->objGroupRegistrations->FirstName; } if ($this->txtLastName) { $this->txtLastName->Text = $this->objGroupRegistrations->LastName; } if ($this->lblLastName) { $this->lblLastName->Text = $this->objGroupRegistrations->LastName; } if ($this->txtGender) { $this->txtGender->Text = $this->objGroupRegistrations->Gender; } if ($this->lblGender) { $this->lblGender->Text = $this->objGroupRegistrations->Gender; } if ($this->txtAddress) { $this->txtAddress->Text = $this->objGroupRegistrations->Address; } if ($this->lblAddress) { $this->lblAddress->Text = $this->objGroupRegistrations->Address; } if ($this->txtPhone) { $this->txtPhone->Text = $this->objGroupRegistrations->Phone; } if ($this->lblPhone) { $this->lblPhone->Text = $this->objGroupRegistrations->Phone; } if ($this->txtEmail) { $this->txtEmail->Text = $this->objGroupRegistrations->Email; } if ($this->lblEmail) { $this->lblEmail->Text = $this->objGroupRegistrations->Email; } if ($this->txtComments) { $this->txtComments->Text = $this->objGroupRegistrations->Comments; } if ($this->lblComments) { $this->lblComments->Text = $this->objGroupRegistrations->Comments; } if ($this->lstGroupRole) { $this->lstGroupRole->RemoveAllItems(); $this->lstGroupRole->AddItem(QApplication::Translate('- Select One -'), null); $objGroupRoleArray = GroupRole::LoadAll(); if ($objGroupRoleArray) { foreach ($objGroupRoleArray as $objGroupRole) { $objListItem = new QListItem($objGroupRole->__toString(), $objGroupRole->Id); if ($this->objGroupRegistrations->GroupRole && $this->objGroupRegistrations->GroupRole->Id == $objGroupRole->Id) { $objListItem->Selected = true; } $this->lstGroupRole->AddItem($objListItem); } } } if ($this->lblGroupRoleId) { $this->lblGroupRoleId->Text = $this->objGroupRegistrations->GroupRole ? $this->objGroupRegistrations->GroupRole->__toString() : null; } if ($this->txtPreferredLocation1) { $this->txtPreferredLocation1->Text = $this->objGroupRegistrations->PreferredLocation1; } if ($this->lblPreferredLocation1) { $this->lblPreferredLocation1->Text = $this->objGroupRegistrations->PreferredLocation1; } if ($this->txtPreferredLocation2) { $this->txtPreferredLocation2->Text = $this->objGroupRegistrations->PreferredLocation2; } if ($this->lblPreferredLocation2) { $this->lblPreferredLocation2->Text = $this->objGroupRegistrations->PreferredLocation2; } if ($this->txtCity) { $this->txtCity->Text = $this->objGroupRegistrations->City; } if ($this->lblCity) { $this->lblCity->Text = $this->objGroupRegistrations->City; } if ($this->txtZipcode) { $this->txtZipcode->Text = $this->objGroupRegistrations->Zipcode; } if ($this->lblZipcode) { $this->lblZipcode->Text = $this->objGroupRegistrations->Zipcode; } if ($this->txtGroupDay) { $this->txtGroupDay->Text = $this->objGroupRegistrations->GroupDay; } if ($this->lblGroupDay) { $this->lblGroupDay->Text = $this->objGroupRegistrations->GroupDay; } if ($this->txtGroupsPlaced) { $this->txtGroupsPlaced->Text = $this->objGroupRegistrations->GroupsPlaced; } if ($this->lblGroupsPlaced) { $this->lblGroupsPlaced->Text = $this->objGroupRegistrations->GroupsPlaced; } if ($this->calDateProcessed) { $this->calDateProcessed->DateTime = $this->objGroupRegistrations->DateProcessed; } if ($this->lblDateProcessed) { $this->lblDateProcessed->Text = sprintf($this->objGroupRegistrations->DateProcessed) ? $this->objGroupRegistrations->__toString($this->strDateProcessedDateTimeFormat) : null; } if ($this->chkProcessedFlag) { $this->chkProcessedFlag->Checked = $this->objGroupRegistrations->ProcessedFlag; } if ($this->lblProcessedFlag) { $this->lblProcessedFlag->Text = $this->objGroupRegistrations->ProcessedFlag ? QApplication::Translate('Yes') : QApplication::Translate('No'); } if ($this->lstGrowthGroupStructuresAsGroupstructure) { $this->lstGrowthGroupStructuresAsGroupstructure->RemoveAllItems(); $objAssociatedArray = $this->objGroupRegistrations->GetGrowthGroupStructureAsGroupstructureArray(); $objGrowthGroupStructureArray = GrowthGroupStructure::LoadAll(); if ($objGrowthGroupStructureArray) { foreach ($objGrowthGroupStructureArray as $objGrowthGroupStructure) { $objListItem = new QListItem($objGrowthGroupStructure->__toString(), $objGrowthGroupStructure->Id); foreach ($objAssociatedArray as $objAssociated) { if ($objAssociated->Id == $objGrowthGroupStructure->Id) { $objListItem->Selected = true; } } $this->lstGrowthGroupStructuresAsGroupstructure->AddItem($objListItem); } } } if ($this->lblGrowthGroupStructuresAsGroupstructure) { $objAssociatedArray = $this->objGroupRegistrations->GetGrowthGroupStructureAsGroupstructureArray(); $strItems = array(); foreach ($objAssociatedArray as $objAssociated) { $strItems[] = $objAssociated->__toString(); } $this->lblGrowthGroupStructuresAsGroupstructure->Text = implode($strGlue, $strItems); } }