コード例 #1
0
 public function btnSave_Click($strFormId, $strControlId, $strParameter)
 {
     //Create New Group from information stored in mctGroup
     $objCloneGroup = new Group();
     // Update any fields for controls that have been created
     if ($this->mctGroup->GroupTypeIdControl) {
         $objCloneGroup->GroupTypeId = $this->mctGroup->GroupTypeIdControl->SelectedValue;
     }
     if ($this->mctGroup->MinistryIdControl) {
         $objCloneGroup->MinistryId = $this->mctGroup->MinistryIdControl->SelectedValue;
     }
     if ($this->mctGroup->NameControl) {
         $objCloneGroup->Name = $this->mctGroup->NameControl->Text;
     }
     if ($this->mctGroup->DescriptionControl) {
         $objCloneGroup->Description = $this->mctGroup->DescriptionControl->Text;
     }
     if ($this->mctGroup->ParentGroupIdControl) {
         $objCloneGroup->ParentGroupId = $this->mctGroup->ParentGroupIdControl->SelectedValue;
     }
     if ($this->mctGroup->HierarchyLevelControl) {
         $objCloneGroup->HierarchyLevel = $this->mctGroup->HierarchyLevelControl->Text;
     }
     if ($this->mctGroup->HierarchyOrderNumberControl) {
         $objCloneGroup->HierarchyOrderNumber = $this->mctGroup->HierarchyOrderNumberControl->Text;
     }
     if ($this->mctGroup->ConfidentialFlagControl) {
         $objCloneGroup->ConfidentialFlag = $this->mctGroup->ConfidentialFlagControl->Checked;
     }
     if ($this->mctGroup->EmailBroadcastTypeIdControl) {
         $objCloneGroup->EmailBroadcastTypeId = $this->mctGroup->EmailBroadcastTypeIdControl->SelectedValue;
     }
     if ($this->mctGroup->TokenControl) {
         $objCloneGroup->Token = $this->mctGroup->TokenControl->Text;
     }
     if ($this->mctGroup->ActiveFlagControl) {
         $objCloneGroup->ActiveFlag = $this->mctGroup->ActiveFlagControl->Checked;
     }
     // Update any UniqueReverseReferences (if any) for controls that have been created for it
     if ($this->mctGroup->GroupCategoryControl) {
         $objCloneGroup->GroupCategory = GroupCategory::Load($this->mctGroup->GroupCategoryControl->SelectedValue);
     }
     if ($this->mctGroup->GrowthGroupControl) {
         $objCloneGroup->GrowthGroup = GrowthGroup::Load($this->mctGroup->GrowthGroupControl->SelectedValue);
     }
     if ($this->mctGroup->SmartGroupControl) {
         $objCloneGroup->SmartGroup = SmartGroup::Load($this->mctGroup->SmartGroupControl->SelectedValue);
     }
     // Save the Cloned Group object
     $objCloneGroup->Save();
     // Get Participation List and propogate it
     $objGroupParticipationArray = $this->mctGroup->Group->GetActiveGroupParticipationArray();
     foreach ($objGroupParticipationArray as $objGroupParticipation) {
         $objCloneGroup->AddPerson(Person::Load($objGroupParticipation->PersonId), $objGroupParticipation->GroupRoleId);
     }
     Group::RefreshHierarchyDataForMinistry($objCloneGroup->MinistryId);
     $this->objForm->pnlGroups_Refresh();
     // Go to new Group.
     $this->ReturnTo('#' . $objCloneGroup->Id);
 }
コード例 #2
0
ファイル: GrowthGroupGen.class.php プロジェクト: alcf/chms
 /**
  * Reload this GrowthGroup from the database.
  * @return void
  */
 public function Reload()
 {
     // Make sure we are actually Restored from the database
     if (!$this->__blnRestored) {
         throw new QCallerException('Cannot call Reload() on a new, unsaved GrowthGroup object.');
     }
     // Reload the Object
     $objReloaded = GrowthGroup::Load($this->intGroupId);
     // Update $this's local variables to match
     $this->GroupId = $objReloaded->GroupId;
     $this->__intGroupId = $this->intGroupId;
     $this->GrowthGroupLocationId = $objReloaded->GrowthGroupLocationId;
     $this->GrowthGroupDayTypeId = $objReloaded->GrowthGroupDayTypeId;
     $this->intMeetingBitmap = $objReloaded->intMeetingBitmap;
     $this->intStartTime = $objReloaded->intStartTime;
     $this->intEndTime = $objReloaded->intEndTime;
     $this->strAddress1 = $objReloaded->strAddress1;
     $this->strAddress2 = $objReloaded->strAddress2;
     $this->strCrossStreet1 = $objReloaded->strCrossStreet1;
     $this->strCrossStreet2 = $objReloaded->strCrossStreet2;
     $this->strZipCode = $objReloaded->strZipCode;
     $this->fltLongitude = $objReloaded->fltLongitude;
     $this->fltLatitude = $objReloaded->fltLatitude;
     $this->intAccuracy = $objReloaded->intAccuracy;
     $this->strDescription = $objReloaded->strDescription;
 }
コード例 #3
0
 public function SendMessage()
 {
     $facilitatorList = array();
     $groupInfo = array();
     // Get information for each selected group
     foreach ($this->rbtnSelectArray as $rbtnSelect) {
         if ($rbtnSelect->Checked) {
             $objGroup = Group::Load($rbtnSelect->ActionParameter);
             $objGroupParticipants = GroupParticipation::LoadArrayByGroupId($objGroup->Id);
             $bFoundContact = false;
             // Check for Contact person first
             foreach ($objGroupParticipants as $objParticipant) {
                 if ($objParticipant->GroupRoleId == $this->intGroupContactRoleId && $objParticipant->DateEnd == null) {
                     $objContact = Person::Load($objParticipant->PersonId);
                     $facilitatorList[] = $objContact;
                     $bFoundContact = true;
                     break;
                 }
             }
             // If contact person not found, grab facilitator
             if (!$bFoundContact) {
                 foreach ($objGroupParticipants as $objParticipant) {
                     if ($objParticipant->GroupRoleId == $this->intFacilitatorRoleId && $objParticipant->DateEnd == null) {
                         $objFacilitator = Person::Load($objParticipant->PersonId);
                         $facilitatorList[] = $objFacilitator;
                         break;
                     }
                 }
             }
             $ggGroup = GrowthGroup::Load($rbtnSelect->ActionParameter);
             $groupInfo[] = array(trim(str_replace(range(0, 9), '', $objGroup->Name)), $ggGroup->MeetingInfo);
         }
     }
     // Set debug mode
     //QEmailServer::$TestMode = true;
     //QEmailServer::$TestModeDirectory = __DOCROOT__ . '/../file_assets/emails';
     QEmailServer::$SmtpServer = SMTP_SERVER;
     // Create a new message
     // Note that you can list multiple addresses and that Qcodo supports Bcc and Cc
     $objMessage = new QEmailMessage();
     $objMessage->From = 'Carisa Hamilton <*****@*****.**>';
     $objMessage->To = $this->objRegistrant->Email;
     $objMessage->Bcc = '*****@*****.**';
     $objMessage->Subject = 'Invitation to Growth Groups';
     // Setup Plaintext Message
     $strBody = "Dear " . $this->objRegistrant->FirstName . ",\r\n\r\n";
     $strBody .= "Thank you for your interest in Growth Groups! Below is the information for one or more Growth Groups in your area. Please contact the facilitators below for more information about visiting. I've copied them on this e-mail so that they will know of your interest.\r\n\r\n";
     $strBody .= sprintf("%s %s\r\n%s\r\n%s\r\n\r\n", $this->objRegistrant->FirstName, $this->objRegistrant->LastName, $this->objRegistrant->Phone, $this->objRegistrant->Email);
     if (count($groupInfo) >= 1) {
         if ($facilitatorList[0]->PrimaryEmailId == null) {
             $emailArray = Email::LoadArrayByPersonId($facilitatorList[0]->Id);
             $email = $emailArray[0]->Address;
             // just grab the first one we find
         } else {
             $email = Email::Load($facilitatorList[0]->PrimaryEmailId)->Address;
         }
         $strBody .= sprintf("%s, %s \r\\Contact: %s %s\r\n%s\r\n\r\n", $groupInfo[0][0], $groupInfo[0][1], $facilitatorList[0]->FirstName, $facilitatorList[0]->LastName, $email);
         $objMessage->Cc = $email;
     }
     if (count($groupInfo) >= 2) {
         if ($facilitatorList[1]->PrimaryEmailId == null) {
             $emailArray = Email::LoadArrayByPersonId($facilitatorList[1]->Id);
             $email = $emailArray[0]->Address;
             // just grab the first one we find
         } else {
             $email = Email::Load($facilitatorList[1]->PrimaryEmailId)->Address;
         }
         $strBody .= sprintf("%s, %s \r\\Contact: %s %s\r\n%s\r\n\r\n", $groupInfo[1][0], $groupInfo[1][1], $facilitatorList[1]->FirstName, $facilitatorList[1]->LastName, $email);
         $objMessage->Cc .= ', ' . $email;
     }
     if (count($groupInfo) >= 3) {
         if ($facilitatorList[1]->PrimaryEmailId == null) {
             $emailArray = Email::LoadArrayByPersonId($facilitatorList[2]->Id);
             $email = $emailArray[0]->Address;
             // just grab the first one we find
         } else {
             $email = Email::Load($facilitatorList[2]->PrimaryEmailId)->Address;
         }
         $strBody .= sprintf("%s, %s \r\\Contact: %s %s\r\n%s\r\n", $groupInfo[2][0], $groupInfo[2][1], $facilitatorList[2]->FirstName, $facilitatorList[2]->LastName, $email);
         $objMessage->Cc .= ', ' . $email;
     }
     $strBody .= '\\r\\n* Please don\'t hesitate to visit a group for 2 to 3 times before prayerfully deciding if the ' . 'group is a good fit for you.\\r\\n\\r\\n';
     $strBody .= 'Regards, \\r\\nCarisa Hamilton';
     $objMessage->Body = $strBody;
     // Also setup HTML message (optional)
     $strBody = "Dear " . $this->objRegistrant->FirstName . ',<br/><br/>';
     $strBody .= 'Thank you for your interest in Growth Groups! Below is the information for one or more Growth Groups ' . 'in your area. <br>Please contact the facilitators below for more information about visiting. ' . 'I have copied them on this e-mail so that they will know of your interest.<br><br>';
     $strBody .= sprintf("%s %s<br>%s<br>%s<br><br>", $this->objRegistrant->FirstName, $this->objRegistrant->LastName, $this->objRegistrant->Phone, $this->objRegistrant->Email);
     if (count($groupInfo) >= 1) {
         if ($facilitatorList[0]->PrimaryEmailId == null) {
             $emailArray = Email::LoadArrayByPersonId($facilitatorList[0]->Id);
             $email = $emailArray[0]->Address;
             // just grab the first one we find
         } else {
             $email = Email::Load($facilitatorList[0]->PrimaryEmailId)->Address;
         }
         $strBody .= sprintf("<b>Option 1</b><br>%s, %s<br>Contact: %s %s<br>%s<br><br>", $groupInfo[0][0], $groupInfo[0][1], $facilitatorList[0]->FirstName, $facilitatorList[0]->LastName, $email);
         $objMessage->Cc .= ', ' . $email;
     }
     if (count($groupInfo) >= 2) {
         if ($facilitatorList[1]->PrimaryEmailId == null) {
             $emailArray = Email::LoadArrayByPersonId($facilitatorList[1]->Id);
             $email = $emailArray[0]->Address;
             // just grab the first one we find
         } else {
             $email = Email::Load($facilitatorList[1]->PrimaryEmailId)->Address;
         }
         $strBody .= sprintf("<b>Option 2</b><br>%s, %s <br><b>Contact:</b> %s %s<br>%s<br><br>", $groupInfo[1][0], $groupInfo[1][1], $facilitatorList[1]->FirstName, $facilitatorList[1]->LastName, $email);
         $objMessage->Cc .= ', ' . $email;
     }
     if (count($groupInfo) >= 3) {
         if ($facilitatorList[1]->PrimaryEmailId == null) {
             $emailArray = Email::LoadArrayByPersonId($facilitatorList[2]->Id);
             $email = $emailArray[0]->Address;
             // just grab the first one we find
         } else {
             $email = Email::Load($facilitatorList[2]->PrimaryEmailId)->Address;
         }
         $strBody .= sprintf("<b>Option 3</b><br>%s, %s <br><b>Contact:</b> %s %s<br>%s<br>", $groupInfo[2][0], $groupInfo[2][1], $facilitatorList[2]->FirstName, $facilitatorList[2]->LastName, $email);
         $objMessage->Cc .= ', ' . $email;
     }
     $strBody .= '<br>* Please don\'t hesitate to visit a group for 2 to 3 times before prayerfully deciding if the ' . 'group is a good fit for you.<br><br>';
     $strBody .= 'Regards,<br/><b>Carisa Hamilton</b>';
     $objMessage->HtmlBody = $strBody;
     // Add random/custom email headers
     $objMessage->SetHeader('x-application', 'Growth Groups Ministry');
     QEmailServer::Send($objMessage);
 }
コード例 #4
0
 protected function lstGrowthGroups_Update()
 {
     if ($this->lstGrowthGroups) {
         $this->objGrowthGroupStructure->UnassociateAllGrowthGroups();
         $objSelectedListItems = $this->lstGrowthGroups->SelectedItems;
         if ($objSelectedListItems) {
             foreach ($objSelectedListItems as $objListItem) {
                 $this->objGrowthGroupStructure->AssociateGrowthGroup(GrowthGroup::Load($objListItem->Value));
             }
         }
     }
 }
コード例 #5
0
 /**
  * Static Helper Method to Create using PK arguments
  * You must pass in the PK arguments on an object to load, or leave it blank to create a new one.
  * If you want to load via QueryString or PathInfo, use the CreateFromQueryString or CreateFromPathInfo
  * static helper methods.  Finally, specify a CreateType to define whether or not we are only allowed to 
  * edit, or if we are also allowed to create a new one, etc.
  * 
  * @param mixed $objParentObject QForm or QPanel which will be using this GrowthGroupMetaControl
  * @param integer $intGroupId primary key value
  * @param QMetaControlCreateType $intCreateType rules governing GrowthGroup object creation - defaults to CreateOrEdit
  * @return GrowthGroupMetaControl
  */
 public static function Create($objParentObject, $intGroupId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit)
 {
     // Attempt to Load from PK Arguments
     if (strlen($intGroupId)) {
         $objGrowthGroup = GrowthGroup::Load($intGroupId);
         // GrowthGroup was found -- return it!
         if ($objGrowthGroup) {
             return new GrowthGroupMetaControl($objParentObject, $objGrowthGroup);
         } else {
             if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) {
                 throw new QCallerException('Could not find a GrowthGroup object with PK arguments: ' . $intGroupId);
             }
         }
         // If EditOnly is specified, throw an exception
     } else {
         if ($intCreateType == QMetaControlCreateType::EditOnly) {
             throw new QCallerException('No PK arguments specified');
         }
     }
     // If we are here, then we need to create a new record
     return new GrowthGroupMetaControl($objParentObject, new GrowthGroup());
 }
コード例 #6
0
 /**
  * This will save this object's Group instance,
  * updating only the fields which have had a control created for it.
  */
 public function SaveGroup()
 {
     try {
         // Update any fields for controls that have been created
         if ($this->lstGroupType) {
             $this->objGroup->GroupTypeId = $this->lstGroupType->SelectedValue;
         }
         if ($this->lstMinistry) {
             $this->objGroup->MinistryId = $this->lstMinistry->SelectedValue;
         }
         if ($this->txtName) {
             $this->objGroup->Name = $this->txtName->Text;
         }
         if ($this->txtDescription) {
             $this->objGroup->Description = $this->txtDescription->Text;
         }
         if ($this->lstParentGroup) {
             $this->objGroup->ParentGroupId = $this->lstParentGroup->SelectedValue;
         }
         if ($this->txtHierarchyLevel) {
             $this->objGroup->HierarchyLevel = $this->txtHierarchyLevel->Text;
         }
         if ($this->txtHierarchyOrderNumber) {
             $this->objGroup->HierarchyOrderNumber = $this->txtHierarchyOrderNumber->Text;
         }
         if ($this->chkConfidentialFlag) {
             $this->objGroup->ConfidentialFlag = $this->chkConfidentialFlag->Checked;
         }
         if ($this->lstEmailBroadcastType) {
             $this->objGroup->EmailBroadcastTypeId = $this->lstEmailBroadcastType->SelectedValue;
         }
         if ($this->txtToken) {
             $this->objGroup->Token = $this->txtToken->Text;
         }
         if ($this->chkActiveFlag) {
             $this->objGroup->ActiveFlag = $this->chkActiveFlag->Checked;
         }
         if ($this->lstStatusObject) {
             $this->objGroup->Status = $this->lstStatusObject->SelectedValue;
         }
         // Update any UniqueReverseReferences (if any) for controls that have been created for it
         if ($this->lstGroupCategory) {
             $this->objGroup->GroupCategory = GroupCategory::Load($this->lstGroupCategory->SelectedValue);
         }
         if ($this->lstGrowthGroup) {
             $this->objGroup->GrowthGroup = GrowthGroup::Load($this->lstGrowthGroup->SelectedValue);
         }
         if ($this->lstSmartGroup) {
             $this->objGroup->SmartGroup = SmartGroup::Load($this->lstSmartGroup->SelectedValue);
         }
         // Save the Group object
         $this->objGroup->Save();
         // Finally, update any ManyToManyReferences (if any)
     } catch (QCallerException $objExc) {
         $objExc->IncrementOffset();
         throw $objExc;
     }
 }