当前位置: 首页>>代码示例>>PHP>>正文


PHP AttributeValue::LoadByAttributeIdPersonId方法代码示例

本文整理汇总了PHP中AttributeValue::LoadByAttributeIdPersonId方法的典型用法代码示例。如果您正苦于以下问题:PHP AttributeValue::LoadByAttributeIdPersonId方法的具体用法?PHP AttributeValue::LoadByAttributeIdPersonId怎么用?PHP AttributeValue::LoadByAttributeIdPersonId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AttributeValue的用法示例。


在下文中一共展示了AttributeValue::LoadByAttributeIdPersonId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: btnUnsubscribe_Click

 protected function btnUnsubscribe_Click()
 {
     $objCommunicationListEntry = CommunicationListEntry::LoadByEmail($this->txtEmail->Text);
     $objEmailArray = Email::LoadArrayByAddress($this->txtEmail->Text);
     foreach ($objEmailArray as $objEmail) {
         $objPerson = Person::LoadByPrimaryEmailId($objEmail->Id);
         if ($objPerson != null) {
             $strUnsubscribedList = '';
             $success = false;
             foreach ($this->chkBtnListArray as $objItem) {
                 if ($objItem->Checked) {
                     $this->objList = CommunicationList::LoadByToken($objItem->Name);
                     if ($this->objList) {
                         $bFound = false;
                         if ($this->objList->IsPersonAssociated($objPerson)) {
                             $this->objList->UnassociatePerson($objPerson);
                             // If church newletter is the one being unsubscribed, document reason.
                             if ($this->lstTerminationReason->SelectedValue == -1) {
                                 $objAttributeOption = new AttributeOption();
                                 $objAttributeOption->AttributeId = $this->objAttributeValue->AttributeId;
                                 $objAttributeOption->Name = trim($this->txtOther->Text);
                                 $objAttributeOption->Save();
                                 $objAttributeValue = AttributeValue::LoadByAttributeIdPersonId($this->objAttribute->Id, $objPerson->Id);
                                 if ($objAttributeValue) {
                                     $objAttributeValue->SingleAttributeOption = $objAttributeOption;
                                     $objAttributeValue->Save();
                                 } else {
                                     $objAttributeValue = new AttributeValue();
                                     $objAttributeValue->AttributeId = $this->objAttribute->Id;
                                     $objAttributeValue->PersonId = $objPerson->Id;
                                     $objAttributeValue->SingleAttributeOption = $objAttributeOption;
                                     $objAttributeValue->Save();
                                     $objPerson->AssociateAttributeValue($objAttributeValue);
                                 }
                             } else {
                                 $objAttributeValue = AttributeValue::LoadByAttributeIdPersonId($this->objAttribute->Id, $objPerson->Id);
                                 if ($objAttributeValue) {
                                     $objAttributeValue->SingleAttributeOptionId = $this->lstTerminationReason->SelectedValue;
                                     $objAttributeValue->Save();
                                 } else {
                                     $objAttributeValue = new AttributeValue();
                                     $objAttributeValue->AttributeId = $this->objAttribute->Id;
                                     $objAttributeValue->PersonId = $objPerson->Id;
                                     $objAttributeValue->SingleAttributeOptionId = $this->lstTerminationReason->SelectedValue;
                                     $objAttributeValue->Save();
                                     $objPerson->AssociateAttributeValue($objAttributeValue);
                                 }
                             }
                             $strUnsubscribedList .= $objItem->Text . ',';
                             $success = true;
                             $bFound = true;
                         }
                         if (!$bFound) {
                             $this->lblMessage->Text = '(Person Entry) You cannot Unsubscribe because you are not subscribed to the ' . $objItem->Text . ' Mailing List.';
                             $this->lblMessage->Visible = true;
                         }
                     }
                 }
             }
             if ($success) {
                 $strUnsubscribedList = substr($strUnsubscribedList, 0, strlen($strUnsubscribedList) - 1);
                 QApplication::Redirect('/unsubscribe/success.php/' . urlencode($strUnsubscribedList) . '/' . $objPerson->Id);
             }
         }
     }
     if ($objCommunicationListEntry) {
         $strUnsubscribedList = '';
         $success = false;
         $bChecked = false;
         foreach ($this->chkBtnListArray as $objItem) {
             if ($objItem->Checked) {
                 $this->objList = CommunicationList::LoadByToken($objItem->Name);
                 if ($this->objList) {
                     $bFound = false;
                     if ($objCommunicationListEntry != null) {
                         if ($this->objList->IsCommunicationListEntryAssociated($objCommunicationListEntry)) {
                             $this->objList->UnassociateCommunicationListEntry($objCommunicationListEntry);
                             $strUnsubscribedList .= $objItem->Text . ',';
                             $success = true;
                             $bFound = true;
                         }
                     }
                     if (!$bFound) {
                         $this->lblMessage->Text = '(CommunicationsEntry) You cannot Unsubscribe because you are not subscribed to the ' . $objItem->Text . ' Mailing List.';
                         $this->lblMessage->Visible = true;
                     }
                 }
             }
         }
         if ($success) {
             $strUnsubscribedList = substr($strUnsubscribedList, 0, strlen($strUnsubscribedList) - 1);
             QApplication::Redirect('/unsubscribe/success.php/' . urlencode($strUnsubscribedList));
         }
     }
     $bChecked = false;
     foreach ($this->chkBtnListArray as $objItem) {
         if ($objItem->Checked) {
             $bChecked = true;
             break;
         }
//.........这里部分代码省略.........
开发者ID:alcf,项目名称:chms,代码行数:101,代码来源:index.php

示例2: MergeWith

 /**
  * Merges two records together.
  * @param Person $objPersonMergeWith
  * @param boolean $blnUseThisDetails boolean on whether to use this person's Person object details, or if false, use the PersonMergeWith's
  */
 public function MergeWith(Person $objPersonMergeWith, $blnUseThisDetails)
 {
     QLog::Log(sprintf('Merging %s (ID %s) with %s (ID %s) - %s', $this->Name, $this->Id, $objPersonMergeWith->Name, $objPersonMergeWith->Id, $blnUseThisDetails ? 'left' : 'right'));
     Person::GetDatabase()->TransactionBegin();
     // Household Participation Records
     if ($this->HouseholdAsHead && $objPersonMergeWith->HouseholdAsHead) {
         $this->HouseholdAsHead->MergeHousehold($objPersonMergeWith->HouseholdAsHead, $this);
     } else {
         if ($this->HouseholdAsHead) {
             // Go through each MergeWith HouseholdParticipation -- Throw if it's another household, Delete if it's this Household-as-Head
             foreach ($objPersonMergeWith->GetHouseholdParticipationArray() as $objHouseholdParticipation) {
                 if ($objHouseholdParticipation->HouseholdId != $this->HouseholdAsHead->Id) {
                     throw new QCallerException('Cannot merge this head of household with a person record that exists in other households');
                 } else {
                     $objHouseholdParticipation->Delete();
                 }
             }
         } else {
             if ($objHousehold = $objPersonMergeWith->HouseholdAsHead) {
                 // Go through each of this's HouseholdParticipation -- Throw if it's another household, Delete if it's MergeWith's Household-as-Head
                 foreach ($this->GetHouseholdParticipationArray() as $objHouseholdParticipation) {
                     if ($objHouseholdParticipation->HouseholdId != $objPersonMergeWith->HouseholdAsHead->Id) {
                         throw new QCallerException('Cannot merge MergeWith head of household with this person record which exists in other households');
                     } else {
                         $objHouseholdParticipation->Delete();
                     }
                 }
                 $objHousehold->HeadPerson = $this;
                 $objHousehold->Save();
                 $objParticipation = HouseholdParticipation::LoadByPersonIdHouseholdId($objPersonMergeWith->Id, $objHousehold->Id);
                 $objParticipation->PersonId = $this->Id;
                 $objParticipation->Save();
             } else {
                 // Otherwise: members of multiple households! but head of none
                 foreach ($objPersonMergeWith->GetHouseholdParticipationArray() as $objHouseholdParticipation) {
                     if (HouseholdParticipation::LoadByPersonIdHouseholdId($this->Id, $objHouseholdParticipation->HouseholdId)) {
                         $objHouseholdParticipation->Delete();
                     } else {
                         $objHouseholdParticipation->PersonId = $this->Id;
                         $objHouseholdParticipation->Save();
                     }
                 }
             }
         }
     }
     if (!$blnUseThisDetails) {
         $this->FirstName = $objPersonMergeWith->FirstName;
         $this->MiddleName = $objPersonMergeWith->MiddleName;
         $this->LastName = $objPersonMergeWith->LastName;
         $this->MailingLabel = $objPersonMergeWith->MailingLabel;
         $this->PriorLastNames = $objPersonMergeWith->PriorLastNames;
         $this->Nickname = $objPersonMergeWith->Nickname;
         $this->Title = $objPersonMergeWith->Title;
         $this->Suffix = $objPersonMergeWith->Suffix;
         $this->Gender = $objPersonMergeWith->Gender;
         $this->DateOfBirth = $objPersonMergeWith->DateOfBirth;
         $this->DobYearApproximateFlag = $objPersonMergeWith->DobYearApproximateFlag;
         $this->DobGuessedFlag = $objPersonMergeWith->DobGuessedFlag;
         $this->Age = $objPersonMergeWith->Age;
         $this->DeceasedFlag = $objPersonMergeWith->DeceasedFlag;
         $this->DateDeceased = $objPersonMergeWith->DateDeceased;
     }
     // Attributes
     foreach ($objPersonMergeWith->GetAttributeValueArray() as $objAttributeValue) {
         // Check for double-defined attributes
         if ($objDoubleDefinedAttribute = AttributeValue::LoadByAttributeIdPersonId($objAttributeValue->AttributeId, $this->Id)) {
             if ($blnUseThisDetails) {
                 $objAttributeValue->Delete();
             } else {
                 $objDoubleDefinedAttribute->Delete();
                 $objAttributeValue->PersonId = $this->Id;
                 $objAttributeValue->Save();
             }
             // Nothing double-defined -- just move it over!
         } else {
             $objAttributeValue->PersonId = $this->Id;
             $objAttributeValue->Save();
         }
     }
     // Comments
     foreach ($objPersonMergeWith->GetCommentArray() as $objComment) {
         $objComment->PersonId = $this->Id;
         $objComment->Save();
     }
     // Memberships
     foreach ($objPersonMergeWith->GetMembershipArray() as $objMembership) {
         $objMembership->PersonId = $this->Id;
         $objMembership->Save();
     }
     // Communication Lists
     foreach ($objPersonMergeWith->GetCommunicationListArray() as $objCommList) {
         $objPersonMergeWith->UnassociateCommunicationList($objCommList);
         if (!$this->IsCommunicationListAssociated($objCommList)) {
             $this->AssociateCommunicationList($objCommList);
         }
//.........这里部分代码省略.........
开发者ID:alcf,项目名称:chms,代码行数:101,代码来源:Person.class.php

示例3: SetupPanel

 protected function SetupPanel()
 {
     $this->objAttributeValue = AttributeValue::LoadByAttributeIdPersonId($this->strUrlHashArgument, $this->objPerson->Id);
     if (!$this->objAttributeValue) {
         $this->objAttributeValue = new AttributeValue();
         $this->objAttributeValue->AttributeId = $this->strUrlHashArgument;
         $this->objAttributeValue->Person = $this->objPerson;
     } else {
         $this->btnDelete = new QLinkButton($this);
         $this->btnDelete->Text = 'Delete';
         $this->btnDelete->CssClass = 'delete';
         $this->btnDelete->AddAction(new QClickEvent(), new QConfirmAction('Are you SURE you want to DELETE this attribute?'));
         $this->btnDelete->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnDelete_Click'));
         $this->btnDelete->AddAction(new QClickEvent(), new QTerminateAction());
     }
     switch ($this->objAttributeValue->Attribute->AttributeDataTypeId) {
         case AttributeDataType::Checkbox:
             $this->chkValue = new QRadioButtonList($this);
             $this->chkValue->Name = $this->objAttributeValue->Attribute->Name;
             $this->chkValue->Required = true;
             $this->chkValue->AddItem('Yes', true, $this->objAttributeValue->BooleanValue === true);
             $this->chkValue->AddItem('No', false, $this->objAttributeValue->BooleanValue === false);
             break;
         case AttributeDataType::Date:
         case AttributeDataType::DateTime:
             $this->dtxValue = new QDateTimeTextBox($this);
             $this->dtxValue->Name = $this->objAttributeValue->Attribute->Name;
             $this->dtxValue->Required = true;
             if ($this->objAttributeValue->Attribute->AttributeDataTypeId == AttributeDataType::Date) {
                 $this->dtxValue->Text = $this->objAttributeValue->DateValue ? $this->objAttributeValue->DateValue->ToString() : null;
             } else {
                 $this->dtxValue->Text = $this->objAttributeValue->DatetimeValue ? $this->objAttributeValue->DatetimeValue->ToString() : null;
             }
             $this->calValue = new QCalendar($this, $this->dtxValue);
             $this->dtxValue->RemoveAllActions(QClickEvent::EventName);
             break;
         case AttributeDataType::Text:
             $this->txtValue = new QTextBox($this);
             $this->txtValue->Name = $this->objAttributeValue->Attribute->Name;
             $this->txtValue->Required = true;
             $this->txtValue->TextMode = QTextMode::MultiLine;
             $this->txtValue->Text = trim($this->objAttributeValue->TextValue);
             $this->txtValue->FontNames = QFontFamily::Arial;
             $this->txtValue->FontSize = '11px';
             $this->txtValue->Width = '400px';
             $this->txtValue->Height = '200px';
             break;
         case AttributeDataType::ImmutableSingleDropdown:
             $this->lstValue = new QListBox($this);
             $this->lstValue->Name = $this->objAttributeValue->Attribute->Name;
             $this->lstValue->Required = true;
             if (!$this->objAttributeValue->SingleAttributeOptionId) {
                 $this->lstValue->AddItem('- Select One -');
             }
             foreach ($this->objAttributeValue->Attribute->GetAttributeOptionArray(QQ::OrderBy(QQN::AttributeOption()->Name)) as $objOption) {
                 $this->lstValue->AddItem($objOption->Name, $objOption->Id, $objOption->Id == $this->objAttributeValue->SingleAttributeOptionId);
             }
             break;
         case AttributeDataType::ImmutableMultipleDropdown:
             $this->lstValue = new QListBox($this);
             $this->lstValue->Name = $this->objAttributeValue->Attribute->Name;
             $this->lstValue->Required = true;
             $this->lstValue->SelectionMode = QSelectionMode::Multiple;
             $this->lstValue->Width = '200px';
             $this->lstValue->Height = '200px';
             $intSelectedIdArray = array();
             if ($this->objAttributeValue->Id) {
                 foreach ($this->objAttributeValue->GetAttributeOptionAsMultipleArray() as $objOption) {
                     $intSelectedIdArray[$objOption->Id] = $objOption->Id;
                 }
             }
             foreach ($this->objAttributeValue->Attribute->GetAttributeOptionArray(QQ::OrderBy(QQN::AttributeOption()->Name)) as $objOption) {
                 $this->lstValue->AddItem($objOption->Name, $objOption->Id, array_key_exists($objOption->Id, $intSelectedIdArray));
             }
             break;
         case AttributeDataType::MutableSingleDropdown:
             $this->lstValue = new QListBox($this);
             $this->lstValue->Name = $this->objAttributeValue->Attribute->Name;
             $this->lstValue->Required = true;
             if (!$this->objAttributeValue->SingleAttributeOptionId) {
                 $this->lstValue->AddItem('- Select One -');
             }
             foreach ($this->objAttributeValue->Attribute->GetAttributeOptionArray(QQ::OrderBy(QQN::AttributeOption()->Name)) as $objOption) {
                 $this->lstValue->AddItem($objOption->Name, $objOption->Id, $objOption->Id == $this->objAttributeValue->SingleAttributeOptionId);
             }
             $this->lstValue->AddItem('- Other... -', -1);
             $this->txtAddItem = new QTextBox($this);
             $this->txtAddItem->Name = 'Add a Value';
             $this->txtAddItem->Visible = false;
             $this->lstValue->AddAction(new QChangeEvent(), new QAjaxControlAction($this, 'lstValue_Change'));
             $this->txtAddItem->AddAction(new QEnterKeyEvent(), new QTerminateAction());
             break;
         case AttributeDataType::MutableMultipleDropdown:
             $this->lstValue = new QListBox($this);
             $this->lstValue->Name = $this->objAttributeValue->Attribute->Name;
             $this->lstValue->Required = true;
             $this->lstValue->SelectionMode = QSelectionMode::Multiple;
             $this->lstValue->Width = '200px';
             $this->lstValue->Height = '200px';
             $intSelectedIdArray = array();
//.........这里部分代码省略.........
开发者ID:alcf,项目名称:chms,代码行数:101,代码来源:Vicp_Attributes_Edit.class.php

示例4: btnEditAttribute_Click

 public function btnEditAttribute_Click($strFormId, $strControlId, $strParameter)
 {
     $paramArray = explode("_", $strParameter);
     // First, remove all children panels from pnlRight
     $this->pnlRight->Display = "block";
     $this->pnlRight->DisplayStyle = "block";
     $this->pnlRight->RemoveChildControls(true);
     // Determine where to display the panel
     $range = 1;
     if ($paramArray[3] < 5) {
         $range = 1;
     } elseif ($paramArray[3] < 15) {
         $range = 2;
     } else {
         $range = 3;
     }
     $height = $this->iAttributeCount / $range * 35;
     $this->strAttributeHeight = sprintf("-%dpx", $height);
     $this->pnlRight->Top = $this->strAttributeHeight;
     // Now create a new AttributeEditPanel, setting pnlRight as its parent
     // and specifying parent form's "CloseRightPanel" as the method callback
     // See the note in _constructor, above, for more information
     /*new Vicp_Attributes_Edit($this->pnlRight, null, $this->objPerson,$this->strUrlHashArgument);*/
     // Test to see if it works
     // Special case for Co-Primary. If co-primary, then ensure there is a date of birth
     if ($paramArray[2] == 'Co-Primary' && !$this->objPerson->DateOfBirth) {
         $this->lblTitle = new QLabel($this->pnlRight);
         $this->lblTitle->HtmlEntities = false;
         $this->lblTitle->Text = "You cannot specify a Co-primary email unless the person has a Date Of Birth specified. <br>Please ensure that this is the case before setting this attribute.";
     } else {
         $this->objAttributeValue = AttributeValue::LoadByAttributeIdPersonId($strParameter, $this->objPerson->Id);
         if (!$this->objAttributeValue) {
             $this->objAttributeValue = new AttributeValue();
             $this->objAttributeValue->AttributeId = $paramArray[0];
             $this->objAttributeValue->Person = $this->objPerson;
             $this->objAttributeValue->Attribute = Attribute::Load($paramArray[0]);
         }
         // Determine what to display
         $this->lblTitle = new QLabel($this->pnlRight);
         $this->lblTitle->Text = $paramArray[2];
         if ($paramArray[2] == 'Co-Primary') {
             $this->lblTitle->HtmlEntities = false;
             $this->lblTitle->Text .= '<br>Please not that the Co-Primary email entered MUST be an existing person in noah.';
         }
         $this->lblTitle->CssClass = 'attributeLbl';
         switch ($paramArray[1]) {
             case AttributeDataType::Checkbox:
                 $this->chkValue = new QRadioButtonList($this->pnlRight);
                 $this->chkValue->Name = $paramArray[2];
                 $this->chkValue->Required = true;
                 $this->chkValue->AddItem('Yes', true, $this->objAttributeValue->BooleanValue === true);
                 $this->chkValue->AddItem('No', false, $this->objAttributeValue->BooleanValue === false);
                 break;
             case AttributeDataType::Date:
             case AttributeDataType::DateTime:
                 $this->dtxValue = new QDateTimeTextBox($this->pnlRight);
                 $this->dtxValue->Name = $paramArray[2];
                 $this->dtxValue->Required = true;
                 $this->calValue = new QCalendar($this->pnlRight, $this->dtxValue);
                 $this->dtxValue->RemoveAllActions(QClickEvent::EventName);
                 if ($this->objAttributeValue->Attribute->AttributeDataTypeId == AttributeDataType::Date) {
                     $this->dtxValue->Text = $this->objAttributeValue->DateValue ? $this->objAttributeValue->DateValue->ToString() : null;
                 } else {
                     $this->dtxValue->Text = $this->objAttributeValue->DatetimeValue ? $this->objAttributeValue->DatetimeValue->ToString() : null;
                 }
                 break;
             case AttributeDataType::Text:
                 $this->txtValue = new QTextBox($this->pnlRight);
                 $this->txtValue->Name = $paramArray[2];
                 $this->txtValue->Required = true;
                 $this->txtValue->TextMode = QTextMode::MultiLine;
                 $this->txtValue->Text = trim($this->objAttributeValue->TextValue);
                 $this->txtValue->FontNames = QFontFamily::Arial;
                 $this->txtValue->FontSize = '11px';
                 $this->txtValue->Width = '380px';
                 $this->txtValue->Height = '200px';
                 break;
             case AttributeDataType::ImmutableSingleDropdown:
                 $this->lstValue = new QListBox($this->pnlRight);
                 $this->lstValue->Name = $paramArray[2];
                 $this->lstValue->Required = true;
                 if (!$this->objAttributeValue->SingleAttributeOptionId) {
                     $this->lstValue->AddItem('- Select One -');
                 }
                 foreach ($this->objAttributeValue->Attribute->GetAttributeOptionArray(QQ::OrderBy(QQN::AttributeOption()->Name)) as $objOption) {
                     $this->lstValue->AddItem($objOption->Name, $objOption->Id, $objOption->Id == $this->objAttributeValue->SingleAttributeOptionId);
                 }
                 break;
             case AttributeDataType::ImmutableMultipleDropdown:
                 $this->lstValue = new QListBox($this->pnlRight);
                 $this->lstValue->Name = $paramArray[2];
                 $this->lstValue->Required = true;
                 $this->lstValue->SelectionMode = QSelectionMode::Multiple;
                 $this->lstValue->Width = '200px';
                 $this->lstValue->Height = '200px';
                 $intSelectedIdArray = array();
                 if ($this->objAttributeValue->Id) {
                     foreach ($this->objAttributeValue->GetAttributeOptionAsMultipleArray() as $objOption) {
                         $intSelectedIdArray[$objOption->Id] = $objOption->Id;
                     }
//.........这里部分代码省略.........
开发者ID:alcf,项目名称:chms,代码行数:101,代码来源:Vicp_Attributes_Add.class.php


注:本文中的AttributeValue::LoadByAttributeIdPersonId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。