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


PHP AttributeValue::Save方法代码示例

本文整理汇总了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;
 }
开发者ID:alcf,项目名称:chms,代码行数:43,代码来源:Person.class.php

示例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;
         }
//.........这里部分代码省略.........
开发者ID:alcf,项目名称:chms,代码行数:101,代码来源:index.php

示例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();
     }
 }
开发者ID:alcf,项目名称:chms,代码行数:60,代码来源:new.php


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