コード例 #1
0
 public function btnSave_Click($strFormId, $strControlId, $strParameter)
 {
     $objPerson = $this->pnlPerson->Person;
     // Validate the Dates
     $dttDateArray = GroupParticipation::GetParticipationDatesArrayForPersonIdGroupIdGroupRoleId($objPerson->Id, $this->objGroup->Id, $this->lstRole->SelectedValue);
     // Add This One
     $dttDateArray[] = array($this->dtxDateStart->DateTime, $this->dtxDateEnd->DateTime);
     // If we have trouble trying to add it, let's redirect the user to the full record
     if (!GroupParticipation::IsValidDates($dttDateArray)) {
         QApplication::DisplayAlert('You are adding a participation that already exists.  Taking you to this person\'s record for more information.');
         return $this->ReturnTo('#' . $this->objGroup->Id . '/edit_participation/' . $objPerson->Id);
     }
     // Go ahead and create the record
     $this->objGroup->AddPerson($objPerson, $this->lstRole->SelectedValue, $this->dtxDateStart->DateTime, $this->dtxDateEnd->DateTime);
     return $this->ReturnTo('#' . $this->objGroup->Id);
 }
コード例 #2
0
ファイル: GroupCategory.class.php プロジェクト: alcf/chms
 /**
  * Called to refresh the list of participations for this GroupCategory
  */
 public function RefreshParticipationList()
 {
     $fltTime = microtime(true);
     GroupParticipation::GetDatabase()->NonQuery('DELETE FROM group_participation WHERE group_id=' . $this->intGroupId);
     $objPersonArray = array();
     foreach ($this->Group->GetThisAndChildren() as $objGroup) {
         if ($objGroup->GroupTypeId != GroupType::GroupCategory) {
             foreach ($objGroup->GetGroupParticipationArray() as $objParticipation) {
                 $objPersonArray[$objParticipation->PersonId] = $objParticipation->Person;
             }
         }
     }
     foreach ($objPersonArray as $objPerson) {
         $this->Group->AddPerson($objPerson, null);
     }
     $intTime = round((microtime(true) - $fltTime) * 1000);
     $this->DateRefreshed = QDateTime::Now();
     $this->ProcessTimeMs = $intTime;
     $this->Save();
 }
コード例 #3
0
 /**
  * Retrieves an array of array of dates (which can be used for IsValidDates for a given
  * Person, Group and GroupRole
  * 
  * @param integer $intPersonId
  * @param integer $intGroupId
  * @param integer $intGroupRoleId
  * @return QDateTime[][]
  */
 public static function GetParticipationDatesArrayForPersonIdGroupIdGroupRoleId($intPersonId, $intGroupId, $intGroupRoleId)
 {
     $objParticipationArray = GroupParticipation::QueryArray(QQ::AndCondition(QQ::Equal(QQN::GroupParticipation()->PersonId, $intPersonId), QQ::Equal(QQN::GroupParticipation()->GroupId, $intGroupId), QQ::Equal(QQN::GroupParticipation()->GroupRoleId, $intGroupRoleId)), QQ::OrderBy(QQN::GroupParticipation()->DateStart));
     $dttArrayToReturn = array();
     foreach ($objParticipationArray as $objParticipation) {
         $dttArrayToReturn[] = array($objParticipation->DateStart, $objParticipation->DateEnd);
     }
     return $dttArrayToReturn;
 }
コード例 #4
0
ファイル: PersonGen.class.php プロジェクト: alcf/chms
    /**
     * Deletes all associated GroupParticipations
     * @return void
     */
    public function DeleteAllGroupParticipations()
    {
        if (is_null($this->intId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateGroupParticipation on this unsaved Person.');
        }
        // Get the Database Object for this Class
        $objDatabase = Person::GetDatabase();
        // Journaling
        if ($objDatabase->JournalingDatabase) {
            foreach (GroupParticipation::LoadArrayByPersonId($this->intId) as $objGroupParticipation) {
                $objGroupParticipation->Journal('DELETE');
            }
        }
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`group_participation`
				WHERE
					`person_id` = ' . $objDatabase->SqlVariable($this->intId) . '
			');
    }
コード例 #5
0
ファイル: Vicp_Groups.class.php プロジェクト: alcf/chms
 public function RenderGroupRoles(Group $objGroup)
 {
     $this->objParticipationArray = GroupParticipation::LoadArrayByPersonIdGroupId($this->objPerson->Id, $objGroup->Id, QQ::OrderBy(QQN::GroupParticipation()->GroupRole->Name, QQN::GroupParticipation()->DateStart));
     $strCurrentRole = null;
     $strArray = array();
     foreach ($this->objParticipationArray as $objParticipation) {
         if ($strCurrentRole != $objParticipation->GroupRole->Name) {
             $strCurrentRole = $objParticipation->GroupRole->Name;
             $strArray[] = QApplication::HtmlEntities($strCurrentRole);
         } else {
             $strArray[] = ' ';
         }
     }
     return implode('<br/>', $strArray);
 }
コード例 #6
0
 /**
  * Main utility method to aid with data binding.  It is used by the default BindAllRows() databinder but
  * could and should be used by any custom databind methods that would be used for instances of this
  * MetaDataGrid, by simply passing in a custom QQCondition and/or QQClause. 
  *
  * If a paginator is set on this DataBinder, it will use it.  If not, then no pagination will be used.
  * It will also perform any sorting (if applicable).
  *
  * @param QQCondition $objConditions override the default condition of QQ::All() to the query, itself
  * @param QQClause[] $objOptionalClauses additional optional QQClause object or array of QQClause objects for the query		 
  * @return void
  */
 public function MetaDataBinder(QQCondition $objCondition = null, $objOptionalClauses = null)
 {
     // Setup input parameters to default values if none passed in
     if (!$objCondition) {
         $objCondition = QQ::All();
     }
     $objClauses = $objOptionalClauses ? $objOptionalClauses : array();
     // We need to first set the TotalItemCount, which will affect the calcuation of LimitClause below
     if ($this->Paginator) {
         $this->TotalItemCount = GroupParticipation::QueryCount($objCondition, $objClauses);
     }
     // If a column is selected to be sorted, and if that column has a OrderByClause set on it, then let's add
     // the OrderByClause to the $objClauses array
     if ($objClause = $this->OrderByClause) {
         array_push($objClauses, $objClause);
     }
     // Add the LimitClause information, as well
     if ($objClause = $this->LimitClause) {
         array_push($objClauses, $objClause);
     }
     // Set the DataSource to be a Query result from GroupParticipation, given the clauses above
     $this->DataSource = GroupParticipation::QueryArray($objCondition, $objClauses);
 }
コード例 #7
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 GroupParticipationMetaControl
  * @param integer $intId primary key value
  * @param QMetaControlCreateType $intCreateType rules governing GroupParticipation object creation - defaults to CreateOrEdit
  * @return GroupParticipationMetaControl
  */
 public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit)
 {
     // Attempt to Load from PK Arguments
     if (strlen($intId)) {
         $objGroupParticipation = GroupParticipation::Load($intId);
         // GroupParticipation was found -- return it!
         if ($objGroupParticipation) {
             return new GroupParticipationMetaControl($objParentObject, $objGroupParticipation);
         } else {
             if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) {
                 throw new QCallerException('Could not find a GroupParticipation object with PK arguments: ' . $intId);
             }
         }
         // 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 GroupParticipationMetaControl($objParentObject, new GroupParticipation());
 }
コード例 #8
0
ファイル: Group.class.php プロジェクト: alcf/chms
 /**
  * Calculates whether or not a given Person object is allowed to send emails
  * to this Group email list.  Return true if the Person can.  Returns false
  * if the Person is not allowed to OR if there is no Email List for this Group.
  * @param Person $objPerson
  * @return boolean
  */
 public function IsPersonCanSendEmail(Person $objPerson)
 {
     switch ($this->intEmailBroadcastTypeId) {
         case EmailBroadcastType::PublicList:
             return true;
         case EmailBroadcastType::PrivateList:
             foreach (GroupParticipation::LoadArrayByPersonIdGroupId($objPerson->Id, $this->intId) as $objParticipation) {
                 if (!$objParticipation->DateEnd || $objParticipation->DateEnd->IsLaterThan(QDateTime::Now())) {
                     return true;
                 }
             }
             return false;
         case EmailBroadcastType::AnnouncementOnly:
             $objLogin = Login::LoadByEmail($objPerson->PrimaryEmail->Address);
             if ($objLogin) {
                 if ($objLogin->IsMinistryAssociated($this->Ministry)) {
                     return true;
                 } else {
                     return false;
                 }
             }
             return false;
         default:
             return false;
     }
 }
コード例 #9
0
ファイル: CpGroup_Base.class.php プロジェクト: alcf/chms
 public function RenderCurrentGroups(Person $objPerson)
 {
     $this->objParticipations = GroupParticipation::QueryArray(QQ::AndCondition(QQ::Equal(QQN::GroupParticipation()->PersonId, $objPerson->Id), QQ::IsNull(QQN::GroupParticipation()->DateEnd), QQ::In(QQN::GroupParticipation()->GroupId, $this->intGroupIdArray)), QQ::Clause(QQ::OrderBy(QQN::GroupParticipation()->Group->Name), QQ::Expand(QQN::GroupParticipation()->Group->Name)));
     $strArray = array();
     foreach ($this->objParticipations as $objParticipation) {
         $strArray[] = $objParticipation->Group->Name;
     }
     if (count($strArray)) {
         return implode(' and ', $strArray);
     } else {
         return '<span style="font-size: 10px; color: #999;">No current groups</span>';
     }
 }
コード例 #10
0
 public static function GetSoapArrayFromArray($objArray)
 {
     if (!$objArray) {
         return null;
     }
     $objArrayToReturn = array();
     foreach ($objArray as $objObject) {
         array_push($objArrayToReturn, GroupParticipation::GetSoapObjectFromObject($objObject, true));
     }
     return unserialize(serialize($objArrayToReturn));
 }
コード例 #11
0
ファイル: EmailRoutingTest.php プロジェクト: alcf/chms
 public function SetUp()
 {
     $this->objMinistry = Ministry::LoadByToken('ert');
     if (!$this->objMinistry) {
         $this->objMinistry = new Ministry();
         $this->objMinistry->Token = 'ert';
     }
     $this->objMinistry->Name = 'Test Ministry';
     $this->objMinistry->ActiveFlag = true;
     $this->objMinistry->Save();
     if ($objGroupRoleArray = $this->objMinistry->GetGroupRoleArray()) {
         $this->objGroupRole = $objGroupRoleArray[0];
     } else {
         $this->objGroupRole = new GroupRole();
         $this->objGroupRole->Ministry = $this->objMinistry;
         $this->objGroupRole->Name = 'ERT';
         $this->objGroupRole->GroupRoleTypeId = GroupRoleType::Participant;
         $this->objGroupRole->Save();
     }
     $this->objLoginLeader = Login::LoadByUsername('ert1');
     if (!$this->objLoginLeader) {
         $this->objLoginLeader = new Login();
         $this->objLoginLeader->Username = '******';
     } else {
         $this->objLoginLeader->UnassociateAllMinistries();
     }
     $this->objLoginLeader->RoleTypeId = RoleType::StaffMember;
     $this->objLoginLeader->Email = '*****@*****.**';
     $this->objLoginLeader->Save();
     $this->objLoginLeader->AssociateMinistry($this->objMinistry);
     $this->objLoginNonLeader = Login::LoadByUsername('ert2');
     if (!$this->objLoginNonLeader) {
         $this->objLoginNonLeader = new Login();
         $this->objLoginNonLeader->Username = '******';
     } else {
         $this->objLoginNonLeader->UnassociateAllMinistries();
     }
     $this->objLoginNonLeader->RoleTypeId = RoleType::StaffMember;
     $this->objLoginNonLeader->Email = '*****@*****.**';
     $this->objLoginNonLeader->Save();
     $this->objPersonArray = array();
     $this->objPersonArray['ert1'] = Person::CreatePerson('Test', 'E', 'User', true, '*****@*****.**', null, null);
     $this->objPersonArray['ert2'] = Person::CreatePerson('Test', 'E', 'User', true, '*****@*****.**', null, null);
     $this->objPersonArray['ert3'] = Person::CreatePerson('Test', 'E', 'User', true, '*****@*****.**', null, null);
     $objPerson = Person::CreatePerson('Test', 'E', 'User', true, null, null, null);
     $objEmail = new Email();
     $objEmail->Address = '*****@*****.**';
     $objEmail->Person = $objPerson;
     $objEmail->Save();
     $this->objPersonArray['ert4'] = $objPerson;
     $objPerson = Person::CreatePerson('Test', 'E', 'User', true, null, null, null);
     $objEmail = new Email();
     $objEmail->Address = '*****@*****.**';
     $objEmail->Person = $objPerson;
     $objEmail->Save();
     $objEmail = new Email();
     $objEmail->Address = '*****@*****.**';
     $objEmail->Person = $objPerson;
     $objEmail->Save();
     $this->objPersonArray['ert5'] = $objPerson;
     $this->objGroup1 = Group::LoadByToken('ert1');
     if (!$this->objGroup1) {
         $this->objGroup1 = new Group();
         $this->objGroup1->Token = 'ert1';
     }
     $this->objGroup1->GroupTypeId = GroupType::RegularGroup;
     $this->objGroup1->Ministry = $this->objMinistry;
     $this->objGroup1->EmailBroadcastTypeId = EmailBroadcastType::PrivateList;
     $this->objGroup1->Name = 'ERT Test Group 1';
     $this->objGroup1->Save();
     $this->objGroup2 = Group::LoadByToken('ert2');
     if (!$this->objGroup2) {
         $this->objGroup2 = new Group();
         $this->objGroup2->Token = 'ert2';
     }
     $this->objGroup2->GroupTypeId = GroupType::RegularGroup;
     $this->objGroup2->Ministry = $this->objMinistry;
     $this->objGroup2->EmailBroadcastTypeId = EmailBroadcastType::AnnouncementOnly;
     $this->objGroup2->Name = 'ERT Test Group 2';
     $this->objGroup2->Save();
     $this->objGroup1->DeleteAllGroupParticipations();
     $this->objGroup2->DeleteAllGroupParticipations();
     $objParticipation = new GroupParticipation();
     $objParticipation->Person = $this->objPersonArray['ert1'];
     $objParticipation->Group = $this->objGroup1;
     $objParticipation->GroupRole = $this->objGroupRole;
     $objParticipation->DateStart = new QDateTime('2005-01-01');
     $objParticipation->Save();
     $objParticipation = new GroupParticipation();
     $objParticipation->Person = $this->objPersonArray['ert1'];
     $objParticipation->Group = $this->objGroup2;
     $objParticipation->GroupRole = $this->objGroupRole;
     $objParticipation->DateStart = new QDateTime('2005-01-01');
     $objParticipation->Save();
 }
コード例 #12
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);
 }
コード例 #13
0
 public function btnSave_Click($strFormId, $strControlId, $strParameter)
 {
     $objArrayToDelete = array();
     foreach (GroupParticipation::LoadArrayByPersonIdGroupId($this->pnlContent->objPerson->Id, $this->pnlContent->objGroup->Id) as $objParticipation) {
         $objArrayToDelete[$objParticipation->Id] = $objParticipation;
     }
     // Save all the participation records
     foreach ($this->objParticipationArray as $objParticipation) {
         $objParticipation->Save();
         if (array_key_exists($objParticipation->Id, $objArrayToDelete)) {
             unset($objArrayToDelete[$objParticipation->Id]);
         }
     }
     // Delete any that are supposed to be deleted
     foreach ($objArrayToDelete as $objParticipation) {
         $objParticipation->Delete();
     }
     // Update groupAuthorizedSender table
     if ($this->chkIsAuthorizedSender->Checked && !GroupAuthorizedSender::LoadByGroupIdPersonId($this->pnlContent->objGroup->Id, $this->pnlContent->objPerson->Id)) {
         $objGroupAuthorizedSender = new GroupAuthorizedSender();
         $objGroupAuthorizedSender->GroupId = $this->pnlContent->objGroup->Id;
         $objGroupAuthorizedSender->PersonId = $this->pnlContent->objPerson->Id;
         $objGroupAuthorizedSender->Save();
     } else {
         if (!$this->chkIsAuthorizedSender->Checked) {
             $objGroupAuthorizedSender = GroupAuthorizedSender::LoadByGroupIdPersonId($this->pnlContent->objGroup->Id, $this->pnlContent->objPerson->Id);
             if ($objGroupAuthorizedSender) {
                 $objGroupAuthorizedSender->Delete();
             }
         }
     }
     $this->pnlContent->ReturnTo($this->strReturnUrl);
 }