本文整理匯總了PHP中AttributeValue::Save方法的典型用法代碼示例。如果您正苦於以下問題:PHP AttributeValue::Save方法的具體用法?PHP AttributeValue::Save怎麽用?PHP AttributeValue::Save使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類AttributeValue
的用法示例。
在下文中一共展示了AttributeValue::Save方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: SetAttribute
/**
* Sets an attribute value for this person.
* Data Type of $mixValue is dependent on the Data Type for the attribute being set.
* @param Attribute $objAttribute
* @param mixed $mixValue
* @return AttributeValue
*/
public function SetAttribute(Attribute $objAttribute, $mixValue)
{
$objValue = AttributeValue::LoadByAttributeIdPersonId($objAttribute->Id, $this->intId);
if (!$objValue) {
$objValue = new AttributeValue();
$objValue->Attribute = $objAttribute;
$objValue->Person = $this;
}
switch ($objAttribute->AttributeDataTypeId) {
case AttributeDataType::Text:
$objValue->TextValue = $mixValue;
break;
case AttributeDataType::Checkbox:
$objValue->BooleanValue = $mixValue;
break;
case AttributeDataType::Date:
$objValue->DateValue = $mixValue;
break;
case AttributeDataType::ImmutableSingleDropdown:
case AttributeDataType::MutableSingleDropdown:
$objValue->SingleAttributeOption = $mixValue;
break;
case AttributeDataType::ImmutableMultipleDropdown:
case AttributeDataType::MutableMultipleDropdown:
$objValue->Save();
$objValue->UnassociateAllAttributeOptionsAsMultiple();
foreach ($mixValue as $objOption) {
$objValue->AssociateAttributeOptionAsMultiple($objOption);
}
break;
default:
throw new Exception('Unhandled Attribute Data Type');
}
$objValue->Save();
return $objValue;
}
示例2: 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;
}
//.........這裏部分代碼省略.........
示例3: SaveAttribute
protected function SaveAttribute()
{
if ($this->txtAttributePreviousChurch != null && $this->txtAttributeOccupation->Text != "") {
$objAttributeValue = new AttributeValue();
$objAttribute = Attribute::QuerySingle(QQ::Equal(QQN::Attribute()->Name, "Previous Church"));
$objAttributeValue->AttributeId = $objAttribute->Id;
$objAttributeValue->PersonId = $this->mctPerson->Person->Id;
$objAttributeValue->TextValue = $this->txtAttributePreviousChurch->Text;
$objAttributeValue->DatetimeValue = QDateTime::Now();
$objAttributeValue->Save();
}
if ($this->txtAttributeOccupation != null && $this->txtAttributeOccupation->Text != "") {
$objAttributeValue = new AttributeValue();
$objAttribute = Attribute::QuerySingle(QQ::Equal(QQN::Attribute()->Name, "Occupation"));
$objAttributeValue->AttributeId = $objAttribute->Id;
$objAttributeValue->PersonId = $this->mctPerson->Person->Id;
$objAttributeValue->TextValue = $this->txtAttributeOccupation->Text;
$objAttributeValue->DatetimeValue = QDateTime::Now();
$objAttributeValue->Save();
}
if ($this->lstAttributeMethodJoin != null && $this->lstAttributeMethodJoin->SelectedName != '- Select One -') {
$objAttributeValue = new AttributeValue();
$objAttribute = Attribute::QuerySingle(QQ::Equal(QQN::Attribute()->Name, "Method of Joining ALCF"));
$objAttributeValue->AttributeId = $objAttribute->Id;
$objAttributeValue->PersonId = $this->mctPerson->Person->Id;
$objAttributeValue->TextValue = $this->lstAttributeMethodJoin->SelectedName;
$objAttributeValue->DatetimeValue = QDateTime::Now();
$objAttributeValue->SingleAttributeOptionId = $this->lstAttributeMethodJoin->SelectedValue;
$objAttributeValue->SingleAttributeOption->Name = $this->lstAttributeMethodJoin->SelectedName;
$objAttributeValue->Save();
}
if ($this->lstAttributeEthnicity != null && $this->lstAttributeEthnicity->SelectedName != '- Select One -') {
$objAttributeValue = new AttributeValue();
$objAttribute = Attribute::QuerySingle(QQ::Equal(QQN::Attribute()->Name, "Ethnicity"));
$objAttributeValue->AttributeId = $objAttribute->Id;
$objAttributeValue->PersonId = $this->mctPerson->Person->Id;
$objAttributeValue->TextValue = $this->lstAttributeEthnicity->SelectedName;
$objAttributeValue->DatetimeValue = QDateTime::Now();
$objAttributeValue->SingleAttributeOptionId = $this->lstAttributeEthnicity->SelectedValue;
$objAttributeValue->SingleAttributeOption->Name = $this->lstAttributeEthnicity->SelectedName;
$objAttributeValue->Save();
}
if ($this->dtxAttributeDateAcceptedChrist != null && $this->dtxAttributeDateAcceptedChrist->DateTime != null) {
$objAttributeValue = new AttributeValue();
$objAttribute = Attribute::QuerySingle(QQ::Equal(QQN::Attribute()->Name, "Date Accepted Christ"));
$objAttributeValue->AttributeId = $objAttribute->Id;
$objAttributeValue->PersonId = $this->mctPerson->Person->Id;
$objAttributeValue->DatetimeValue = $this->dtxAttributeDateAcceptedChrist->DateTime;
$objAttributeValue->DateValue = $this->dtxAttributeDateAcceptedChrist->DateTime;
$objAttributeValue->Save();
}
if ($this->chkAcceptedChristAtALCF->Checked) {
$objAttributeValue = new AttributeValue();
$objAttribute = Attribute::QuerySingle(QQ::Equal(QQN::Attribute()->Name, "Accepted Christ At ALCF"));
$objAttributeValue->AttributeId = $objAttribute->Id;
$objAttributeValue->PersonId = $this->mctPerson->Person->Id;
$objAttributeValue->BooleanValue = true;
$objAttributeValue->Save();
}
}